Skip to content

Fix Database↔Supabase interface audit findings (#052, #062, schema hygiene, table-facts latency)#1133

Merged
BigSimmo merged 10 commits into
mainfrom
cursor/database-interface-audit-0883
Jul 24, 2026
Merged

Fix Database↔Supabase interface audit findings (#052, #062, schema hygiene, table-facts latency)#1133
BigSimmo merged 10 commits into
mainfrom
cursor/database-interface-audit-0883

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-through on the Database↔Supabase interface audit.

Done

Still operator-gated (#69)

Hosted apply of 20260724120000 / 20260724130000 / 20260724130100 needs SUPABASE_DB_URL or authenticated Supabase MCP. Live profile:retrieval hit Unregistered API key on the injected service-role secret.

RAG impact: no retrieval behaviour change — table-facts migration is byte-identical; P3 changes are EXECUTE grants and cron invoker URL GUC only.

Verification

  • npm run verify:cheap (3265 tests) on remediation head
  • Focused Vitest: tests/supabase-schema.test.ts, tests/drift-detection.test.ts, tests/stranded-queued-recovery.test.ts, tests/reindex-enrichment-lease.test.ts
  • npm run drift:manifest regenerated
  • Verification not run: npm run verify:pr-local full gate after last babysit push (CI covers static/unit/build); verify:ui N/A (no UI change in this PR’s unique diff); live hosted apply / profile:retrieval blocked without DB URL / valid service-role key

Risk and rollout

  • Risk: Low for app paths (recovery paging + lease-scope narrowing). Schema migrations are additive/idempotent grants + byte-identical table-facts rewrite + GUC fallback for cron invoker URL. Hosted apply still operator-gated.
  • Rollback: revert the feature branch / drop forward migrations if needed; app recovery path is opt-in via --include-stranded-queued.
  • Provider or production effects: None in this environment. Hosted migration apply and live profiling remain explicitly operator-gated (Delete .github/workflows/codeql.yml #69).

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains the live Clinical KB project ref pinned by repo checks
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed — N/A (no CDS behavior change; ranking/generation unchanged)

Notes

Codex P2 review threads addressed in 7ea3ccb1. Bugbot ClinicalDashboard safety-findings note is outside this PR’s unique diff vs main.

Open in Web Open in Cursor 

…iene.

Gate full/retry reindex on fresh agent enrichment leases, recover aged
queued-without-job documents, remove the duplicate unscoped query corrector
from schema.sql, and convert table-facts text matching to plpgsql EXECUTE
for per-call custom plans without changing ranking predicates.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cursor[bot], you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 081223ad-bb65-4532-8f58-0ad672832a9f

📥 Commits

Reviewing files that changed from the base of the PR and between 037b480 and 79c5856.

📒 Files selected for processing (19)
  • .cursor/agents/pr-babysit.md
  • docs/branch-review-ledger.md
  • docs/outstanding-issues.md
  • docs/reindex-runbook.md
  • docs/scale-readiness-review.md
  • docs/webhooks.md
  • scripts/recover-ingestion-queue.ts
  • src/app/api/documents/[id]/reindex/route.ts
  • src/app/api/documents/bulk/reindex/route.ts
  • src/lib/ingestion-mutation-safety.ts
  • src/lib/stranded-queued-recovery.ts
  • supabase/drift-manifest.json
  • supabase/migrations/20260724120000_table_facts_plpgsql_execute.sql
  • supabase/migrations/20260724130000_explicit_base_match_rpc_execute_grants.sql
  • supabase/migrations/20260724130100_fix_invoke_ingestion_worker_url_to_guc.sql
  • supabase/schema.sql
  • tests/reindex-enrichment-lease.test.ts
  • tests/stranded-queued-recovery.test.ts
  • tests/supabase-schema.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/database-interface-audit-0883

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Jul 24, 2026

Copy link
Copy Markdown

Updates to Preview Branch (cursor/database-interface-audit-0883) ↗︎

Deployments Status Updated
Database Fri, 24 Jul 2026 06:06:25 UTC
Services Fri, 24 Jul 2026 06:06:25 UTC
APIs Fri, 24 Jul 2026 06:06:25 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Fri, 24 Jul 2026 06:06:27 UTC
Migrations Fri, 24 Jul 2026 06:06:29 UTC
Seeding Fri, 24 Jul 2026 06:06:30 UTC
Edge Functions Fri, 24 Jul 2026 06:06:32 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@BigSimmo

Copy link
Copy Markdown
Owner Author

@cursoragent please resolve branch conflicts here for me

@BigSimmo
BigSimmo marked this pull request as ready for review July 24, 2026 05:35
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

❌ Unable to add follow-up after multiple attempts. The agent may be experiencing issues.

Please try again later or Open in Web to view the status.

Open in Web Open in Cursor 

Learn more about Cursor Agents

@BigSimmo
BigSimmo enabled auto-merge (squash) July 24, 2026 05:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d04ceed4d

ℹ️ 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".

Comment thread src/lib/stranded-queued-recovery.ts Outdated
Comment thread src/app/api/documents/bulk/reindex/route.ts Outdated
cursoragent and others added 9 commits July 24, 2026 05:44
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…UC URL.

Regenerate the full Docker drift-manifest after schema hygiene, make base
match RPC EXECUTE grants explicit, move invoke_ingestion_worker to the
app.ingestion_worker_base_url GUC pattern, and archive #68. Hosted apply
and live table-facts profiling remain operator-gated (#69).

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…ledger.

Keep remote archive of #61 and this branch's #68 closeout plus updated #69
operator follow-up for hosted apply and live table-facts profiling.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…face-audit-0883

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Page past open-job queued rows when recovering stranded uploads, and limit
bulk retry_failed enrichment lease checks to failed documents only. Add a
project pr-babysit subagent for merge-blocker triage.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@BigSimmo
BigSimmo merged commit 3d6954a into main Jul 24, 2026
17 checks passed
@BigSimmo
BigSimmo deleted the cursor/database-interface-audit-0883 branch July 24, 2026 06:15
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.

2 participants