Repository navigation
Database: record the three managed-ingestion migrations already applied to live - #3551
Conversation
…ed to live Live production applied 20261013075944, 20261013144347 and 20261013200007 from the unmerged ingestion branch (PR 3546) on 2026-10-13. Because main did not have them, the Supabase integration could not apply PR 3538's four migrations (20261013140000 to 20261013170000) and the post-merge live-drift check has failed since 2026-10-14 (issue 3542). This brings exactly the database half of PR 3546 onto main, byte for byte: the three applied migrations, their validation-only guard 20261014164220, the matching schema.sql and drift manifest, their sealed hashes and the -text attributes that keep their bytes intact. No application, worker or edge-function code changes. The new manifest's function hashes match the live hashes the failed live-drift run reported. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuYbdEGXeMntVA9KMgtAEx
…, match the owner-delete test - schema.sql now uses LF like every other copy, so the byte-identical parity tests pass. The drift manifest hash is unchanged because check:drift strips CR before hashing. - docs/codebase-index.md names document_admission_events. - tests/supabase-schema.test.ts takes the anchored owner_id regex from the managed-ingestion branch so the admission events table is checked correctly. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuYbdEGXeMntVA9KMgtAEx
schema.sql now holds both complete_ingestion_job overloads: the unfenced one main's worker calls, and the fenced jsonb one already applied to live. The test now anchors on the unfenced signature so it checks the function this worker actually calls. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuYbdEGXeMntVA9KMgtAEx
|
Warning Review limit reachedYour organization has reached its usage spending cap. Adjust your spending cap in the billing tab. Next included review available in 39 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: 🔵 Low · up to
|
|
Updates to Preview Branch (claude/project-thread-sr3mdk) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
…line The CRLF to LF rewrite of supabase/schema.sql makes gitleaks rescan an unchanged seed-data line, where medication labels read as generic API keys. No credential. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuYbdEGXeMntVA9KMgtAEx
There was a problem hiding this comment.
BigSimmo has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude encountered an error after 2s —— View job I'll analyze this and get back to you. |
PR Summary by QodoReconcile managed-ingestion migration history with live
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
|
Status of the failing checks on 70ba925:
Generated by Claude Code |
Code Review by Qodo
1. Guard misses changed string literals
|
🏁 CodeAnt Quality Gate ResultsCommit: ✅ Overall Status: PASSEDQuality Gate Details
|
Owner approved the reseal on 2026-10-15. Both hashes were first sealed in this PR, not on main. 20261013075944 is wrapped in begin/commit (how live applied it) plus one grant live already holds. The guard 20261014164220 is not yet on live. Neither edit changes the live database. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuYbdEGXeMntVA9KMgtAEx
…to claude/project-thread-sr3mdk
…y check Keeps the review bot's added migration-history step and runs every command against the same linked production project. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuYbdEGXeMntVA9KMgtAEx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb71e2b385
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
BigSimmo has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Code review by qodo was updated up to the latest commit 2314530 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23145308b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Qodo Fixer✅ Merged (0) · ☑ Fixed (0) Process
|
There was a problem hiding this comment.
BigSimmo has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Code review by qodo was updated up to the latest commit c25d36b |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c25d36b04b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Generated by Claude Code |
Code Review ✅ Approved 6 closed / 6 findings🔴 High risk · These Supabase migrations reconcile live managed-ingestion state and trigger pending schema and RLS changes, which could disrupt production data access or processing. Records three already-live managed-ingestion migrations on main, with a validation-only guard migration, so migration history matches the live database. Two replay-only edits were resealed with owner approval and change nothing on live. No open findings remain; the resolved items cover the resealed migration hashes and the ✅ 6 closed✅ Bug: Edited migrations no longer match sealed hashes; immutability check fails
✅ Bug: #3538's migrations sort before live's new tip; db push may refuse them
Closed: Security: Recreated SECURITY DEFINER repair function loses its revoke/grant ACL
Closed: Bug: Recheck marks managed-owned and out-of-batch documents good
Closed: Bug: Drift manifest/schema.sql not updated for the new function pair
...and 1 more closed from earlier reviews VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Approved For more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 6 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
|
Code review by qodo was updated up to the latest commit 8d05152 |
User description
Requested by Josh · project thread
Summary
Before: the live database is out of step with main. On 13 October three migrations from draft PR #3546 were applied to live straight from a session, before review or commit. Because live now has migrations main does not know about, the four migrations that came with #3538 (20261013140000 to 20261013170000) never applied, the post-merge live drift check has failed since 14 October (issue #3542), and the registrar assessment tables and the force row level security changes from #3538 are missing on live.
After: main records the three migrations as they already exist on live, from the #3546 branch, plus #3546's validation-only guard migration. Two files carry small replay-only edits, described below, that change nothing on live. The schema snapshot, drift manifest and applied-migration hashes match live. When this merges, the Supabase integration has only #3538's four migrations and the guard left to apply, and the live drift check should go green, provided the integration accepts their order (see the open question under Risk).
This is the "keep and fix" option the owner chose on 2026-10-15. Nothing that is already live is changed or reversed. The rest of #3546 (the worker and app code for administrator document intake) is not in this PR and stays in draft for its own review.
Migration history edit approved: these three migrations are already applied to the live database on 2026-10-13, and this records them on main so history matches live. Guard migration 20261014164220 validates the applied objects and builds nothing.
Areas touched: Data platform and access, Delivery and assurance, Knowledge and records
What is in it
20261013144347_managed_generation_quality_repair_ownership.sqland20261013200007_managed_native_pdf_terminal_append.sql: unchanged copies of the Reconcile admin ingestion, native PDF extraction and grounded Answer #3546 files, which are the versions live recorded.20261013075944_administrator_txt_fenced_runtime_cutover.sql: the Reconcile admin ingestion, native PDF extraction and grounded Answer #3546 body, wrapped inbegin;/commit;. Live applied it inside one external transaction. A fresh chain (CI Migration replay, Supabase Preview) runs each file outside a transaction, whereLOCK TABLEfails with SQLSTATE 25P01. It also adds onegrant all on table public.document_strict_gate_status to service_role, which live already holds and the body's preimage check pins. On live it is a no-op.20261014164220_validate_managed_ingestion_historical_reconciliation.sql: Reconcile admin ingestion, native PDF extraction and grounded Answer #3546's fail-fast guard. It checks the objects exist and raises an exception if not. It never builds anything. It now runs in a transaction soset localapplies, and it no longer pins rawsource_md5body bytes. Live stores some bodies with CRLF line endings, so a byte pin can never pass a fresh replay. Every body is still pinned bydefinition_md5.applied-migration-hashes.jsonwith the owner's approval on 2026-10-15. Their hashes were first sealed in this PR, not on main.supabase/schema.sql,supabase/drift-manifest.json,supabase/applied-migration-hashes.json,.gitattributes: taken from Reconcile admin ingestion, native PDF extraction and grounded Answer #3546, then schema.sql stored with LF endings so the byte-identical parity tests pass. The drift check strips CR before hashing, so the manifest hash is unchanged.tests/supabase-schema.test.ts: Reconcile admin ingestion, native PDF extraction and grounded Answer #3546's anchored owner_id regex, so the new admission events table is checked correctly.docs/codebase-index.md: namesdocument_admission_events.tests/worker-lease-transition-contract.test.ts: anchors on the unfencedcomplete_ingestion_joboverload that main's worker calls.docs/audit/live-drift-forensics-2026-08.md: a post-merge runbook for the case where the integration refuses the out-of-order versions.Verification
supabase migration up, Postgres 17.6) applies cleanly. After it,check:drift-manifest-freshnessreports "supabase/drift-manifest.json matches a fresh regeneration." andcheck:chain-mirror-parity --strictreports "No divergence between the migration chain and supabase/schema.sql." The Supabase Preview branch also applied the migrations on fb71e2b.npm run check:migration-role,check:migration-immutability(309 files) andcheck:function-grants: pass.npm run verify:pr-local(heavy scope): every static check,lintandtypecheckcompleted.test:Tests 3 failed | 29876 passed | 5 skipped. One failure was real and is fixed in the third commit (the worker transition test now anchors on the unfencedcomplete_ingestion_joboverload, since schema.sql holds both). After the fix that file andtests/supabase-schema.test.tspass, 177 of 177. The other two are intests/test-runner-safety.test.tsand come from this container's Playwright browser cache (expects chromium-1243, but /opt/pw-browsers only has: chromium-1194), the same as on CI: remove the never-working CodSpeed check and make CodeRabbit advisory #3549.check:rag:fixtures,check:medication-interactions,check:medication-lexicon-report: pass.Risk and rollout
supabase/migrations/**, so merging applies to the live clinical database within seconds. The three recorded migrations are already live and should not re-run. What will run is feat(audit): comprehensive repository audit remediation and frontend hardening #3538's four migrations and the guard.--include-all(LegacyDbPushMissingRemoteError, seedocs/audit/live-drift-forensics-2026-08.mdaround line 1640), and it is not known whether the GitHub integration passes that flag. If it refuses, the CLI aborts before running any statement, so live stays exactly as it is today and live drift stays red. The recovery then is the documented operator route:supabase db push --linked --include-all --dry-runmust list exactly the five pending files (the four from feat(audit): comprehensive repository audit remediation and frontend hardening #3538, then guard 20261014164220), followed by the real push with the owner's yes. Renaming feat(audit): comprehensive repository audit remediation and frontend hardening #3538's four files instead would rewrite history already on main, so it is not done here.check:driftandcheck:migration-historygreen, then issue Live drift check failing #3542 can close.RAG impact: no retrieval behaviour change. No ranking or retrieval code is changed, and the retrieval functions are recorded as they already are on live.
Notes
20261014170000_recheck_managed_quality_after_repair.sql) to this branch. It was unapproved and Gitar found an ACL gap in it, so it was removed in fb71e2b. Qodo's snapshot finding against the liverepair_enrichment_quality_batchstays open for its own reviewed forward migration.🤖 Generated with Claude Code
https://claude.ai/code/session_01LuYbdEGXeMntVA9KMgtAEx
Summary by CodeRabbit
CodeAnt-AI Description
Align production migration history with administrator document indexing
What Changed
Impact
✅ Fewer database releases blocked by migration-history drift✅ Administrator text indexed against its uploaded source✅ PDF table captures remain private💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.