Skip to content

fix(cli): stop skipping colliding schemas (CLI-2272) - #6394

Open
7ttp wants to merge 5 commits into
developfrom
7ttp/drop-schemas-oid-collision
Open

fix(cli): stop skipping colliding schemas (CLI-2272)#6394
7ttp wants to merge 5 commits into
developfrom
7ttp/drop-schemas-oid-collision

Conversation

@7ttp

@7ttp 7ttp commented Aug 29, 2026

Copy link
Copy Markdown
Member

TL;DR

fixes db reset, db lint, db diff, and migration down silently skipping a user schema when its oid also appears in another catalog
which was caused by joining pg_depend on objid without the classid that scopes oids to a single catalog

now fixed by constraining the join to pg_catalog.pg_namespace rows in every copy of the query.
Resets now drop schemas that earlier versions silently skipped....

ref:

@7ttp 7ttp self-assigned this Aug 29, 2026
@7ttp

7ttp commented Aug 30, 2026

Copy link
Copy Markdown
Member Author

/ai-review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by a newer AI review

🤖 AI Review

The core pg_depend fix is sound and consistently applied across all six SQL copies. Of Claude's six findings, five are confirmed: the underlying duplication remains, the drift guard omits the Go SQL files, its regression regex is brittle, its source unescaping is incomplete, and the unchanged advisors query has a related cross-catalog OID bug. The test-organization finding is refuted because the guarded modules share one invariant and trusted conventions do not require module-matched test filenames. Codex reported no findings. No major or critical issues were found.

Findings

Severity Location Category Sources Claim
🟡 MINOR apps/cli/src/legacy/commands/db/shared/legacy-migra.deno-templates.unit.test.ts:65 duplication claude The new equality tests preserve four hand-copied SQL literals instead of consolidating their shared SQL definitions.
🟡 MINOR apps/cli-go/pkg/migration/queries/list.sql:6 test-coverage claude The new drift guard covers only the four TypeScript copies and does not protect the two changed Go SQL files from regressing to the unconstrained join.
🟡 MINOR apps/cli/src/legacy/commands/db/advisors/advisors.lints-sql.ts:11 correctness claude The advisors SQL has a related unconstrained pg_depend join that can hide an unindexed foreign key when an extension dependency from another catalog shares the table OID.
⚪ NIT apps/cli/src/legacy/commands/db/shared/legacy-migra.deno-templates.unit.test.ts:59 test-quality claude The unconstrained-join regex is formatting-sensitive and can reject a corrected multiline join or miss an unconstrained join followed by same-line text.
⚪ NIT apps/cli/src/legacy/commands/db/shared/legacy-migra.deno-templates.unit.test.ts:49 test-quality claude extractSqlLiteral performs unnecessary and incomplete template-literal unescaping.

Findings outside the diff

  • 🟡 MINOR apps/cli/src/legacy/commands/db/advisors/advisors.lints-sql.ts:11 — The advisors SQL has a related unconstrained pg_depend join that can hide an unindexed foreign key when an extension dependency from another catalog shares the table OID.
Refuted findings (kept for transparency, not posted as review comments)
  • apps/cli/src/legacy/commands/db/shared/legacy-migra.deno-templates.unit.test.ts:52 (test-organization): The schema-listing guard is misplaced because it tests unrelated modules from a file named for migra Deno templates.
    Refuted: The modules are related by the exact shared invariant under test, and the test is located in db/shared. The trusted testing guidance requires the .unit.test.ts project suffix but does not require every test filename to match one production module; the cited code-structure examples do not establish that rule.

Stats

Claude findings: 6 · Codex findings: 0 · Confirmed: 5 · Refuted: 1 · Uncertain: 0


Models: claude-opus-5 + gpt-5.6-sol · Trigger: manual · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

Comment thread apps/cli/src/legacy/commands/db/shared/legacy-migra.deno-templates.unit.test.ts Outdated
Comment thread apps/cli-go/pkg/migration/queries/list.sql
Comment thread apps/cli/src/legacy/commands/db/shared/legacy-migra.deno-templates.unit.test.ts Outdated
Comment thread apps/cli/src/legacy/commands/db/shared/legacy-migra.deno-templates.unit.test.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ea63d7653

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/legacy/commands/db/shared/legacy-migra.ts
Comment thread apps/cli/src/legacy/commands/db/shared/legacy-migra.deno-templates.unit.test.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c6b011cdca

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/legacy/shared/legacy-drop-objects.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: a3a8b33ca3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@7ttp
7ttp marked this pull request as ready for review August 31, 2026 07:48
@7ttp
7ttp requested a review from a team as a code owner August 31, 2026 07:48
Comment thread apps/cli/src/legacy/commands/db/shared/legacy-migra.ts
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@bd69ac937e6aacab04ecda6680bb0bf761b6463a

Preview package for commit bd69ac9.

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.

db reset --linked silently skips a user schema when its OID collides with another catalog's OID (missing pd.classid)

1 participant