docs(db): re-measure staging drift at current main after the snapshot v2 migration (#056) - #2104
Conversation
… v2 migration (#56) Phase 2 measured check:drift against staging at base ed43a64 and recorded 19 findings. main has since gained 20260818090000_schema_drift_snapshot_history_probe.sql (PR #2058), which redefines schema_drift_snapshot() itself and ships a regenerated schema.sql, drift-manifest.json, and five migration_history allowlist entries — so those numbers were measured with a v1 probe against an older manifest. Re-measured in a second owner-authorized staging window (Clinical KB Staging, ikoiolksxqxfxgiyqpnu; production sjrfecxgysukkwxsowpy was never a target). Measurement only: no drift finding was fixed and no vault secret was seeded. - Before-gap was exactly one version. Staging held 194 rows against 195 repository files; the only missing version was 20260818090000, which is not one of the duplicate earlier/later pairs of Phase 2 finding 2. - Applied by the Phase 2 method — execute_sql of the file content verbatim plus an explicit history row carrying the repository's own version and name, never apply_migration, which stamps connector-generated versions. Read back byte-identical (md5 839bed0b741cb75b79f6eb0c46ed0a50, 9034 bytes). Staging now holds 195 rows, latest 20260818090000, zero statements IS NULL, empty two-way diff, documents and document_chunks still 0. - check:drift against staging with the current manifest exits 1 with the same 19 findings — same categories, same keys, same manifest/live hash pairs. - Two new observations, neither a drift finding: the snapshot v2 migration_history block reports probe 'ok' with zero rows, contributing 0 findings; and five migration_history allowlist entries report stale because those history-repair rows are production's, so --prune-stale must not be run against staging. - schema_drift_snapshot itself is absent from the function mismatches, confirming PR #2058's migration body and its schema.sql mirror agree. Evidence: docs/audit/live-drift-forensics-2026-08.md section 2.5. The #56 update rides the inbox; #316 was not touched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in:9 minutes Limit details: You’ve used all 1 included review currently available under your plan. You completed 101 included PR reviews in the past 7 days; at that activity level, included reviews refill at 1 review per hour. Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Comment |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
Summary
Documentation and evidence only. Re-measures
check:driftagainst the staging Supabase tier now thatmaincarries the migration that redefinesschema_drift_snapshot()itself, and records the result as a dated subsection of the Phase 2 forensics.docs/audit/live-drift-forensics-2026-08.md§ 2.5 — "Re-measure against currentmain". Phase 2 (Replay the migration chain onto staging to parity, and record that the chain does not reproduce schema.sql (Phase 2, #056) #2093) measured 19 drift findings at baseed43a64f2. Since then exactly one commit touchedsupabase/:9c660af1f(PR feat(db): migration-history probe, guard-migration contract, and index-monitoring ratchet (remediation Phase 6) #2058, Phase 6), which added20260818090000_schema_drift_snapshot_history_probe.sqlplus a regeneratedschema.sql, a regenerateddrift-manifest.json, and fivemigration_historyallowlist entries. Those 19 were therefore measured with a snapshot v1 probe against an older manifest, which is why the number needed re-taking rather than re-quoting.docs/outstanding-issues-inbox/5ed2f873-….json— the queued#056update carrying the re-measured count. It is an immutable inbox request;docs/outstanding-issues.mdis untouched and one serializednpm run issues:reconcilewill apply it after this lands.What was done in the staging window
Owner-authorized staging window, target
Clinical KB Staging(ikoiolksxqxfxgiyqpnu), via the Supabase MCP connector. Productionsjrfecxgysukkwxsowpywas never a target: the ref was passed explicitly on every call andlist_projectswas the only call that named production at all. Measurement only — no drift finding was fixed, and no vault secret was seeded into staging.supabase_migrations.schema_migrationsagainst 195 repository migration files; the two-way diff named20260818090000and nothing else. It is not one of the duplicate earlier/later pairs of § 2.4 finding 2 — all eight of those remain present from the Phase 2 replay — so the stop-and-report condition for applying an older body over a newer one did not arise.execute_sqlran the repository file's content verbatim, then a secondexecute_sqlwrote an explicit history row carrying the repository's own version and name.apply_migrationwas not used: it stamps a connector-generated version, whichdocs/staging-setup.mdforbids. Read back byte-identical —md5 839bed0b741cb75b79f6eb0c46ed0a50, 9034 bytes, matchingmd5sumof the file. Staging now holds 195 rows, latest20260818090000, zerostatements IS NULL, an empty two-way diff, anddocuments/document_chunksstill0.check:driftagainst staging, current manifest. Exit code 1, complete output pasted into § 2.5.Result: still 19, and the composition is unchanged
All 19 findings persist with the same categories, keys, and manifest/live hash pairs, even though the manifest moved underneath them (
2026-08-17T16:38:39.818Z/a6fb923400f8…against § 2.3's2026-08-16T14:37:41.042Z/365e3368a47b…): 7match_*SET work_memdef_hashmismatches, 8 objects onlyschema.sqldeclares, 3 table column-set mismatches, 1document_chunks_content_trgm_idxdefinition mismatch. Nothing new appeared and nothing changed category. Staging still carrieswork_memon 7match_*functions rather than 8, re-confirming § 2.4 finding 3 on the current chain.Two observations are new to this run, and neither is a drift finding:
migration_historyblock is live and clean. The probe reportsokand returns zero rows, so the new category contributes 0 findings — the expected result for an environment built by a faithful chain replay. It is evidence the probe runs end-to-end against a real database, not evidence that production is clean; production has not been measured with v2.migration_historyallowlist entries report stale.20260701010000,20260701020000,20260701030000,20260701060000and20260702000000(allguard.class superseded, added by PR feat(db): migration-history probe, guard-migration contract, and index-monitoring ratchet (remediation Phase 6) #2058) match nothing on staging because those history-repair rows are production's. This is a warning, not a failure — the run still exits 1 solely on the 19 — and § 2.5 records thatcheck:drift --prune-stalemust not be run against staging, because it would delete allowlist entries that exist for production.One positive confirmation:
schema_drift_snapshotitself does not appear among the function mismatches. Before this window it could not — staging carried v1 while the manifest carried v2 — so its absence is direct evidence that PR #2058's migration body and theschema.sqlmirror regenerated from it agree.The § 2.3 conclusion is unchanged and is repeated in § 2.5:
check:driftbuilds its expected side fromsupabase/schema.sqlrather than from the migration chain, and a complete, byte-verified chain still disagrees with it in 19 places. Every disposition remains repo-side work for Phase 3.Testing
npm run verify:pr-local -- --files docs/audit/live-drift-forensics-2026-08.md,docs/outstanding-issues-inbox/5ed2f873-e23b-4504-ad7b-8afb0ae39889.jsonselected the recognised low-risk documentation route and completed all eleven checks:Decisive lines from the ledger guards, which are the gates that matter for an inbox request:
npm run docs:check-links—docs link check passed: 1881 repo path references resolve.npm run formatwas run repo-wide and committed;prettier --checkon both changed files reportsAll matched files use Prettier code style!.Lint, typecheck, the unit suite, RAG fixture scan, build, and browser gates were not run: the changed paths are documentation and an immutable ledger request, which
verify:pr-localclassifies as recognised low-risk scope with no build-affecting or executable product changes.classifyPullRequestFilesreturnsclinicalRisk: false,operationalRisk: false,ragRanking: falsefor both paths.No provider-backed gate was run. The only hosted access was the authorized staging window described above.