Skip to content

docs(ingestion): work-order for remaining phase-3 concurrency fixes#377

Merged
BigSimmo merged 1 commit into
mainfrom
claude/ingestion-concurrency-followups
Jul 8, 2026
Merged

docs(ingestion): work-order for remaining phase-3 concurrency fixes#377
BigSimmo merged 1 commit into
mainfrom
claude/ingestion-concurrency-followups

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Doc-only. A sequenced, operator-applied work-order for the ingestion-concurrency phase-3 findings that could not be safely landed from a chat session — so the coordinated drift-reconciliation release can execute them. Every fact is read from the live Clinical KB Database catalog (read-only execute_sql; nothing applied to live), and RPC changes are derived from pg_get_functiondef bodies (not the known-drifted schema.sql).

Why these weren't just shipped

What the doc gives the implementer

Per finding: the live-verified facts, an exact live-derived SQL skeleton (expand/contract for the RPC fences), the files touched, deploy ordering, the verify/eval gate, and collision notes vs #369 and the drift backlog. Suggested landing order at the end.

Verification

  • Doc-only; prettier --check clean. No code/schema changed.
  • Live checks captured in the doc (all green today): check:indexing, reindex:health, check:production-readiness, and eval:retrieval:quality 36/36 (content_mrr@10 = 0.924).

Notes

Companion to docs/ingestion-state-machine.md (§6/§8) and docs/scale-readiness-review.md. The live database was only read, never written.

🤖 Generated with Claude Code

…cy fixes

Captures the state-machine findings that could not be safely landed from a chat
session, each grounded in the LIVE catalog (read-only; nothing applied to live)
so the coordinated drift-reconciliation release can execute them drift-free:

- R2 lease fences on complete/fail RPCs (expand/contract, backward-compatible
  p_worker_id default null; DB-first, worker deploy follows)
- R9 batch-status lost update (lock import_batches row before count+update)
- R7 attempt_count clamp / stuck-pending job
- R23 job-existence guard inside cleanup delete predicates
- R17 partial unique index on open ingestion_jobs + reindex-route 409 handling
  (coordinate with drift-backlog item #7)
- R24e remove the phantom ingestion_job_stages.job_id FK from schema.sql
  (live has no such FK; supersedes drift-backlog item #8)
- R5 worker metadata full-replace → scoped jsonb merge (coordinated)
- deep-memory delete-scoping: documented as NOT a small change — document_sections
  UNIQUE(document_id,section_index) + section_id FK make naive scoping a live
  crash risk; needs a section-ownership design (retrieval eval-gated)

Includes exact live-derived RPC skeletons, per-item deploy ordering, verify/eval
gates, and #369/drift-backlog collision notes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@supabase

supabase Bot commented Jul 8, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@BigSimmo
BigSimmo marked this pull request as ready for review July 8, 2026 07:13
@BigSimmo
BigSimmo merged commit 4fc5419 into main Jul 8, 2026
5 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@BigSimmo
BigSimmo deleted the claude/ingestion-concurrency-followups branch July 8, 2026 07:14
@BigSimmo

BigSimmo commented Jul 8, 2026

Copy link
Copy Markdown
Owner Author

Coordination note: PR #380 now implements the RPC-hardening section of this work-order plus R24e, all green (verify + Supabase Preview migration replay + ui-smoke + Gitleaks):

  • R1/R2 lease fences (complete_ingestion_job + fail_or_retry_ingestion_job, optional p_worker_id, deploy-safe) — migration 20260708130000
  • R7 attempt-exhausted retry → terminal failed
  • R9 refresh_import_batch_status row-lock
  • R23 cleanup_abandoned open-job guard before the deletes
  • R24e — drop the ingestion_job_stages.job_id FK (migration 20260708140000), resolving drift backlog item Bump gitleaks/gitleaks-action from 2 to 3 #8 in the evidence-supported direction (live has 253 orphans that would fail VALIDATE; the FK would break the agent). Allowlist entry removed, database-drift-detection.md Bump gitleaks/gitleaks-action from 2 to 3 #8 marked resolved.

So those sections here can be marked done via #380. Still open per this work-order (unchanged): R17 (open-jobs unique index — drift backlog #7, ingestion_jobs index reshape) and deep-memory delete-scoping (would crash — document_sections unique constraint; needs a section-ownership design). Migration apply to live remains an operator step via the linked supabase CLI workflow.

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.

1 participant