Skip to content

chore(db): drop MCP Gateway tables - #8157

Merged
pandemicsyn merged 1 commit into
chore/remove-mcp-gateway-codefrom
chore/drop-mcp-gateway-tables
Oct 19, 2026
Merged

pandemicsyn merged 1 commit into
chore/remove-mcp-gateway-codefrom
chore/drop-mcp-gateway-tables

Conversation

@pandemicsyn

@pandemicsyn pandemicsyn commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #8156. Drops the MCP Gateway database objects now that no code reads them.

  • Drops all 14 mcp_gateway_* tables, including configs, secrets, routes, instances, provider/OAuth grants, authorization requests/codes, refresh tokens, clients, assignments, rate-limit windows, and audit events.
  • Removes the temporary account-anonymization and block/refund cleanup helpers retained by chore/remove mcp gateway code #8156.
  • Removes the organization.mcp_gateway.update admin audit action from the write-side enum.
  • Generated migration: packages/db/src/migrations/0291_moaning_wrecker.sql.

Verification

  • pnpm drizzle generate
  • pnpm drizzle:verify-bootstrap — applied the full migration chain against a fresh database.
  • pnpm --filter @kilocode/db test -- schema.test.ts --runInBand (7 tests)
  • pnpm --filter web test -- src/lib/user/index.test.ts src/lib/admin/admin-action-audit.test.ts (197 tests)
  • pnpm --filter @kilocode/db typecheck and lint
  • tsgo --noEmit -p apps/web/tsconfig.json
  • pnpm --filter web lint
  • pnpm format:changed and git diff --check

Visual Changes

N/A

Reviewer Notes

Historical organization_audit_logs rows that recorded organization.mcp_gateway.update remain; that column is text, so no data migration is required. Only new writes of that action are removed.

The dropped mcp_gateway_audit_events table contains the gateway's own audit trail. Its retention window was 60 days, and dropping the table deletes it immediately. This is intentional because the feature is being retired.

@kilo-code-bot

kilo-code-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review since 39a0785b: the base branch advanced with the auto-triage removal and this PR's migration was regenerated as 0291_moaning_wrecker.sql. Re-verified that the 0291→0291 snapshot relationship is clean (0290 snapshot minus exactly the 14 mcp_gateway_* tables, with byte-identical output for every retained table), that the migration's 14 DROP TABLE statements match the removed schema exports, and that no non-migration code still references mcp_gateway.

Files Reviewed (19 files)
  • apps/web/src/app/admin/api/backfills/block-blacklisted-domains/route.ts
  • apps/web/src/lib/abuse/bulkBlock.ts
  • apps/web/src/lib/admin/admin-action-audit.test.ts
  • apps/web/src/lib/kilo-pass/cancel-and-refund.ts
  • apps/web/src/lib/kilo-pass/stripe-handlers-invoice-paid.ts
  • apps/web/src/lib/mcp-gateway/blocking-service.ts (deleted)
  • apps/web/src/lib/mcp-gateway/lifecycle-service.ts (deleted)
  • apps/web/src/lib/stripe/disputes.ts
  • apps/web/src/lib/stytch.ts
  • apps/web/src/lib/user/index.test.ts
  • apps/web/src/lib/user/index.ts
  • apps/web/src/routers/admin-router.ts
  • apps/web/src/routers/organizations/organization-members-router.ts
  • packages/db/src/migrations/0291_moaning_wrecker.sql
  • packages/db/src/migrations/meta/0291_snapshot.json (generated)
  • packages/db/src/migrations/meta/_journal.json (generated)
  • packages/db/src/schema-types.ts
  • packages/db/src/schema.test.ts
  • packages/db/src/schema.ts
Previous Review Summary (commit 39a0785)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 39a0785)

Status: No Issues Found | Recommendation: Merge

Executive Summary

Verified the MCP Gateway table drop against the schema, generated snapshot, migration, and all call sites; no dangling references, FK dependents, or behavioral regressions were found.

Files Reviewed (19 files)
  • apps/web/src/app/admin/api/backfills/block-blacklisted-domains/route.ts
  • apps/web/src/lib/abuse/bulkBlock.ts
  • apps/web/src/lib/admin/admin-action-audit.test.ts
  • apps/web/src/lib/kilo-pass/cancel-and-refund.ts
  • apps/web/src/lib/kilo-pass/stripe-handlers-invoice-paid.ts
  • apps/web/src/lib/mcp-gateway/blocking-service.ts (deleted)
  • apps/web/src/lib/mcp-gateway/lifecycle-service.ts (deleted)
  • apps/web/src/lib/stripe/disputes.ts
  • apps/web/src/lib/stytch.ts
  • apps/web/src/lib/user/index.test.ts
  • apps/web/src/lib/user/index.ts
  • apps/web/src/routers/admin-router.ts
  • apps/web/src/routers/organizations/organization-members-router.ts
  • packages/db/src/migrations/0290_regular_molecule_man.sql
  • packages/db/src/migrations/meta/0290_snapshot.json (generated)
  • packages/db/src/migrations/meta/_journal.json (generated)
  • packages/db/src/schema-types.ts
  • packages/db/src/schema.test.ts
  • packages/db/src/schema.ts

Notes: all 14 mcp_gateway_* tables from the prior snapshot are covered by the migration, no non-gateway table has an FK into the dropped set, the 0289→0290 snapshot diff removes exactly those 14 tables with no other drift, and mcp-gateway/mcp_gateway/MCPGateway have no remaining references outside historical migrations. Dropping mcp_gateway_audit_events immediately rather than waiting out its 60-day retention is intentional per the PR description.


Reviewed by deepseek-v4.1-flash-1017 · Input: 63.6K · Output: 11.9K · Cached: 1.2M

Review guidance: REVIEW.md from base branch chore/remove-mcp-gateway-code

@pandemicsyn
pandemicsyn added this pull request to the merge queue Oct 19, 2026
@pandemicsyn
pandemicsyn removed this pull request from the merge queue due to a manual request Oct 19, 2026
@pandemicsyn
pandemicsyn force-pushed the chore/drop-mcp-gateway-tables branch from 39a0785 to d758ff4 Compare October 19, 2026 21:05
@pandemicsyn
pandemicsyn added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit 2d93713 Oct 19, 2026
85 checks passed
@pandemicsyn
pandemicsyn deleted the chore/drop-mcp-gateway-tables branch October 19, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants