Skip to content

ci(supabase): name the known cause when the drift audit exits non-zero - #573

Merged
thinkclay merged 1 commit into
mainfrom
claude/drift-msg
Aug 12, 2026
Merged

thinkclay merged 1 commit into
mainfrom
claude/drift-msg

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Follow-up to the drift-audit change in #571, from actually running it.

What the probe showed

I opened a throwaway migrations-only PR (#572) to verify the new pull_request trigger fires rather than assume it. It does:

env result
preview pass
prod pass
dev fail

Dev's failure is correct and specific:

Found local migration files to be inserted before the last migration on remote database.
supabase/migrations/337_notification_cron_vault.sql

337 was deliberately skipped (it schedules cron jobs against two Vault secrets that do not exist on dev — #564) while 338–345 were applied. That makes it permanently out of order, which is a genuine drift condition, not noise.

The change

The CLI exits 1 on real drift as well as on infrastructure failures, and the exit-code guard runs before the pattern checks below it — so this condition was being reported as a generic "investigate before assuming sync". It now names the cause and points at #564.

Consequence worth knowing

Every migration PR will show a red drift-audit (dev) until 337 is applied. That is accurate signal rather than a bug, and softening it would repeat the mistake this whole epic has been about — a check that reports green while something is wrong. But it is a real cost, and resolving #564 (two Vault secrets on dev, a one-time human action) clears it.

The pull_request nuance added in #571 — treating "Would push these migrations" as a notice rather than a failure, since a PR adding a migration is supposed to be unapplied — is not reachable on dev while this out-of-order condition exists. It will start applying once 337 is resolved.

The CLI exits 1 on real drift as well as on infrastructure failures, and the
exit-code guard runs before the pattern checks — so every out-of-order drift
was reported as a generic 'investigate before assuming sync'.

Verified on a probe PR (#572): dev fails with 'Found local migration files to
be inserted before the last migration', because 337 was skipped while 338-345
were applied. That is accurate signal, and it will keep every migration PR red
on dev until 337 is applied — which is blocked on the two Vault secrets in
#564. The message now says exactly that instead of sending the reader looking.
@thinkclay
thinkclay merged commit 63a6900 into main Aug 12, 2026
7 checks passed
@thinkclay
thinkclay deleted the claude/drift-msg branch August 12, 2026 00:01
thinkclay added a commit that referenced this pull request Sep 10, 2026
… one failing (#726)

#573 added a message so an out-of-order drift failure names the known cause
instead of sending everyone to "investigate". It hardcodes one:

    On dev this is currently 337_notification_cron_vault.sql, which cannot be
    applied until the two Vault secrets exist (see issue #564).

That text prints for every environment in the matrix. Prod and preview are
currently failing on 348, 349 and 350 — none of them 337, none of them related
to Vault secrets — and both are told to go read #564. A message that names the
wrong migration is worse than "investigate", because it looks authoritative.

Parse the pending list out of the CLI output and name what this environment is
actually missing. The #564 hint is kept, but only when 337 is genuinely among
them.

Verified against both real outputs from the current run:

  prod -> "...: 348_role_assignments_unique_nulls_not_distinct.sql
           349_content_reports_and_user_blocks.sql
           350_move_user_feedback_to_core.sql."   (no #564 hint)

  dev  -> "...: 337_notification_cron_vault.sql 348_...sql. 337_... cannot be
           applied until the two Vault secrets exist — see #564."

Also drops "Resolve that rather than re-running", which described 337
specifically, for the general truth: these sort before the last applied version
and will never be picked up without a deliberate --include-all push.

Co-authored-by: Claude Opus 5 <[email protected]>
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.

1 participant