Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
830a74a
fix(rag): keep reviewed-out table rows and superseded titles out of r…
claude Oct 25, 2026
9fbba65
fix(rag): honest review fallback, keep policy headings, split unpunct…
claude Oct 25, 2026
7277a0f
fix(chunking): repeat a short table note on every piece of a split ta…
claude Oct 25, 2026
fca0330
fix(worker): no label carry-down into a left-spanned cell, no table t…
claude Oct 25, 2026
99670e4
fix(rag): signed guidance-difference notes survive a re-index by pass…
claude Oct 25, 2026
4f05391
fix(extractor): refuse a raster comparison that dropped a decimal poi…
claude Oct 25, 2026
b3609aa
fix(ingestion): admin jobs panel lists and retries shared library job…
claude Oct 25, 2026
376238b
fix(worker): record image-table reader and maths-helper use in extrac…
claude Oct 25, 2026
19462fc
fix(reindex): rollback picks candidates from documents and warns abou…
claude Oct 25, 2026
a430730
fix(clinical-ask): keep sources and context out of the system message…
claude Oct 25, 2026
58e1a33
feat(ingestion): watch extraction quality on a schedule; after-canary…
claude Oct 25, 2026
4d85564
feat(medications): stamp each imported snapshot with its upstream ver…
claude Oct 25, 2026
11b2c41
feat(governance): offline report of searchable documents missing lice…
claude Oct 25, 2026
67b93bb
fix(ingestion): sweep leftover images on delete, refresh caches after…
claude Oct 25, 2026
1e926b9
feat(db): rollback to pre-cutover pages, keep summaries and labels, l…
claude Oct 25, 2026
9f7b5c0
fix(scripts): use the narrow cache client for the shared cache delete
claude Oct 25, 2026
1c9dd60
docs(decisions): record that a licence withdrawal takes a document ou…
claude Oct 25, 2026
054b8ae
test(ingestion): route coverage expects the shared-library job filter…
claude Oct 25, 2026
4e70ee6
fix(reindex): page viewer follows the document's page mode, so a roll…
claude Oct 25, 2026
43198ee
chore(docs): refresh generated snapshots after rebasing onto main
claude Oct 25, 2026
64c5cfe
refactor(rag): move candidate metadata query expansion into its own m…
claude Oct 25, 2026
b603948
docs(rag): move threat-model line anchors into rag.ts after the modul…
claude Oct 25, 2026
4ad70c1
fix(db): renumber the follow-up migrations after #3789's so the two d…
claude Oct 26, 2026
31ef787
Merge main (#3789, #3793) into the RAG follow-up
claude Oct 26, 2026
7f321b8
fix: keep a one-page document's heading and only record a real Medica…
claude Oct 26, 2026
2116cae
fix(worker): name the startup step in the fatal log
claude Oct 26, 2026
09dc3d0
fix: address CodeRabbit review on #3790
claude Oct 26, 2026
dc111dc
fix(backfill): clear shared answer cache even when the revision bump …
claude Oct 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/outstanding-issues-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "outstanding-issues-snapshot-v2",
"ledger_revision": {
"committed_at": "2026-10-22"
"committed_at": "2026-10-23"
},
"counts": {
"open": 94,
Expand Down
5 changes: 5 additions & 0 deletions data/repo-awareness-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -5326,6 +5326,11 @@
"section": "decisions",
"catalogued": true
},
{
"path": "docs/decisions/2026-10-25-licence-withdrawal-leaves-answers.md",
"section": "decisions",
"catalogued": true
},
{
"path": "docs/source-acquisition-protocol.md",
"section": "root",
Expand Down
4 changes: 2 additions & 2 deletions docs/audit/tenancy-defense-in-depth-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ guard until it is reviewed. Entries live in `DERIVED_QUERY_INVENTORY` in
| `src/app/api/eval-cases/route.ts` | `document_chunks` | `ownedChunkReference` | reviewed-indirect | Read-then-verify: selects only `id,document_id`, then calls `ownedDocumentId` on the returned `document_id` and returns null unless it belongs to the requester. |
| `src/app/api/images/[id]/signed-url/route.ts` | `document_images` | `GET` | parent-document-verified | Image row fetched by id, then its parent document resolved through `withOwnerReadScope`; 404 and nothing signed unless the parent is visible. |
| `src/app/api/images/signed-urls/route.ts` | `document_images` | `POST` | parent-document-verified | Batch form of the same pattern (`/api/documents/images/batch` is a bare re-export of this module); only images whose parent survived `withOwnerReadScope` are signed. |
| `src/app/api/ingestion/jobs/route.ts` | `ingestion_jobs` | `GET` (×2) | documents-inner-join | Page query and active-count query both join `documents!inner` and filter `.eq("documents.owner_id", user.id)` on the chain itself. |
| `src/app/api/ingestion/jobs/[id]/retry/route.ts` | `ingestion_jobs` | `POST` (×2) | documents-inner-join | Pre-recovery state read and post-recovery re-read both join `documents!inner` and filter `.eq("documents.owner_id", user.id)` on the chain. |
| `src/app/api/ingestion/jobs/route.ts` | `ingestion_jobs` | `GET` (×3) | reviewed-indirect | Administrator-only. All three chains join `documents!inner` and allow the administrator's own documents or shared public-library documents (`owner_id.eq.<user>,owner_id.is.null`); widened 2026-10-25 (ING-S-N7). |
| `src/app/api/ingestion/jobs/[id]/retry/route.ts` | `ingestion_jobs` | `POST` (×2) | reviewed-indirect | Administrator-only. Both reads join `documents!inner` and allow the administrator's own document or a shared public-library document; the handler re-checks the joined owner before recovery. Widened 2026-10-25 (ING-S-N7). |
| `src/app/api/ingestion/quality/route.ts` | `ingestion_jobs` | `GET` | owner-scoped-id-list (`documentIds`) | `.in("document_id", documentIds)` from the handler's `.eq("owner_id", user.id)` documents query. |
| `src/app/api/ingestion/quality/route.ts` | `ingestion_job_stages` | `GET` | owner-scoped-id-list (`documentIds`) | Same owner-scoped id list. |
| `src/app/api/ingestion/quality/route.ts` | `document_pages` | `GET` | owner-scoped-id-list (`documentIds`) | Same owner-scoped id list. This one reads page `text`, so it is the highest-value derived read in the handler. |
Expand Down
9 changes: 5 additions & 4 deletions docs/branch-review-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Retention and rotation: [`branch-review-archival-policy.md`](branch-review-archi

## Summary

- Records: 744
- Distinct ref cells: 472
- Distinct reviewed heads: 724
- Records: 745
- Distinct ref cells: 473
- Distinct reviewed heads: 725
- Date range: `2026-08-12` to `2026-10-20`

Records per date, newest first:

- `2026-10-20` — 1 record
- `2026-10-20` — 2 records
- `2026-10-19` — 3 records
- `2026-10-18` — 22 records
- `2026-10-17` — 12 records
Expand Down Expand Up @@ -82,6 +82,7 @@ Scope and outcome are truncated; follow the record link for the full six-cell ro

| Date | Ref | Scope | Outcome | Record |
| --- | --- | --- | --- | --- |
| 2026-10-20 | fix/worker-native-followup-20261020 | worker-native-followup-and-readonly-smoke-20261020 | One fresh blind six-file review at9cb07a099 found P2 shutdown proof de… | [59336213](archive/branch-review-records/59336213f8c15585d1bb9596b4389107079c13d026a9c3c320cfe94ffce54358.record.md) |
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
| 2026-10-20 | fix/worker-native-security-20261020 | worker-native-security-runtime-and-NLTK-20261020 | Fresh blind eight-file security review: no actionable P0/P1/P2 defect;… | [f6299d27](archive/branch-review-records/f6299d27ad0b6e6b675601dfa15f869fe14a110e0be9db55e648383633e3666a.record.md) |
| 2026-10-19 | fix/worker-security-remediation-20261019 | worker Perl security remediation current diff | No actionable findings in independent read-only candidate review; seve… | [95fe94b8](archive/branch-review-records/95fe94b84bcddf1ff28cb46b67666a8b1e8295bcb7927b73e70fa4d813b89937.record.md) |
| 2026-10-19 | PR #3674 fix/audit-rag-complete-20261019 | working-tree OCR fallback correction fe6a983590b5 / 9d61e5fcde85 | Independent source review clear; transient fallback corrected with 10s… | [c53fa60f](archive/branch-review-records/c53fa60f9b3cd8979ef1e2da2e3f3830b5a6ef64c75aca71925a5b2218214fd6.record.md) |
Expand Down
12 changes: 12 additions & 0 deletions docs/decisions/2026-10-25-licence-withdrawal-leaves-answers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Decision: A document whose licence stops permitting indexing leaves answers at once

- **Status:** decided 2026-10-25
- **Source:** `supabase/migrations/20261025171000_label_cache_revision_licence_withdrawal.sql`, find "it is now marked outdated in the same update"

The owner approved every remaining recommendation of the 24 Oct 2026 search and ingestion
re-audit, including audit E2E-10. When a document's licence changes to one that forbids indexing
its text, the database marks the document outdated in the same update, so the existing answer
filter stops using it. Nothing is deleted, and changing the licence back does not restore the old
status by itself. The migration merges only after the owner's own yes to that database change.

If this summary and the source ever differ, the source wins.
13 changes: 8 additions & 5 deletions docs/ingestion-state-machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ it is the July 2026 analysis, kept as history._
[reindex-runbook.md](reindex-runbook.md#recovery-transaction-merged-18-october-2026).
9. **Admin Retry, rollback and last attempts (added 24 Oct 2026).**
- The admin Retry button (`src/app/api/ingestion/jobs/[id]/retry/route.ts`) also goes through
`recover_ingestion_job`. It lists and retries only the administrator's own documents' jobs, so
jobs for owner-less public-library documents do not appear there yet (audit ING-S-N7; widening it
needs a tenancy-review entry, see docs/audit/tenancy-defense-in-depth-review.md §6).
`recover_ingestion_job`. It lists and retries the administrator's own documents' jobs and the
jobs of owner-less shared-library documents (audit ING-S-N7, reviewed in
docs/audit/tenancy-defense-in-depth-review.md §6).
- `scripts/reindex-rollback.ts` moves a document back to its previous generation and stamps
`index_generation_rolled_back_from` and `index_generation_rolled_back_at` in its metadata. The next
commit does not yet clear those markers; a database fix is drafted separately. See
`index_generation_rolled_back_from` and `index_generation_rolled_back_at` in its metadata.
Migration `20261025170000` (drafted 25 Oct 2026, merges only after the owner's own yes) makes
the next commit clear those markers, lets a rollback return to a generation committed before
13 Oct 2026 (unstamped pages), restores the summary and generated labels it kept, and refuses
while the background enrichment queue has work for the document. See
[reindex-runbook.md](reindex-runbook.md#rolling-back-a-reindex).
- A job that fails on its last attempt (`attempt_count` has reached `max_attempts`) is not retried
(`ingestionFailureDecision` in `worker/behavior.ts`). The job ends `failed`; during a re-index the
Expand Down
3 changes: 3 additions & 0 deletions docs/organisation/systems/clinical-content.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"scripts/seed-differential-records.ts",
"scripts/seed-medication-records.ts",
"scripts/seed-registry-records.ts",
"scripts/source-provenance-gaps.ts",
"scripts/sql/operator-export-site-content-population.sql",
"scripts/sync-site-content-corpus.ts",
"scripts/watch-source-changes.ts",
Expand Down Expand Up @@ -210,6 +211,7 @@
"src/lib/site-content/**",
"src/lib/source-governance.ts",
"src/lib/source-metadata.ts",
"src/lib/source-provenance-gaps.ts",
"src/lib/source-review.ts",
"src/lib/sources/**",
"src/lib/specifier-builder-diagnoses.ts",
Expand Down Expand Up @@ -295,6 +297,7 @@
"tests/source-*",
"tests/source-metadata-browser-safety.test.ts",
"tests/source-metadata.test.ts",
"tests/source-provenance-gaps.test.ts",
"tests/specifier-*",
"tests/specifiers-*",
"tests/specifiers.test.ts",
Expand Down
2 changes: 2 additions & 0 deletions docs/organisation/systems/source-intake.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"src/lib/embedding-dimensions.ts",
"src/lib/embedding-input-budget.ts",
"src/lib/enrichment-repair.ts",
"src/lib/extraction-quality-watch.ts",
"src/lib/extractors/**",
"src/lib/image-filtering.ts",
"src/lib/index-quality.ts",
Expand Down Expand Up @@ -155,6 +156,7 @@
"tests/enrich-documents-guards.test.ts",
"tests/enrichment-repair.test.ts",
"tests/extracted-document-validation.test.ts",
"tests/extraction-quality-watch.test.ts",
"tests/fixtures/ingestion/active-corpus-inventory.json",
"tests/formatting-fixture-audit.test.ts",
"tests/image-filtering.test.ts",
Expand Down
7 changes: 7 additions & 0 deletions docs/rag-behaviour/cache-freshness.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ statuses, so decommissioning, loss of access and membership changes cannot disap
behind an unrelated latest indexed document. Full metadata inclusion conservatively
invalidates caches after unrelated document updates.

Each document's hash also carries its evidence counter (`document_evidence_revisions`), which
table-fact and image edits bump. Migration `20261025171000_label_cache_revision_licence_withdrawal.sql`
(drafted 25 Oct 2026, merges only after the owner's own yes) adds label inserts, real updates
and deletes to that counter (audit E2E-11), so a label edit reaches every app copy, not only the
one that handled it. The `backfill:text-normalization` script bumps the counter for every document
whose chunk text it rewrites and clears the shared answer and search cache.

The candidate snapshot namespaces and public-write proofs remain required. Anonymous
answer caching, `skipCache`, original-section loaders, active pilot budgets, trusted
reviewed-policy loaders/states and conflicts retain their existing exclusions. The
Expand Down
Loading
Loading