Skip to content

fix(cli): skip the contrib_regression clone on pg-delta shadows - #6920

Merged
avallete merged 3 commits into
developfrom
fix/pg-delta-skip-contrib-regression
Sep 30, 2026
Merged

avallete merged 3 commits into
developfrom
fix/pg-delta-skip-contrib-regression

Conversation

@avallete

Copy link
Copy Markdown
Member

TL;DR

pg-delta shadow databases no longer run CREATE DATABASE contrib_regression TEMPLATE postgres. That clone crashes OrioleDB when the platform baseline contains an enum-indexed OrioleDB table, and the crash takes down the whole shadow. Migra still creates the database, because it uses it as the declarative diff target.

Before

flowchart LR
  shadow["pg-delta shadow"] --> clone["CREATE DATABASE TEMPLATE"]
  clone --> crash["OrioleDB crash"]
Loading

After

flowchart LR
  next["pg-delta shadow"] --> pg["postgres only"]
  migra["migra shadow"] --> clone["contrib_regression"]
Loading

Why

On an OrioleDB image, CREATE DATABASE … TEMPLATE segfaults when the template has an OrioleDB index on an enum column. A fresh Supabase database has one: auth.one_time_tokens_user_id_token_type_key. Shadow setup then fails with a connection error. pg-delta never connects to contrib_regression.

What changed

  • The pg-delta declarative shadow applies the platform baseline and does not clone contrib_regression. A warm cache hit does not connect just to create it.
  • The pg-delta migrations shadow applies migrations on postgres and skips the clone.
  • The migra shadow still creates contrib_regression.

pg-delta never connects to that database. Cloning it with
CREATE DATABASE TEMPLATE crashes OrioleDB when the baseline
has an enum-indexed table.
@avallete
avallete requested a review from a team as a code owner September 30, 2026 16:20

@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.

🤖 AI Review

Both independent reviews completed. Code inspection supports the intended engine split: pg-delta skips contrib_regression, while legacy replay preserves it. Two Claude findings are confirmed as optional polish; the snapshot-ordering documentation finding is refuted. Codex reported no findings. No functional defect identified; tests were inspected but not executed.

Findings

Severity Location Category Sources Claim
⚪ NIT apps/cli/src/command-internal/db-bootstrap/shadow-database.ts:660 api-design claude The new positional boolean makes the next-engine helper call less self-describing.
⚪ NIT apps/cli/src/command-internal/db-bootstrap/shadow-database.ts:464 documentation claude The template helper's comment overgeneralizes that warm shadow-cache hits must still create contrib_regression. The targetUrlOverride comment also omits an explicit legacy-engine qualifier.

Findings outside the diff

  • ⚪ NIT apps/cli/src/command-internal/db-bootstrap/shadow-database.ts:464 — The template helper's comment overgeneralizes that warm shadow-cache hits must still create contrib_regression. The targetUrlOverride comment also omits an explicit legacy-engine qualifier.
Refuted findings (kept for transparency, not posted as review comments)
  • apps/cli/src/command-internal/db-bootstrap/shadow-database.ts:629 (documentation): The snapshotBaseline documentation is stale because it still describes running before the template database and user migrations, although pg-delta now skips the template database.
    Refuted: The shared interface documents ordering, without promising every consumer performs both later steps. Legacy replay still snapshots at line 695 before template creation at 714 and migrations at 716. Next-engine replay passes false at 760, omitting the template while preserving snapshot-before-migrations ordering. Returning after a setup-only snapshot does not contradict that invariant.

Stats

Claude findings: 3 · Codex findings: 0 · Confirmed: 2 · Refuted: 1 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run

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

Comment thread apps/cli/src/command-internal/db-bootstrap/shadow-database.ts Outdated

@jgoux jgoux 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.

The shadow changes look correct. pg-delta shadows only use postgres, and the contrib_regression override is still limited to the legacy/migra path. One formatting issue in the test file fails the code-quality check and needs fixing before merge.

Comment thread apps/cli/src/command-internal/db-bootstrap/shadow-database.unit.test.ts Outdated
@jgoux
jgoux self-requested a review September 30, 2026 16:37
The pg-delta caller passes createTemplateDatabase: false instead of a
bare boolean, and oxfmt accepts the shortened test title.
@avallete
avallete added this pull request to the merge queue Sep 30, 2026
Merged via the queue into develop with commit 3704383 Sep 30, 2026
39 checks passed
@avallete
avallete deleted the fix/pg-delta-skip-contrib-regression branch September 30, 2026 16:52
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