chore: isolate the remaining toolset MCP hosting columns ahead of their drop
Closes AIM-731 (3 of 3). Stacked on #8127.
Summary
- New
hostedmcp/legacyaliaspackage. This is the one seam that reads and writes the legacy/mcp/<slug>alias (toolsets.mcp_slug/custom_domain_id). It has its own sqlc package and these Go functions:FindandFindInProject: the slug-fallback lookups.GetandList: alias reads.Taken: the toolset branch of the unified slug check.FollowAlias/AliasAddress: moved here fromhostingstate.SetFixture: for tests.
AIM-670 deletes this package along with every call to it.
- Alias reads moved behind the seam. Every former alias read now goes through it. Queries that joined
t.mcp_slugno longer name it; Go fills the alias in throughlegacyalias. Covered:- the MCP slug fallback, install page, export and well-known pages
- the unified slug availability check (endpoint creation, custom-domain root, approvals server)
- gateway telemetry matchers
- assistants attachments and enable checks
- Platform MCP plugin views
- plugin generation
- the external MCP migration
- toolset views
- the OpenAPI impact report
- admin health
- attach-impact
- mint
- sqlc retired-columns overlay.
server/database/sqlc_retired_columns.sqlnow drops all five hosting columns. Every sqlc package exceptlegacyaliaslists it, sotoolsetsrepo.Toolsetand every other generated toolset row no longer hasMcpSlug,McpIsPublic,McpEnabled,CustomDomainIDorUserSessionIssuerID. ExpandedSELECT */RETURNING *no longer name them. - The demo seed postflight no longer checks the columns. It still checks that each canonical server mirrors its toolset and has an endpoint.
Motivation
AIM-671 drops the five columns. Before it does, nothing may read or write them except the alias code AIM-670 owns. This PR makes that boundary checkable.
How it is proven:
- Go: the overlay removes the fields from every generated struct outside
legacyalias, so any Go read or write of them fails to compile.go build ./...andgo vet ./...pass. - SQL: sqlc's analyzer does not check column references inside subqueries, so the overlay alone cannot prove the SQL. Instead, every query of every sqlc package except
legacyaliaswas prepared against a database with the five columns dropped. This usedsqlc vetwith thesqlc/db-preparerule, on a copy ofsqlc.yamlwhose entries point at a schema-only database whereALTER TABLE toolsets DROP COLUMN ... CASCADEhad removed the five columns.- Every query prepared, apart from the unrelated
localaccountsschema, which is not in that database. - Control: the same check on the base PR fails with 36 "column does not exist" errors, in admin, assistants, demoseed, deployments, externalmcp, mcpendpoints, metamcp, platformmcp, plugins, testenv and toolsets.
- Every query prepared, apart from the unrelated
- Text: a scan of all
queries.sqlfiles for the five column names next totoolsetsfinds them only inlegacyalias. The other hits are other tables' columns with the same names.
Rollout
-
For the AIM-671 drop:
legacyaliasstill reads and writesmcp_slugandcustom_domain_id, so those two can only be dropped after AIM-670 deletes the package.mcp_is_public,mcp_enabledanduser_session_issuer_idcan be dropped once this PR is on every pod. The drop migration must also remove its lines fromsqlc_retired_columns.sql. -
Merging main into the stack: main already deleted
sqlc_retired_columns.sqlalong with theoauth_proxy_server_iddrop (#8020). When the stack merges main, keep the file and drop itsoauth_proxy_server_idline. -
No schema or API change.
-
Toolset response hosting fields are unchanged: the hosted server's endpoint, else the legacy alias, else none.
š¤ Generated with Claude Code