diff --git a/docs/branch-review-records/5ecfa15a0ff0f5fa2491e64f167abc7b978531c45d2e3d8193fc5eea0c1c286f.record.md b/docs/branch-review-records/5ecfa15a0ff0f5fa2491e64f167abc7b978531c45d2e3d8193fc5eea0c1c286f.record.md new file mode 100644 index 0000000000..1ce8a058c5 --- /dev/null +++ b/docs/branch-review-records/5ecfa15a0ff0f5fa2491e64f167abc7b978531c45d2e3d8193fc5eea0c1c286f.record.md @@ -0,0 +1 @@ +| 2026-08-18 | claude/db-remediation-board-2026-08-18 | b82f7d46cfa111dea69ffc8cd55fcc10310b6123 | docs/database-remediation-coordination.md board update 2026-08-18 (#316) | coordinator self-review: docs-only board update verified against main 173ea9f28 and PRs #2087/#2093/#2058 | prettier --check pass; docs:check-links 1866 refs resolve | diff --git a/docs/database-remediation-coordination.md b/docs/database-remediation-coordination.md index 68ee928f77..1fb94ae0dc 100644 --- a/docs/database-remediation-coordination.md +++ b/docs/database-remediation-coordination.md @@ -75,27 +75,41 @@ Key evidence pointers a coordinator may need to re-verify claims: Actions runs ` ## Status board (coordinator: update this table as phases land) -_Board re-baselined 2026-08-17 by the coordination chat from `main` (`f5b093291`), the forensics -file, ledger `#316`, and the merged PR list — not from any worker chat's self-report._ - -| Phase | Status | PR / evidence | Notes | -| ------------------------------------------------------------------------------------ | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Prereq: merge PR #1906 | ☑ done 2026-08-13 | #1906 merged `4bbc4c5ca`; traps + parallel-session rules added by #2027 (`a75d226b0`) | Plan + playbook on `main`. This coordination file itself was still unmerged (branch tip `dc8969676`) until carried by the coordination chat's PR. | -| Prereq: `SUPABASE_ACCESS_TOKEN` secret (`#183`) | ☐ pending | repo-level secret names checked 2026-08-17: not present (env-level unverified) | Operator dashboard work; needed for migration-history CLI reads. Phase 1.1/1.3 ran anyway via the owner-authorised Supabase connector, so this gates CLI repair paths, not reads. | -| 0 — Enablement (routing, trigger, evidence file) | ☑ COMPLETE 2026-08-14 | #1938, #1939 (built twice — `#292`), #1951 (forced-dispatch proof, run `31813064485`, auto-issue #1963), #1978 (ledger/guard fixes) | Routing live; `tests/live-drift-workflow.test.ts` covers it offline. Issue #1963 still OPEN — last "still failing" comment 2026-08-17 (run `32011535189`) — expected until Phases 3–4 land. | -| 1 — Forensics (fingerprint, RPC dossier, EXPLAIN baselines) | ◐ PARTIAL | #1960, #1970 → `docs/audit/live-drift-forensics-2026-08.md` §1.1–1.3 | 1.1 done (`20260705180000` NOT mark-applied, 14 stmts; drop window 2026-07-05→08-02; cause unattributed, `#248` open). 1.3 done for whole schema (20 absent, 2 orphaned, zero invalid). **1.2 gating:** 6/16 mismatches proven noise, **10 UNCLASSIFIED**, hunks pending. | -| 1.2 — RPC dossier finish (read-only prod window) | ☐ NEXT | hypothesis in `#316` update (PR #2017): `SET work_mem` from `20260724000000` may classify 8/10 in one query | Fable. The only executable next step. Two `_v2` outliers need real diffs (canonical bodies named in `#316`). | -| 2 — Staging parity (`#056`) | ☐ not started | `#056` corrected by #2016: gap is **26 and widening** | Opus; staging window. Can run concurrently with 1.2 (different targets; `#056` is its ledger row). | -| 3 — RPC reconciliation | ☐ BLOCKED | — | Fable. Zero executable entries until 1.2 classifies (playbook forbids touching UNCLASSIFIED). Do not request a production window yet. | -| 4 — Index restoration | ◐ PARTIAL (incident) | #1960 §Phase 4: `documents_title_trgm_idx` + `document_chunks_content_trgm_idx` restored 2026-08-14 (648 kB / 68 MB, valid+ready) | Opus; off-peak prod window; blocked on 1–3. **20** still missing, 2 unexpected undispositioned, guard migration for the repaired pair still owed (plan 4.4), no green live-drift yet. | -| 5 — Measure (`#231` re-test) | ◐ PARTIAL (incident) | #1960 §Phase 5: text fast path 31,610 → 1,535 ms; hybrid 21,757 → 8,519 ms | `#231` verdict: retrieval latency was the binding cause in that window; hybrid ~8.5 s residual owned by remaining phases. Full EXPLAIN set + `check:production-readiness` pending. | -| 6 — Future-proofing (history probe, contract, ratchet) | ☐ not started | — | Fable; one migration deploy. Can be designed repo-side any time; deploy after Phase 4. | -| 7 — Deferred (`#022` `#025` `#036` `#191` `#196`–`#200` `#057` `#098`/`#099` `#011`) | ☐ not started | — | Each its own session, per playbook. | - -**Ledger state note (2026-08-17):** the `#316` "Phase 3 next" correction (PR #2017) and the `#056` -correction (PR #2016) are inbox requests; the reconcile that applies them to the canonical table is -open PR #2032 (`BEHIND` at review time). Until it lands, `npm run issues:report` still shows the -pre-correction prose — read the inbox request, not the row. +_Board re-baselined 2026-08-17 from `main` `f5b093291`; **updated 2026-08-18 from `main` `173ea9f28`**, the +forensics file, and the PR list — worker self-reports were checked against merged content, not +trusted as-is._ + +| Phase | Status | PR / evidence | Notes | +| ----------------------------------------------- | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Prereq: docs on `main` | ☑ done | #1906 (plan/playbook), #2027 (traps), #2044 (this board, `e663203ce`) | — | +| Prereq: `SUPABASE_ACCESS_TOKEN` secret (`#183`) | ☐ pending — not blocking | repo-level secret names checked 2026-08-17: not present | Owner chose the Supabase MCP connector for all windows (2026-08-17). Token gates CLI repair paths only. | +| 0 — Enablement | ☑ COMPLETE 2026-08-14 | #1938, #1939, #1951 (proof run `31813064485`, auto-issue #1963), #1978 | Issue #1963 stays open until Phases 3–4 land; now that Phase 6.1 is on `main` repo-side, weekly live-drift will _additionally_ report `schema_drift_snapshot()` as repo-ahead plus an info line "migration-history probe not present" — expected, not a regression. | +| 1.1 — History fingerprint | ☑ done (owner action open) | #1960 §1.1 | `20260705180000` NOT mark-applied (14 stmts). Drop window 2026-07-05→08-02; Phase 2 narrowed it: staging **kept** the four indexes production lost, so an out-of-band drop on production is the leading explanation. Dashboard audit-history pairing = owner. `#248` open. | +| 1.2 — RPC divergence dossier | ☑ COMPLETE 2026-08-18 | **#2087** merged `173ea9f28` → forensics §1.2; `#316` update queued (inbox `1591ee4a`) | Read-only connector window, 4 SELECTs, zero writes. **All 10 mismatches are attribute-only `SET work_mem`** present on live, absent from `schema.sql`; strip it → manifest hash 10/10. 4 mirror-stale (64 MB = `20260724000000`), 6 live-ahead attribute-only (128 MB ×4 hybrids; live-only 64 MB on `chunks_text_v2` and on `table_facts_text` after its `20260724120000` recreate). Zero body divergences, zero repo-ahead, zero UNCLASSIFIED. | +| 1.3 — Inventory / EXPLAIN | ◐ whole-schema done; sizing pending | #1970 §1.3 | 20 absent, 2 orphaned, zero invalid. Remaining index sizing + `rag_retrieval_logs` miss-scan baseline pending — fold into Phase 5. | +| 2 — Staging parity (`#056`) | ☑ COMPLETE — PR OPEN | **#2093** (tip `a6daac6c6`; BEHIND but merge-tree clean; `PR policy` red because `scripts/check-drift.ts` is a clinical-risk path and the body lacks the Clinical Governance Preflight) | Gap was **28**, not 26. Staging `ikoiolksxqxfxgiyqpnu` at 194/194 parity, zero `statements IS NULL`, all 28 rows md5-identical, corpus untouched, production never targeted. **`check:drift` vs staging RED, 19 items** — the migration chain does not reproduce `schema.sql`: `work_mem` 0× in `schema.sql` (7 fn mismatches; the 8th absent for exactly 1.2's recreate reason), **8 objects `schema.sql` declares that no migration creates** (five `document_embedding_fields` indexes, `documents_status_idx`, `documents_updated_at` / `ingestion_jobs_updated_at` triggers), 3 table column-set mismatches, 1 index-def mismatch. **Owed:** re-measure at `main` ≥ 195 migrations (apply `20260818090000` to staging, re-run `check:drift`). | +| 3 — Reconciliation (reframed) | ☐ NEXT — repo-side; D2 canary decision pending | needs owner decisions D1/D2 below | Fable. Not a production deploy: (a) add `SET work_mem` to the 10 `schema.sql` definitions + one migration `ALTER FUNCTION … SET work_mem = ` per function, ordered after every recreate (idempotent on prod); (b) codify the 8 never-created objects; (c) triage the 3 column-set + 1 index-def staging mismatches; regenerate `drift-manifest.json` (Docker); `RAG impact: no retrieval behaviour change — codifying already-live attribute`; governance preflight. Applying the migration to production is a trivial window (state already matches); the staging apply proves it first. | +| 4 — Index restoration | ◐ PARTIAL (incident) | #1960 §Phase 4 | 2 trgm restored; **20** still missing, 2 unexpected undispositioned; guard migration for the repaired pair owed (4.4); Phase 6.3 named 8 monitor-candidates for `required_indexes` — decide in 4.4. Blocked on Phase 3 landing. | +| 5 — Measure | ◐ PARTIAL (incident) | #1960 §Phase 5 | Text fast path 31,610 → 1,535 ms; hybrid 8,519 ms residual. Full EXPLAIN set, `work_mem` before/after (only if D1 changes values), `check:production-readiness` pending. | +| 6 — Future-proofing | ◐ REPO-SIDE COMPLETE 2026-08-18 | **#2058** merged `9c660af1f` (14 paths verified on `main`); follow-up #2090 open (comment pointers only) | 6.1 migration `20260818090000_schema_drift_snapshot_history_probe.sql` built + mirrored + manifest regenerated, **NOT deployed** — needs a production migration window after Phase 4. 6.2 contract + `supabase/drift-allowlist.json` (5 seeded superseded guards; ~18 §1.1 versions deliberately NOT allowlisted → first post-deploy run reports them; fix = fail-fast guard migrations, never bare allowlisting). 6.3 `tests/search-health-index-coverage.test.ts` + unmonitored list (44 entries, 8 monitor-candidates). New P2 row queued (inbox `d6ce8a1d`). Stale branch `claude/database-drift-allowlist-48839e` (tip `3fe1deafe`) was recreated after merge — redundant, owner may delete. | +| 7 — Deferred | ☐ not started | — | Each its own session, per playbook. | + +**Owner decisions outstanding (2026-08-18):** + +- **D1 — `work_mem` values.** Keep 128 MB on `chunks_hybrid` / `embedding_fields_hybrid` / + `index_units_hybrid` / `index_units_hybrid_v2` and codify as-is (no hosted value change), or + standardise to 64 MB (hosted change; Phase 5 must measure before/after). Recommendation: + codify-as-live; provenance of the 128 MB / `_v2` settings pairs with the §1.1 dashboard + audit-history owner action. +- **D2 — canary exemption.** `SET work_mem` is planner memory: latency only; only exactly-tied rows + could reorder. Recommendation: codify-as-live without an eval-canary; any hosted value change is + verified by Phase 5 EXPLAIN, not a canary. The RAG-surface flag and `RAG impact:` line still apply. +- **D3 — 6.1 deploy window** timing (after Phase 4). + +**Ledger state note (2026-08-18):** pending inbox on `main`: `1591ee4a` (`#316`, Phase 1.2) plus six +unrelated requests; #2093 carries the `#056` update (`d958d671`, replacing cancelled `a1c319d6`). +One serialized `issues:reconcile` after #2093 lands. Never merge `main` into a PR carrying a +reconciliation. ## Coordination rules