Skip to content

Commit a5a921b

Browse files
docs(migrations): note that verify:cloud's ledger checks are branch-relative (#541)
The two ledger checks compare cloud against the migrations in the CURRENT checkout, so on a feature branch a migration another in-flight branch has already applied reads as an orphan, and one on this branch not yet applied reads as pending. Neither is drift. Found while confirming #541: PRs #553 (#542) and #554 (#543) had applied 20260726013256, 20260726015858, 20260726100000 and 20260726110000 to cloud, none of which exist on this branch — so verify:cloud run here reports four orphans that are not drift at all. Left as guidance rather than logic. Filtering by "is this stamp on some other branch" would need a remote ref walk and would silently excuse the exact condition the check exists to catch. The orphan detail line now names the possibility and says to re-check on master; the payment-invariant checks are branch-independent and meaningful anywhere. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HPFyHjqzSR6Ku1gyWjeQie
1 parent a6f1532 commit a5a921b

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

docs/MIGRATIONS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ It reads catalog state, not migration text, so it also catches a *later*
8181
migration re-widening something — including a schema dump re-applying the
8282
original `GRANT ALL ON TABLE transactions TO authenticated`.
8383

84+
**Run it from `master`, after merging.** The two ledger checks compare cloud
85+
against the migrations in your *current checkout*. On a feature branch, any
86+
migration another in-flight branch has already applied to cloud shows up as an
87+
orphan, and any migration on your branch not yet applied shows up as pending —
88+
neither is real drift. The payment-invariant checks are branch-independent and
89+
meaningful anywhere.
90+
8491
The token is a [personal access token](https://supabase.com/dashboard/account/tokens).
8592
It uses the Management API over HTTPS rather than a Postgres connection because
8693
port 5432 is blocked on some networks this project is developed from — the same

scripts/lib/verify-cloud-schema-checks.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,20 @@ export function evaluateChecks(facts: CloudFacts): Check[] {
9090

9191
// An orphan stamp is the failure mode that hid #538: it matches no file, so it
9292
// pads the ledger and makes the pending list above untrustworthy.
93+
//
94+
// RUN THIS FROM `master`, AFTER MERGING. Both lists compare the ledger against
95+
// the migrations present on the CURRENT checkout, so on a feature branch every
96+
// migration another in-flight branch has already applied to cloud reads as an
97+
// orphan, and every migration on this branch not yet applied reads as pending.
98+
// Neither is drift. The detail line below says so rather than leaving someone
99+
// to rediscover it and conclude the check is noisy.
93100
add(
94101
'cloud carries no migration stamp that matches no repo file',
95102
orphans.length === 0,
96103
orphans.length
97-
? `orphan stamps (applied ad hoc, not via db push): ${orphans.join(', ')}`
104+
? `orphan stamps (applied ad hoc, not via db push — or applied by an ` +
105+
`in-flight branch this checkout does not have; re-check on master): ` +
106+
orphans.join(', ')
98107
: 'ledger matches repo filenames exactly'
99108
)
100109

0 commit comments

Comments
 (0)