fix(db): restore orphan migration versions for Supabase Preview#952
Conversation
Hosted Preview fails when schema_migrations still records versions that were renamed or renumbered away locally. Add no-op historical placeholders for those orphan versions, plus an offline guard and live history check. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
|
Updates to Preview Branch (cursor/supabase-preview-migration-drift-7850) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a Supabase migration-history alignment check, historical no-op placeholders, validation, live-drift integration, and reconciliation guidance. Separately, PR policy parsing now combines duplicate Markdown sections and recognizes canonical and legacy governance checklist evidence. ChangesMigration history alignment
PR policy section parsing
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant live_drift_job
participant check_migration_history
participant local_migrations
participant Supabase_REST_Data_API
live_drift_job->>check_migration_history: run alignment check
check_migration_history->>local_migrations: read local version prefixes
check_migration_history->>Supabase_REST_Data_API: fetch schema_migrations versions
Supabase_REST_Data_API-->>check_migration_history: return remote versions
check_migration_history-->>live_drift_job: report alignment or fail on remote-only versions
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #3919 (cancelled). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
Unit coverage rejected the six no-op preview-alignment placeholders because duplicate stems must be explicitly allowlisted. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…ew-migration-drift-7850 Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
|
@cursoragent please resolve the failing CI policy check |
|
You need to increase your spend limit or enable usage-based billing to run background agents. Go to Cursor |
|
@code rabbit please resolve the failing CI policy check |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/check-migration-history-alignment.ts`:
- Around line 33-54: Update fetchRemoteVersions to fail closed when the
schema_migrations request is unsuccessful: add a bounded timeout to the fetch
operation, and throw an error containing the HTTP status and bounded response
text instead of warning and returning null. Preserve the successful RemoteRow[]
response path so the check either compares history or clearly fails.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ff331208-94dc-43ad-8f0d-399fbea8f850
📒 Files selected for processing (12)
.github/workflows/live-drift.ymldocs/supabase-migration-reconciliation.mdpackage.jsonscripts/check-migration-history-alignment.tssupabase/migrations/20260713110000_historical_version_placeholder.sqlsupabase/migrations/20260713120000_historical_version_placeholder.sqlsupabase/migrations/20260713121000_historical_version_placeholder.sqlsupabase/migrations/20260713122000_historical_version_placeholder.sqlsupabase/migrations/20260717133000_historical_version_placeholder.sqlsupabase/migrations/20260718223000_historical_version_placeholder.sqltests/migration-history-placeholders.test.tstests/supabase-schema.test.ts
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 1 unresolved review comment. Files modified:
Commit: The changes have been pushed to the Time taken: |
|
@coderabbitai please resolve failing CI policy test |
|
✅ CI fix PR created: Follow
6 failing check(s)
1 file(s) modified
View agent analysis |
Fixed 1 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
@coderabbitai please can you resolve the branch conflicts for me |
|
✅ Merge conflicts resolved successfully! Resolved 1 conflict file(s). Commit: 14 file operation(s)
View agent analysis |
Resolved conflicts in: - PR_POLICY_BODY.md (delete-modify) Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
|
@claude Please can you resolve the failing PR policy CI for me |
|
@coderabbitai please generate a copy and paste message to update and enable this to pass PR policy CI |
|
Tip For best results, initiate chat on the files or code changes.
## Clinical Governance Preflight
- [x] This change does not alter clinical answer generation, clinical decision-support behavior, or source-ranking logic.
- [x] This change does not alter citation requirements, source verification, provenance, or clinical-content governance.
- [x] This change does not alter privacy controls, patient-data handling, authentication, authorization, or document-access behavior.
- [x] Any Supabase service-role credentials used by the migration-history diagnostic remain CI/server-side only and are not exposed to clients.
- [x] This change does not alter the configured Supabase project/target or perform a production database migration.
- [x] The added historical migration files are intentional no-op placeholders (`select 1;`) used only to reconcile Preview migration history; the durable schema/ACL changes already exist in their replacement migrations.
- [x] No SaMD/TGA assessment is required because this change has no clinical decision-support impact.This addresses the failure mode where the unfilled governance marker was expanded into unchecked policy items. |
|
@coderabbitai please generate a copy and paste message to update and enable this to pass PR policy CI |
|
Tip For best results, initiate chat on the files or code changes.
## Clinical Governance Preflight
- [x] This change does not alter clinical answer generation, clinical decision-support behavior, or source-ranking logic.
- [x] This change does not alter citation requirements, source verification, provenance, or clinical-content governance.
- [x] This change does not alter privacy controls, patient-data handling, authentication, authorization, or document-access behavior.
- [x] Any Supabase service-role credentials used by the migration-history diagnostic remain CI/server-side only and are not exposed to clients.
- [x] This change does not alter the configured Supabase project/target or perform a production database migration.
- [x] The added historical migration files are intentional no-op placeholders (`select 1;`) used only to reconcile Preview migration history; the durable schema/ACL changes already exist in their replacement migrations.
- [x] No SaMD/TGA assessment is required because this change has no clinical decision-support impact.This replaces the unfilled marker that was being expanded into unchecked governance items, which caused the PR Policy checks to fail. |
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 95-102: Update the governance sync logic around
collectSatisfiedGovernanceItems to extract the Clinical Governance Preflight
content with the duplicate-aware section(existingBody, "Clinical Governance
Preflight") helper instead of the first-match govMatch regex. Export that helper
if necessary, then pass the combined section content to
collectSatisfiedGovernanceItems so evidence from every duplicate section is
preserved.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b43004af-53bc-43c8-bf90-8944c192b012
📒 Files selected for processing (2)
.github/workflows/ci.ymlscripts/pr-policy.mjs
|
@coderabbitai please resolve the merge conflicts for me |
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
Resolved conflicts in: - scripts/pr-policy.mjs (content) Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
|
@cursoragent Please can you resolve this CI / Static PR checks (pull_request)Failing after 58s |
|
You need to increase your spend limit or enable usage-based billing to run background agents. Go to Cursor |
|
@claude Please resolve the failing CI testing here |
|
@coderabbitai please ensure that all CI testing is passing |
…ation replay (#974) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary
schema_migrationscontains versions that were renamed or removed locally.select 1;) for the missing historical versions while keeping the real schema and ACL changes in the existing replacement migrations.Verification
Risk and rollout
Clinical Governance Preflight
select 1;) used only to reconcile Preview migration history; the durable schema/ACL changes already exist in their replacement migrations.Notes