Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(routing): rename /new-workspace to /workspaces/new + extend reserved slug list (#1188)
Naiyuan Qing6d6bc5a6f225
diff --git a/CLAUDE.md b/CLAUDE.mdindex 2f11ee186f..cbe83e3f96 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -133,6 +133,7 @@ make start-worktree # Start using .env.worktree- Unless the user explicitly asks for backwards compatibility, do **not** add compatibility layers, fallback paths, dual-write logic, legacy adapters, or temporary shims.- If a flow or API is being replaced and the product is not yet live, prefer removing the old path instead of preserving both old and new behavior.- Avoid broad refactors unless required by the task.+- New global (pre-workspace) routes MUST use a single word (`/login`, `/inbox`) or a `/{noun}/{verb}` pair (`/workspaces/new`). NEVER add hyphenated word-group root routes (`/new-workspace`, `/create-team`) — they collide with common user workspace names and force endless reserved-slug audits. Reserving the noun (`workspaces`) automatically protects the entire `/workspaces/*` subtree.### Package Boundary Rulesdiff --git a/apps/desktop/src/renderer/src/components/desktop-layout.tsx b/apps/desktop/src/renderer/src/components/desktop-layout.tsxindex b8c0c61201..72c1fbd200 100644--- a/apps/desktop/src/renderer/src/components/desktop-layout.tsx+++ b/apps/desktop/src/renderer/src/components/desktop-layout.tsx@@ -113,7 +113,7 @@ export function DesktopShell() {mount WorkspaceRouteLayout, which calls setCurrentWorkspace()to populate the slug. The sidebar gates on slug being presentto avoid the useRequiredWorkspaceSlug throw. Zero-workspace- users are routed to /new-workspace by IndexRedirect. */}+ users are routed to /workspaces/new by IndexRedirect. */}<WorkspaceSlugProvider slug={slug}><div className="flex h-screen"><SidebarProvider className="flex-1">diff --git a/apps/desktop/src/renderer/src/routes.tsx b/apps/desktop/src/renderer/src/routes.tsxindex 61ae74f5c4..9946fa344f 100644--- a/apps/desktop/src/renderer/src/routes.tsx+++ b/apps/desktop/src/renderer/src/routes.tsx@@ -76,7 +76,7 @@ function NewWorkspaceRoute() {* duplicate fetches across tabs — each tab's memory router hits this* component independently but the query is deduped.*- * Sends first-time users without any workspace to /new-workspace,+ * Sends first-time users without any workspace to /workspaces/new,* everyone else to their first workspace's issues page. Persisted tab* paths that already carry a workspace slug bypass this component* entirely.@@ -84,7 +84,7 @@ function NewWorkspaceRoute() {function IndexRedirect() {const { data: wsList, isFetched } = useQuery(workspaceListOptions());- // Wait for the query to settle so we don't redirect to /new-workspace+ // Wait for the query to settle so we don't redirect to /workspaces/new// on the initial render before the seeded/fetched data arrives.if (!isFetched) return null;@@ -108,7 +108,7 @@ function InviteRoute() {* Structure mirrors the web app's [workspaceSlug]/... layout: all dashboard* pages live under /:workspaceSlug, with WorkspaceRouteLayout resolving the* slug to a workspace and syncing side-effects (api client, persist namespace,- * Zustand mirror). Global (pre-workspace) routes — new-workspace and invite —+ * Zustand mirror). Global (pre-workspace) routes — workspaces/new and invite —* sit at the top level alongside the workspace wrapper.*/export const appRoutes: RouteObject[] = [@@ -118,10 +118,10 @@ export const appRoutes: RouteObject[] = [// Top-level index: no slug yet. `IndexRedirect` reads the workspace// list from React Query cache (seeded by AuthInitializer on reopen// or App.tsx on deep-link login) and bounces to the first- // workspace's issues page — or /new-workspace if the user has none.+ // workspace's issues page — or /workspaces/new if the user has none.{ index: true, element: <IndexRedirect /> },{- path: "new-workspace",+ path: "workspaces/new",element: <NewWorkspaceRoute />,handle: { title: "Create Workspace" },},diff --git a/apps/desktop/src/renderer/src/stores/tab-store.ts b/apps/desktop/src/renderer/src/stores/tab-store.tsindex 519b0e4832..d906276e4f 100644--- a/apps/desktop/src/renderer/src/stores/tab-store.ts+++ b/apps/desktop/src/renderer/src/stores/tab-store.ts@@ -44,7 +44,7 @@ interface TabStore {* current user doesn't have access to. Called after login + workspace list* is populated (and on every subsequent list change, e.g. realtime* workspace:deleted). Stale tabs get reset to `/` so IndexRedirect picks- * a valid workspace; tabs on global paths (/login, /new-workspace, etc.)+ * a valid workspace; tabs on global paths (/login, /workspaces/new, etc.)* are untouched.*/validateWorkspaceSlugs: (validSlugs: Set<string>) => void;@@ -72,7 +72,7 @@ const ROUTE_ICONS: Record<string, string> = {** Path shape after the workspace URL refactor:* - workspace-scoped: `/{workspaceSlug}/{route}/...` → use segment index 1- * - global (new-workspace/invite/auth/login): `/{route}/...` → use segment index 0+ * - global (workspaces/new, invite, auth, login): `/{route}/...` → use segment index 0** `isGlobalPath` is the single source of truth for which prefixes are global.*/@@ -204,7 +204,7 @@ export const useTabStore = create<TabStore>()(// Stale slug: dispose the old router and replace with a fresh one// pointing at `/`. IndexRedirect will send the tab to a valid- // workspace (or /new-workspace if the user now has none).+ // workspace (or /workspaces/new if the user now has none).changed = true;t.router.dispose();return {diff --git a/apps/web/app/(auth)/login/page.tsx b/apps/web/app/(auth)/login/page.tsxindex 2c6b2704e0..49a70a9dd8 100644--- a/apps/web/app/(auth)/login/page.tsx+++ b/apps/web/app/(auth)/login/page.tsx@@ -29,7 +29,7 @@ function LoginPageContent() {const nextUrl = searchParams.get("next");// Already authenticated — honor ?next= or fall back to first workspace- // (or /new-workspace if the user has none). Skip this entire path when+ // (or /workspaces/new if the user has none). Skip this entire path when// the user arrived to authorize the CLI.useEffect(() => {if (isLoading || !user || cliCallbackRaw) return;diff --git a/apps/web/app/(auth)/new-workspace/page.tsx b/apps/web/app/(auth)/workspaces/new/page.tsxsimilarity index 100%rename from apps/web/app/(auth)/new-workspace/page.tsxrename to apps/web/app/(auth)/workspaces/new/page.tsxdiff --git a/apps/web/app/auth/callback/page.tsx b/apps/web/app/auth/callback/page.tsxindex cbc7f2e095..bcc9fd4c88 100644--- a/apps/web/app/auth/callback/page.tsx+++ b/apps/web/app/auth/callback/page.tsx@@ -66,7 +66,7 @@ function CallbackContent() {// URL is now the source of truth for the current workspace — the// [workspaceSlug]/layout syncs stores + cookie once we navigate.// Honor ?next= first (e.g. came from /invite/{id}), otherwise land- // in the first workspace's issues, or /new-workspace for zero-workspace users.+ // in the first workspace's issues, or /workspaces/new for zero-workspace users.const [first] = wsList;const defaultDest = first? paths.workspace(first.slug).issues()diff --git a/apps/web/features/landing/components/redirect-if-authenticated.tsx b/apps/web/features/landing/components/redirect-if-authenticated.tsxindex c803dc092b..8572355bbd 100644--- a/apps/web/features/landing/components/redirect-if-authenticated.tsx+++ b/apps/web/features/landing/components/redirect-if-authenticated.tsx@@ -16,7 +16,7 @@ import { paths } from "@multica/core/paths";* login* — before the user has ever visited a workspace — the cookie is* absent, so the proxy falls through to the landing page. This component* covers that gap: once auth is resolved and the workspace list has loaded,- * push the user into their workspace (or /new-workspace if they have none).+ * push the user into their workspace (or /workspaces/new if they have none).** Renders nothing. Uses `router.replace` so the landing page never enters* browser history for authenticated users.diff --git a/packages/core/navigation/store.test.ts b/packages/core/navigation/store.test.tsindex f5a7cfbc86..24a22da61c 100644--- a/packages/core/navigation/store.test.ts+++ b/packages/core/navigation/store.test.ts@@ -5,13 +5,13 @@ import { describe, it, expect } from "vitest";// persistence — otherwise lastPath could contain /login etc, and on next// app load we'd "restore" a user to the login page.describe("useNavigationStore.lastPath excludes global paths", () => {- it("does not persist /login, /new-workspace, /invite/, /auth/, /logout, /signup", async () => {+ it("does not persist /login, /workspaces/new, /invite/, /auth/, /logout, /signup", async () => {const { useNavigationStore } = await import("./store");const globalPrefixes = ["/login","/logout","/signup",- "/new-workspace",+ "/workspaces/new","/invite/abc","/auth/callback",];diff --git a/packages/core/navigation/store.ts b/packages/core/navigation/store.tsindex 1ec008b01b..2798ded7b7 100644--- a/packages/core/navigation/store.ts+++ b/packages/core/navigation/store.ts@@ -10,13 +10,13 @@ import { defaultStorage } from "../platform/storage";// Paths that should not be persisted as "last visited":// - Auth flows (/login, /signup, /logout)-// - Pre-workspace routes (/new-workspace, /auth/, /invite/)+// - Pre-workspace routes (/workspaces/new, /auth/, /invite/)// - Pair flow (/pair/)const EXCLUDED_PREFIXES = ["/login","/signup","/logout",- "/new-workspace",+ "/workspaces/","/auth/","/invite/","/pair/",diff --git a/packages/core/paths/consistency.test.ts b/packages/core/paths/consistency.test.tsindex e313fb9a3d..3b4bc890a6 100644--- a/packages/core/paths/consistency.test.ts+++ b/packages/core/paths/consistency.test.ts@@ -66,7 +66,7 @@ describe("global path / reserved slug consistency", () => {"/login","/logout","/signup",- "/new-workspace",+ "/workspaces/","/invite/","/auth/",];diff --git a/packages/core/paths/paths.test.ts b/packages/core/paths/paths.test.tsindex 5f603078f1..8fa4e04b41 100644--- a/packages/core/paths/paths.test.ts+++ b/packages/core/paths/paths.test.ts@@ -27,7 +27,7 @@ describe("paths.workspace(slug)", () => {describe("paths (global)", () => {it("builds global paths without slug", () => {expect(paths.login()).toBe("/login");- expect(paths.newWorkspace()).toBe("/new-workspace");+ expect(paths.newWorkspace()).toBe("/workspaces/new");expect(paths.invite("inv-1")).toBe("/invite/inv-1");expect(paths.authCallback()).toBe("/auth/callback");});@@ -36,7 +36,7 @@ describe("paths (global)", () => {describe("isGlobalPath", () => {it("returns true for pre-workspace routes", () => {expect(isGlobalPath("/login")).toBe(true);- expect(isGlobalPath("/new-workspace")).toBe(true);+ expect(isGlobalPath("/workspaces/new")).toBe(true);expect(isGlobalPath("/invite/abc")).toBe(true);expect(isGlobalPath("/auth/callback")).toBe(true);});diff --git a/packages/core/paths/paths.ts b/packages/core/paths/paths.tsindex e0a298869e..f46a528cd0 100644--- a/packages/core/paths/paths.ts+++ b/packages/core/paths/paths.ts@@ -38,7 +38,7 @@ export const paths = {// Global (pre-workspace) routeslogin: () => "/login",- newWorkspace: () => "/new-workspace",+ newWorkspace: () => "/workspaces/new",invite: (id: string) => `/invite/${encode(id)}`,authCallback: () => "/auth/callback",root: () => "/",@@ -48,7 +48,9 @@ export type WorkspacePaths = ReturnType<typeof workspaceScoped>;// Prefixes — not slug names — because we match against full URL paths.// A path is global if it equals or begins with any of these.-const GLOBAL_PREFIXES = ["/login", "/new-workspace", "/invite/", "/auth/", "/logout", "/signup"];+// Note: `/workspaces/` (trailing slash) is the prefix — `workspaces` is reserved,+// so any path starting with `/workspaces/...` is system-owned, not user-owned.+const GLOBAL_PREFIXES = ["/login", "/workspaces/", "/invite/", "/auth/", "/logout", "/signup"];export function isGlobalPath(path: string): boolean {return GLOBAL_PREFIXES.some((p) => path === p || path.startsWith(p));diff --git a/packages/core/paths/reserved-slugs.ts b/packages/core/paths/reserved-slugs.tsindex 0903a08623..5a28d9c523 100644--- a/packages/core/paths/reserved-slugs.ts+++ b/packages/core/paths/reserved-slugs.ts@@ -1,31 +1,53 @@/**- * Slugs reserved because they collide with frontend top-level routes.+ * Slugs reserved because they collide with frontend top-level routes,+ * platform features, or web standards.+ ** Keep in sync with server/internal/handler/workspace_reserved_slugs.go.+ *+ * Convention for new global routes (CLAUDE.md): use a single word+ * (`/login`, `/inbox`) or `/{noun}/{verb}` (`/workspaces/new`). Hyphenated+ * root-level word groups (`/new-workspace`, `/create-team`) collide with+ * common user workspace names — see PR for full discussion.*/export const RESERVED_SLUGS = new Set([- // Auth + onboarding+ // Auth flow"login","logout",+ "signin",+ "signout","signup",- "onboarding",- "new-workspace",- "invite","auth",+ "oauth",+ "callback",+ "invite",+ "verify",+ "reset",+ "password",+ "onboarding", // historical, kept reserved post-removal- // Reserved for future platform routes+ // Platform / marketing routes (current + likely-future)"api","admin","help","about","pricing","changelog",+ "docs",+ "support",+ "status",+ "legal",+ "privacy",+ "terms",+ "security",+ "contact",+ "blog",+ "careers",+ "press",+ "download",- // Dashboard route segments. Even though Next.js's route specificity- // would technically resolve /{slug}/{view} correctly, having a workspace- // slug equal to a route name (e.g. slug="issues") makes URLs visually- // ambiguous — /issues/abc reads as either "issue abc in workspace- // 'issues'" or "issue abc in some workspace". Reserve to avoid the- // ambiguity entirely.+ // Dashboard / workspace route segments. Reserving the segment name+ // prevents `/{slug}/{view}` from being visually ambiguous (e.g. a+ // workspace named "issues" makes `/issues/abc` mean two things)."issues","projects","autopilots",@@ -35,8 +57,29 @@ export const RESERVED_SLUGS = new Set(["runtimes","skills","settings",+ "workspaces", // global `/workspaces/new` workspace creation page+ "teams", // reserved for future team management routes++ // RFC 2142 — privileged email mailboxes. Allowing user workspaces with+ // these slugs would let attackers spoof system messaging.+ "postmaster",+ "abuse",+ "noreply",+ "webmaster",+ "hostmaster",++ // Hostname / subdomain confusables. Even on path-based routing these+ // names attract phishing and subdomain-takeover attempts.+ "mail",+ "ftp",+ "static",+ "cdn",+ "assets",+ "public",+ "files",+ "uploads",- // Next.js / hosting internals+ // Next.js / web standards (framework-mandated)"_next","favicon.ico","robots.txt",diff --git a/packages/views/auth/login-page.tsx b/packages/views/auth/login-page.tsxindex 512d9bbbd6..d7d8540b97 100644--- a/packages/views/auth/login-page.tsx+++ b/packages/views/auth/login-page.tsx@@ -199,7 +199,7 @@ export function LoginPage({// Normal path: seed the workspace list into the Query cache so the// caller's onSuccess can read it synchronously to compute a destination- // URL (first workspace's slug, or /new-workspace for zero-workspace+ // URL (first workspace's slug, or /workspaces/new for zero-workspace// users).await useAuthStore.getState().verifyCode(email, value);const wsList = await api.listWorkspaces();diff --git a/packages/views/layout/use-dashboard-guard.ts b/packages/views/layout/use-dashboard-guard.tsindex 5967f52b5b..1fbcdd6aa4 100644--- a/packages/views/layout/use-dashboard-guard.ts+++ b/packages/views/layout/use-dashboard-guard.ts@@ -15,12 +15,12 @@ import { useNavigation } from "../navigation";* - Auth still loading → wait* - Not logged in → /login* - Logged in but workspace list not yet loaded → wait (don't bounce prematurely)- * - Logged in but URL slug doesn't resolve to any workspace → /new-workspace+ * - Logged in but URL slug doesn't resolve to any workspace → /workspaces/new** We read the workspace list query state directly (rather than relying on* useCurrentWorkspace's null return) so we can distinguish "list loading"* from "slug not found". Otherwise users could see a transient redirect- * to /new-workspace before their workspace list arrives.+ * to /workspaces/new before their workspace list arrives.*/export function useDashboardGuard() {const { pathname, replace } = useNavigation();diff --git a/packages/views/settings/components/workspace-tab.tsx b/packages/views/settings/components/workspace-tab.tsxindex 2fdf6d9f48..57149ac7a8 100644--- a/packages/views/settings/components/workspace-tab.tsx+++ b/packages/views/settings/components/workspace-tab.tsx@@ -45,7 +45,7 @@ export function WorkspaceTab() {/*** After leaving/deleting the current workspace, send the user to a safe URL:- * another workspace they still have access to, or /new-workspace if none+ * another workspace they still have access to, or /workspaces/new if none* remain. The list is freshly fetched (staleTime: 0) because the cache still* contains the just-removed workspace until the background invalidation* resolves.diff --git a/packages/views/workspace/new-workspace-page.tsx b/packages/views/workspace/new-workspace-page.tsxindex a5ccca43c9..c198b5c27a 100644--- a/packages/views/workspace/new-workspace-page.tsx+++ b/packages/views/workspace/new-workspace-page.tsx@@ -4,7 +4,7 @@ import type { Workspace } from "@multica/core/types";import { CreateWorkspaceForm } from "./create-workspace-form";/**- * Full-page shell for the /new-workspace route. Shared between web+ * Full-page shell for the /workspaces/new route. Shared between web* (Next.js) and desktop (react-router) so the two apps can't drift.* Callers provide the onSuccess handler — that's the only app-specific* piece, because each app uses its own navigation primitive.diff --git a/server/cmd/multica/cmd_login.go b/server/cmd/multica/cmd_login.goindex ab9b10cbfa..d1c017fc54 100644--- a/server/cmd/multica/cmd_login.go+++ b/server/cmd/multica/cmd_login.go@@ -125,7 +125,7 @@ func waitForWorkspaceCreation(cmd *cobra.Command, client *cli.APIClient) ([]strureturn nil, nil}- createWorkspaceURL := appURL + "/new-workspace"+ createWorkspaceURL := appURL + "/workspaces/new"fmt.Fprintln(os.Stderr, "\nNo workspaces found. Opening workspace creation in your browser...")if err := openBrowser(createWorkspaceURL); err != nil {diff --git a/server/cmd/server/integration_test.go b/server/cmd/server/integration_test.goindex dbce566c5d..161f3e5919 100644--- a/server/cmd/server/integration_test.go+++ b/server/cmd/server/integration_test.go@@ -347,7 +347,7 @@ func TestVerifyCodeNewUserHasNoWorkspace(t *testing.T) {}readJSON(t, resp, &loginResp)- // New users should have no workspaces (/new-workspace creates one)+ // New users should have no workspaces (/workspaces/new creates one)req, _ := http.NewRequest("GET", testServer.URL+"/api/workspaces", nil)req.Header.Set("Authorization", "Bearer "+loginResp.Token)workspacesResp, err := http.DefaultClient.Do(req)diff --git a/server/internal/handler/handler_test.go b/server/internal/handler/handler_test.goindex 29973444a4..79614baec1 100644--- a/server/internal/handler/handler_test.go+++ b/server/internal/handler/handler_test.go@@ -854,7 +854,7 @@ func TestVerifyCodeNewUserHasNoWorkspace(t *testing.T) {t.Fatalf("GetUserByEmail: %v", err)}- // New users should have no workspaces (/new-workspace creates one)+ // New users should have no workspaces (/workspaces/new creates one)workspaces, err := testHandler.Queries.ListWorkspaces(ctx, user.ID)if err != nil {t.Fatalf("ListWorkspaces: %v", err)diff --git a/server/internal/handler/workspace_reserved_slugs.go b/server/internal/handler/workspace_reserved_slugs.goindex d5416ef020..6bb075b64a 100644--- a/server/internal/handler/workspace_reserved_slugs.go+++ b/server/internal/handler/workspace_reserved_slugs.go@@ -1,42 +1,82 @@package handler// reservedSlugs are workspace slugs that would collide with frontend top-level-// routes. The frontend URL shape is /{workspaceSlug}/... so any slug that-// matches a top-level route (e.g. /login, /api) would be unreachable.+// routes, platform features, or web standards. The frontend URL shape is+// /{workspaceSlug}/... so any slug that matches a top-level route or a+// system-significant name is rejected at workspace creation time.//// Keep this list in sync with packages/core/paths/reserved-slugs.ts.+//+// Convention for new global routes: use a single word (`/login`, `/inbox`)+// or `/{noun}/{verb}` (`/workspaces/new`). Hyphenated root-level word groups+// (`/new-workspace`, `/create-team`) collide with common user workspace names.var reservedSlugs = map[string]bool{- // Auth + onboarding routes- "login": true,- "logout": true,- "signup": true,- "onboarding": true,- "new-workspace": true,- "invite": true,- "auth": true,+ // Auth flow+ "login": true,+ "logout": true,+ "signin": true,+ "signout": true,+ "signup": true,+ "auth": true,+ "oauth": true,+ "callback": true,+ "invite": true,+ "verify": true,+ "reset": true,+ "password": true,+ "onboarding": true, // historical, kept reserved post-removal- // Reserved for future platform routes+ // Platform / marketing routes (current + likely-future)"api": true,"admin": true,"help": true,"about": true,"pricing": true,"changelog": true,+ "docs": true,+ "support": true,+ "status": true,+ "legal": true,+ "privacy": true,+ "terms": true,+ "security": true,+ "contact": true,+ "blog": true,+ "careers": true,+ "press": true,+ "download": true,- // Dashboard route segments. Reserved to avoid URL ambiguity — a- // workspace named "issues" with /issues/abc URL reads as either- // "issue abc in workspace 'issues'" or "issue abc in some workspace".- "issues": true,- "projects": true,+ // Dashboard / workspace route segments+ "issues": true,+ "projects": true,"autopilots": true,- "agents": true,- "inbox": true,- "my-issues": true,- "runtimes": true,- "skills": true,- "settings": true,+ "agents": true,+ "inbox": true,+ "my-issues": true,+ "runtimes": true,+ "skills": true,+ "settings": true,+ "workspaces": true, // global /workspaces/new workspace creation page+ "teams": true, // reserved for future team management routes++ // RFC 2142 — privileged email mailboxes+ "postmaster": true,+ "abuse": true,+ "noreply": true,+ "webmaster": true,+ "hostmaster": true,++ // Hostname / subdomain confusables+ "mail": true,+ "ftp": true,+ "static": true,+ "cdn": true,+ "assets": true,+ "public": true,+ "files": true,+ "uploads": true,- // Next.js / hosting internals+ // Next.js / web standards"_next": true,"favicon.ico": true,"robots.txt": true,diff --git a/server/internal/handler/workspace_test.go b/server/internal/handler/workspace_test.goindex 7b202e22e6..4bf8b1f57a 100644--- a/server/internal/handler/workspace_test.go+++ b/server/internal/handler/workspace_test.go@@ -4,33 +4,18 @@ import ("fmt""net/http""net/http/httptest"+ "sort""testing")func TestCreateWorkspace_RejectsReservedSlug(t *testing.T) {- reserved := []string{- // Auth + onboarding (covered by migration 043 audit)- "login",- "onboarding",- "new-workspace",- "invite",- "api",- "settings",- "admin",- "auth",- "signup",- "logout",- "_next",- "favicon.ico",- "robots.txt",- "sitemap.xml",- // Dashboard route segments (covered by migration 045 audit)- "issues",- "projects",- "agents",- "inbox",- "my-issues",+ // Drive the test off the actual reservedSlugs map so the test can never+ // drift from the source of truth. New entries are covered automatically.+ reserved := make([]string, 0, len(reservedSlugs))+ for slug := range reservedSlugs {+ reserved = append(reserved, slug)}+ sort.Strings(reserved) // deterministic test orderfor _, slug := range reserved {t.Run(slug, func(t *testing.T) {diff --git a/server/migrations/046_audit_new_workspace_slug.down.sql b/server/migrations/046_audit_new_workspace_slug.down.sqldeleted file mode 100644index 5b6618be3d..0000000000--- a/server/migrations/046_audit_new_workspace_slug.down.sql+++ /dev/null@@ -1 +0,0 @@--- No-op: 046 is an audit-only migration. Nothing to roll back.diff --git a/server/migrations/046_audit_new_workspace_slug.up.sql b/server/migrations/046_audit_new_workspace_slug.up.sqldeleted file mode 100644index 51833a5b29..0000000000--- a/server/migrations/046_audit_new_workspace_slug.up.sql+++ /dev/null@@ -1,22 +0,0 @@--- Audit existing workspace slugs against the newly-added "new-workspace"--- reserved slug. The frontend wires /new-workspace as the global workspace--- creation page (replacing the old /onboarding flow); reserving the slug--- prevents a workspace from being created with slug = "new-workspace" that--- would shadow that route.------ Keep this slug in sync with:--- - server/internal/handler/workspace_reserved_slugs.go--- - packages/core/paths/reserved-slugs.ts--DO $$-DECLARE- conflict_count INT;-BEGIN- SELECT COUNT(*) INTO conflict_count- FROM workspace- WHERE slug = 'new-workspace';-- IF conflict_count > 0 THEN- RAISE EXCEPTION 'Found % workspace(s) with slug "new-workspace" that collides with the global route. Rename or delete before deploying.', conflict_count;- END IF;-END $$;diff --git a/server/migrations/047_audit_extended_reserved_slugs.down.sql b/server/migrations/047_audit_extended_reserved_slugs.down.sqlnew file mode 100644index 0000000000..663fbde7cc--- /dev/null+++ b/server/migrations/047_audit_extended_reserved_slugs.down.sql@@ -0,0 +1 @@+-- No-op: 047 is an audit-only migration. Nothing to roll back.diff --git a/server/migrations/047_audit_extended_reserved_slugs.up.sql b/server/migrations/047_audit_extended_reserved_slugs.up.sqlnew file mode 100644index 0000000000..941687f021--- /dev/null+++ b/server/migrations/047_audit_extended_reserved_slugs.up.sql@@ -0,0 +1,65 @@+-- Audit existing workspace slugs against the extended reserved-slug list.+--+-- This PR (1) renames the global workspace-creation route from /new-workspace+-- to /workspaces/new, which moves the reserved name from "new-workspace" to+-- "workspaces", and (2) expands the reserved slug list to cover the broader+-- set recommended by the URL-design audit (auth flow words, RFC 2142 mailbox+-- names, hostname confusables, common platform routes).+--+-- Migration 046 was REMOVED in the same PR. It was auditing "new-workspace"+-- which is no longer reserved, so it had become dead code AND was actively+-- blocking prd deploy on a real-user workspace that no longer needs renaming+-- (the workspace is now safe under the new route — `new-workspace` slug+-- resolves to its workspace, no longer shadowed by the global route which+-- moved to /workspaces/new). Removing 046 is forward-only safe: 046 had+-- never successfully applied in prd (it was the source of the deploy+-- block), and the audit-only nature means down-rollback is a no-op.+--+-- The data audit was performed before this migration was written and confirmed+-- ZERO conflicts for every slug listed below in production. This migration+-- exists as a safety net: if a workspace with one of these slugs slips into+-- prod between audit and deploy, the migration will fail loudly rather than+-- silently shadowing the workspace behind a system route.+--+-- Slugs INTENTIONALLY OMITTED from this audit despite being in the reserved+-- list: 'admin', 'multica', 'new', 'setup', 'www'. These already have one+-- conflicting workspace each in production. They will be handled in a+-- follow-up PR (rename via owner outreach + targeted migration), not blocked+-- on this deploy.+--+-- Keep this slug list aligned with:+-- - server/internal/handler/workspace_reserved_slugs.go+-- - packages/core/paths/reserved-slugs.ts++DO $$+DECLARE+ conflict_count INT;+ conflict_list TEXT;+BEGIN+ SELECT+ COUNT(*),+ string_agg(slug, ', ' ORDER BY slug)+ INTO conflict_count, conflict_list+ FROM workspace+ WHERE slug IN (+ -- Auth flow (newly added)+ 'signin', 'signout', 'oauth', 'callback', 'verify', 'reset', 'password',++ -- Platform routes (newly added)+ 'docs', 'support', 'status', 'legal', 'privacy', 'terms', 'security',+ 'contact', 'blog', 'careers', 'press', 'download',++ -- Workspace/team segments (newly added — replaces 'new-workspace')+ 'workspaces', 'teams',++ -- RFC 2142 mailboxes (newly added)+ 'postmaster', 'abuse', 'noreply', 'webmaster', 'hostmaster',++ -- Hostname confusables (newly added)+ 'mail', 'ftp', 'static', 'cdn', 'assets', 'public', 'files', 'uploads'+ );++ IF conflict_count > 0 THEN+ RAISE EXCEPTION 'Found % workspace(s) with slugs that collide with extended reserved list: %. Rename or delete before deploying.', conflict_count, conflict_list;+ END IF;+END $$;