Gate P8 — Retrieval, packing and the git mirror¶
Status: Gate P8 passed (2026-11-06). G0 passed 2026-11-04; milestones 1–7 are done and G1–G8 all pass. The independent implementation review found no blocker; its two majors and three of its minors are fixed (§3). Design: ADR 0016 r0.3 with the M7 amendment; SPEC v1.8.3.
ADR review history (non-implementing reviewer):
| Round | Findings | Result |
|---|---|---|
| r0.1 review | 0 blockers, 7 majors, 12 minors | not acceptable as r0.1; acceptable after text fixes |
| r0.2 closure | M1–M3, M6, M7 closed; M4, M5 partly; new N1 (export replays every time), N3 (path encoding not injective) and 3 minors | acceptable after text fixes |
| r0.3 check | all closed; 3 text points fixed in place | G0 acceptable |
Decisions (2026-11-04): the owner said "continue" without choosing, so ADR 0016 §0 takes the recommended option for each, and the reviewer found all four acceptable. The owner may still override them.
- E1: embeddings through an external command, off by default.
- E2: f32 BLOBs in SQLite with brute-force search; no sqlite-vec.
- E3: G6 labels by two independent agents.
- E4: a hand-edited mirror is refused, and ctx mirror proposals lists the edits; nothing is written back.
Deployment (owner, 2026-11-04): the three local repositories stay on 0.2.0 (882108e). Only this repository's own deployment may be upgraded when P8 testing needs it.
Implementation milestones:
- Done. Projection health:
IndexStateinctx_recall,ctx statusand MCP;- the bounded wait (MCP default 200 ms), which wakes on the indexer's progress;
ctx reindex(admin), a chunked rebuild that reportsRebuilding{done, total}, andFailedwith a retry;- abstract and outline columns, rendered from the whole payload and rebuilt when
LEVELS_VERSIONchanges; contextdb-model::levels;- protocol 6.
Tests: T56, T86 and T94 (p8_index), and T87 (t87_levels at 10,000 seeds, plus the stored-copy check). Without a wait, 30 of 30 recalls right after a commit reported Lagging.
2. Done. Ranking:
- eligibility (head, lane, kinds, dir, certification) is decided inside each ranker, before any cut;
- withheld entries are capped at limit and never take an item slot;
- the key ranker stops at limit eligible candidates; bm25 pages the AND query, then the OR query, in pages of limit × 4 + 16;
- RRF fusion (k = 60) with the exact key first, then ties by key rank and logical id;
- dir covers the logical's dirs metadata, the revision's anchor premises, and an anchor's own path;
- structured MCP scope ({lane, kinds, dir}) or a plain lane string;
- limit above 100 is clamped and reported as limit_clamped.
Tests: T54, T85 and T95 (p8_ranking), T85 dir through anchors (anchors), the fusion unit tests (ranking), and MCP scope parsing. Changed: the P3 test that ranked every key match before every text hit now checks RRF (exact key first), and t44 now looks for root-a by key (the OR query also finds root-b).
3. Done. Levels and packing:
- ctx_recall{level, budget_tokens}: greedy packing in fused order (packing.rs). The header is charged first (16 tokens plus the key's bytes/4). Each item gets the highest level that fits, from full down to the header alone. Packing stops when a header no longer fits; the rest are counted in omitted, with no handle, certificate or ledger entry. estimate: "bytes/4 v1".
- Without a level or a budget the response keeps the header-only shape.
- ctx_read{level} (default full) recomputes the rendering from the payload; below full there is no payload.
- Every rendered item carries level and cut.
- LedgerEntry.level: a re-read of the same revision merges by max.
- Session log format 4: full reads keep tag 15, and levels below full use tag 22. Format-3 read events decode as full (SPEC v1.8.1 correction).
Tests: T55 and T88 (p8_levels), the rendering check (levels_render_like_the_pure_functions), p8_leveled_reads_need_format_4 (session_log), and the packing unit tests.
4. Done. Summaries:
- Item.premises{moved, total} on every Summary, from its witness rule against the nearest Verified vector (SPEC v1.8.2 note);
- shown by ctx_read, ctx_recall (withheld headers included) and MCP (premises, plus a note when moved > 0);
- the briefing lists up to 16 Summaries with moved premises.
The early stop needed no new code. Reverting a premise to validated content brings back the same revision, so discovery queues nothing and no record is written; re-recording identical text is an empty Committed. The ctx_supersede reply is pinned in SPEC §6.3. Tests: T90 (p8_summaries, and t90_reverting_to_validated_content_queues_nothing in p7_jobs), and the briefing rendering (hook_details).
5. Embeddings, with the P7 m4, m6 and m7 fixes (T89, T93).
- 5a, done: m4, m6 and m7.
- m4: the pair review batch carries ExpectHeads for both sides; an untaken pair is postponed in one statement, with no claim.
- m6: run_capped waits for the pipe readers for at most 500 ms; output over the cap is Malformed at once.
- m7: AlreadyOpen for a pair with an open two-sided Conflict.
Tests: T93 (`t93_*` in `p7_conflicts` and `p7_judge`), plus the runner tests in `contextdb-validate`.
The m7 check differs from ADR §7.3: it is a daemon lock around `ctx_conflicts open`, re-checked on a fresh snapshot, rather than a check on the actor thread. It serialises every open the daemon accepts. A raw admin batch that opens Conflict artifacts directly is not checked, as before.
-
5b, done: the embedder, the vector projection, the vector ranker and embedding candidates.
- The adapter is
contextdb-validate::embed:CommandEmbedder(throughrun_capped, withenv_clearplusHOME/PATH/LANGand a 0700 temp working directory) and theMock(hashed bag of words). - The projection is
contextdb-store::vectors; the thread, cache and ranker arecontextdb-daemon::embedding. - The thread is its own (
ctxd-embedder), so a hung embedder delays only vectors. Each embedder call runs on a helper thread, so shutdown never waits for one.
Tests: T89 (
p8_vectors: per-branch embedding candidates and visibility,bothrows, a hung or failing embedder never blocking writes, text recall or shutdown); the vector ranker with an uncertified match withheld; reindex and reuse by content; the adapter's failure modes and minimal environment (embedtests incontextdb-validate). Notes: - A recall's query embedding may wait up to 2 s when the embedder hangs. A failure is then held for 30 s, so a broken embedder costs at most one 2 s wait per query text per 30 s. This bounds recall but does not make it immune; G5 reports it. - Embedding pairs use the lexical pass's sweep and the listing's re-check (T84); the embedding pass also sweeps the rows touching its heads. - The candidate watermark for embeddings is its own table (candidates_embed_watermark), cleared with the table. 6. Git mirror (T57, T91, T92, T96, T97). Done. -contextdb-daemon::mirror: - path encoding; - render; -mirror.sqlite(tips, and revision epochs checked against the log checksum); - git plumbing through the capped helper with hooks off (fast-importmarks,mktree --batch,commit-tree --no-gpg-sign, CASupdate-ref); - tip validation by trailers, checksum and a replayed render; - proposals, status, prune. -Request::Mirroris admin-only. The CLI isctx mirror export|proposals|status|prune, and the project defaults to the git work tree holding the data directory. - Tests: -p8_mirroragainst real git repositories: - T91: deterministic, idempotent, other branches never move main's ref, contiguous ranges, the same tree in a fresh repository; - T57: an edited tip with a lying front matter, an amended tip, proposals withbase_revfrom the valid render,--forcewith a backup, prune; - T96: a lost cache, a deleted ref recreated on the cached commit,--adoptrefusing a tip without trailers,MirrorStalefor a wrong checksum or a range past the log; - T92: the CAS primitive, plus six rounds of two concurrent exporters, where every round raced and the loser gotMirrorRaced; - T97: tricky keys,featandfeat/x,git fsck --strictclean, an unavailable payload's placeholder. - Unit tests: injective encoding (a property over 20,000 random keys), quoting, trailers. - Checked end to end on a copy of this repository's store with the CLI. - Deviations, recorded in ADR §8: -rev_epochinstead ofhead_epoch; - the README names the format, not the tool version; -Code-Commitis alwaysnone, because positions are digests; -mirror.every_epochsis not implemented. - Covered in M7: a real truncation (doctor --truncate-before, then new commits) isMirrorStale(p8_g4), and the export budgets are measured (G5). 7. Done. Verification (G1–G8). The fixes it produced (G5 and the implementation review; CHANGELOG "P8 milestone 7"): - bm25 windows. bm25 scored every row a query matched, so a term most records hold cost time linear in the store (at 10⁵ records with Zipf words: idle p99 152 ms, 280–370 ms under a commit stream; with the dense 40-word vocabulary 578–818 ms, and a 6.5-hour 10⁵ fill, because lexical candidate generation was quadratic in a backfill). Matches are now ranked in windows of 2,048 rows by row id(logical << 16) | branch, bm25 order within a window; paging walks every window. Row ids depend only on the row, so a rebuild gives the same windows (review M2); an olderrecall.sqliteis rebuilt on open. - A reader connection and one snapshot. Recall readsrecall.sqliteon its own read-only WAL connection, so an index write never delays it, and every bm25 page of one recall comes from one read snapshot (review M1). - Candidate pass refresh. A long candidate pass lets the text index catch up every 50 ms, incrementally only; a full rebuild waits for the pass (review m3). - Mirror. A cached tip is checked against the log (MirrorStaleafter a truncation), also when the ref was deleted (review m4); a failed ref update isMirrorRacedonly when the ref moved, otherwiseMirrorFailed. - Crash pointsCTX_P8_CRASH(debug builds only) for G4. - The adapter is
0. Scope¶
- SPEC sections: §5 P8, §6.3 (
ctx_recall,ctx_read), §8.1 T54–T57, §10. - Taken from P7's review (P7 gate §3):
- m4: a pair review checks both heads;
- m6: embedder and validator children are kept in their process group;
- m7: one open Conflict per pair.
- Explicitly out of scope:
- permissions and redaction (P9);
- lazy maintenance and sharding (P10);
- LLM-written summaries;
- pushing the mirror.
1. Gate checklist¶
| Gate | Requirement | Result | Evidence |
|---|---|---|---|
| G0 Spec | ADR 0016 accepted; SPEC amendments (§11 of the ADR); no SPEC §3.5 mechanism introduced | ☑ | ADR 0016 §13; SPEC v1.8.0 |
| G1 Build & Lint | fmt, clippy -D warnings, tests, cargo deny | ☑ | 2026-11-06: fmt, clippy -D warnings, cargo deny and the workspace tests (141 test targets) all pass on the final tree |
| G2 Golden | T54–T57, T85–T97 | ☑ | §G2 |
| G3 Oracle | PROP14 (retrieval) at 10,000 seeds; metamorphic checks | ☑ | §G3, p8-g3-properties.txt |
| G4 Robustness | kill during reindex, embedding and mirror export; disk full; hung embedder; git lock contention | ☑ | §G4; the p8_g4 run is at the end of p8-g7-regression.txt |
| G5 Performance | recall p99 at 10⁴/10⁵; hybrid at 10⁴; packing; indexer lag; mirror export | ☑ | §G5, p8-g5-bench.txt, p8-g5-rerun.txt |
| G6 Scenario | ≥ 100 labelled queries: recall@k and MRR, token cost by budget, estimate vs real tokens, min_cosine |
☑ | §G6, p8-g6-score.txt |
| G7 Regression | earlier phases' G2/G3/G4; P7 suites and stress | ☑ | §G7, p8-g7-regression.txt |
| G8 Docs | README, CHANGELOG, SPEC, independent implementation review | ☑ | README P8 section and Ollama example; CHANGELOG; SPEC v1.8.3; ADR 0016 M7 amendment; §3 review |
Owner check before G6: the owner chose a local Ollama with nomic-embed-text (768 dimensions) through scripts/ollama-embed.py (2026-11-05), so the hybrid path is measured on real data. The mock gates nothing in G6.
2. Evidence¶
G2¶
Every item has a named test; all pass in the workspace run (cargo test --workspace --locked, 2026-11-06, on the final tree).
| Item | Tests |
|---|---|
| T54 | p8_ranking::t54_filtering_happens_before_the_cut, t54_the_text_ranker_pages_past_ineligible_hits |
| T55 | p8_levels::t55_packing_keeps_labels_and_order_for_every_budget |
| T56 | p8_index::t56_results_and_labels_survive_reindex_and_a_deleted_projection |
| T57 | p8_mirror::t57_hand_edits_are_refused_proposed_and_forced_with_a_backup |
| T85 | p8_ranking::t85_fusion_order_and_structured_scope; dir through anchors in anchors; the fusion unit tests in ranking |
| T86 | p8_index::t86_lag_never_returns_a_non_current_revision |
| T87 | p8_index::t87_stored_renderings_equal_recomputation; t87_levels (10,000 seeds) |
| T88 | p8_levels::t88_ledger_keeps_the_highest_level_across_restart; session_log::p8_leveled_reads_need_format_4 |
| T89 | p8_vectors::t89_embedding_candidates_are_per_branch, t89_a_hung_or_failing_embedder_never_blocks; the embed adapter tests in contextdb-validate |
| T90 | p8_summaries::t90_pending_count_and_the_digest_early_stop; p7_jobs::t90_reverting_to_validated_content_queues_nothing |
| T91 | p8_mirror::t91_export_is_deterministic_idempotent_and_contiguous |
| T92 | p8_mirror::t92_concurrent_exports_compare_and_swap; p8_g4::git_lock_contention (a held lock is MirrorFailed, not MirrorRaced) |
| T93 | p7_conflicts::t93_one_open_conflict_per_pair, t93_concurrent_opens_give_one_conflict; p7_judge::t93_a_side_moving_during_the_call_supersedes_the_pair, t93_a_skipped_pair_never_counts_an_attempt |
| T94 | p8_index::t94_index_state_in_recall_status_and_reindex |
| T95 | p8_ranking::t95_compatibility |
| T96 | p8_mirror::t96_cache_loss_is_not_a_hand_edit; p8_g4::a_truncated_log_is_stale_not_modified |
| T97 | p8_mirror::t97_paths_and_refs_are_valid_and_distinct, t97_an_unavailable_payload_renders_as_a_placeholder; mirror::tests::t97_encoding_is_injective_over_random_keys (20,000 keys) |
The M7 ranking changes have their own unit tests in contextdb-store::recall:
- ranking_windows_page_through_every_match: complete, no repeats, the same order at page sizes 7, 100 and 1,000, with a scope filter;
- ranking_windows_survive_a_rebuild_in_another_order;
- pages_in_one_snapshot_ignore_a_concurrent_write;
- a_projection_with_ordinal_rowids_is_rebuilt.
G3¶
p8-g3-properties.txt (scripts/g3-p8.sh, remote Linux host, 2026-11-06, final tree): PROP14 at 10,000 seeds passes, plus the injective-path property.
- Each seed is a
generate_p7history: half committed onmain, the rest on a forkdev. Every content hash gets a text body. - Random queries, modes, limits, kind filters, budgets and levels check:
- labels against the oracle on
main, and against the kernel's per-branch labels (checked by PROP13) ondev; - exactly
min(limit, |eligible matches|)items, so a page is short only when the eligible set is exhausted; - withheld entries are ineligible and at most
limit; - a budget keeps labels and order;
- the same result, as a set with statuses, after
ctx reindex. - Metamorphic checks: lane
""equals lane"repo", and an unrelated record never removes a certified exact-key match. - Counts: 120,000 queries, 155,519 items (134,284 Certified, 14,872 Stale, 5,178 Pending, 1,185 Conflicted), 21,779 withheld, 96,619 short pages, 59,868 budgeted, 60,000 on
dev.
Limit: PROP14 uses an in-memory index, and its stores never reach 2,048 matches for a query. It therefore exercises neither the reader connection nor more than one window (review M1, M2). The recall unit tests above cover those.
G4¶
p8_g4 (debug build, because the crash points are compiled out of release) runs at the end of p8-g7-regression.txt. All 7 tests pass:
| Test | What it does | Result |
|---|---|---|
kill_during_reindex |
A real ctxd aborts (as SIGKILL) during a chunked ctx reindex of 300 records. |
After restart the projection is Ready and complete. |
kill_during_an_embedding_batch |
A real ctxd aborts between embedding batches. |
Vectors fill in after restart. |
kill_between_commit_tree_and_update_ref |
Abort after the commit object is written, before the ref moves. | The ref never half-moves; the leftover object is harmless; the next export is not MirrorModified. |
kill_between_update_ref_and_the_cache_write |
Abort after the ref moves, before mirror.sqlite is written. |
The tip validates by re-rendering, with no false MirrorModified. |
disk_full_in_recall_and_vectors |
A page cap on recall.sqlite and vectors.sqlite. |
Recall keeps answering; the state is Failed; the work completes once space returns. |
git_lock_contention |
A held <ref>.lock, and a held packed-refs.lock. |
<ref>.lock: MirrorFailed with the ref unchanged (not MirrorRaced). packed-refs.lock: pruning a packed backup is blocked without harm. |
a_truncated_log_is_stale_not_modified |
doctor --truncate-before, then new commits at the same epoch numbers. |
MirrorStale. With the ref also deleted, export starts fresh: one commit, report line "created fresh". |
A hung or failing embedder never blocks writes, text recall or shutdown (p8_vectors::t89_a_hung_or_failing_embedder_never_blocks, G2).
G5¶
p8-g5-bench.txt: p8_bench 10000 100000 100000.
- Setup: M1 Pro, 2026-11-06, final tree. The op_log is SimDisk; the SQLite projections are on disk.
- Load: average 6–11 from other processes, mostly Spotlight indexing, with no build running.
- Vocabulary: records and queries draw words from a Zipf distribution (s = 1, 20,000 words; SPEC v1.8.3).
- The dense vocabulary (40 words, uniform) is only reported, in p8-g5-dense.txt.
| Item | Budget | Result |
|---|---|---|
| Recall p99, 10⁴, idle | < 50 ms | p50 2.59 ms, p99 10.68 ms: pass |
| Recall p99, 10⁴, commit every 2 ms / 50 ms | < 50 ms | p99 13.41 / 11.36 ms: pass; Ready within the 200 ms bounded wait in 100 of 100 |
| Recall p99, 10⁵, idle | < 150 ms | p50 16.28 ms, p99 59.44 ms: pass |
| Recall p99, 10⁵, commit every 2 ms / 50 ms | < 150 ms | p99 149.10 / 53.20 ms: pass, with a small margin at 2 ms (see below); Ready in 100 of 100 |
| Hybrid, 10⁴, 1,024 dims, from the cache | < 100 ms | p50 24.18 ms, p99 41.31 ms: pass |
| Packing overhead (budget 2,000, outline) | < 5 ms | +0.33 ms at 10⁴, +1.22 ms at 10⁵: pass |
| Indexer lag after a commit, p99 | < 500 ms | idle 8.18 ms (10⁴), 90.81 ms (10⁵); under a commit stream at most 142.78 ms: pass |
| Mirror first export, 10⁴ records, 10⁵ epochs | < 10 s | 0.59 s: pass |
| Mirror unchanged re-export | < 1 s | 0.188 s: pass |
| Mirror cache-miss validation at 10⁵ epochs (replay included) | < 60 s | 0.78 s: pass |
| bm25 hits examined per returned item | reported | 5.2–5.4 (Zipf), 5.6 (dense) |
| Hybrid, 10⁴, uncached | reported | p50 365 ms, p99 625 ms |
| Hybrid, 10⁵, 1,024 dims, cache 1 GiB | reported | p50 210 ms, p99 241 ms (brute force over 10⁵ vectors) |
| Fill and index | reported | 33 s for 10⁴, 2,194 s for 10⁵ |
Notes:
- The 10⁵ stream p99. It is close to the budget in this run (149.10 ms). An earlier run of the same ranking code, before the review fixes, gave idle p99 26.41 ms and stream p99 43.31 / 30.82 ms. In the final run, idle p99 doubled as well, and the idle path has no writes, so the review fixes (one read transaction per recall) cannot explain it. The difference is machine load. A rerun of the 10⁵ section on the same tree, with load falling from 10 to 3, (p8-g5-rerun.txt, p8_bench 1000 100000 0) gave idle p99 17.96 ms, stream p99 36.73 / 26.65 ms, packing +0.29 ms, indexer lag p99 under a stream 73.34 ms, hybrid at 10⁵ p99 226.88 ms, and a 1,870 s fill.
- Before the fixes.
- Dense vocabulary, no windows: 10⁵ stream p99 578 / 818 ms, Ready within the wait in only 70 and 76 of 100, fill 6.5 hours.
- Zipf vocabulary, no windows: idle p99 152 ms, stream 280 / 370 ms.
- At 10⁴ the windows changed nothing, because no query there has more than 2,048 matches.
- The 10⁵ fill is still superlinear (66× the 10⁴ time for 10× the records). It has no budget. The bench fills through the commit path, so the indexer and the candidate pass run for every new head; it is a P10 follow-up.
G6¶
Retrieval on this project's three dogfood stores, 2026-11-06 (p8_g6).
- Embedder: Ollama nomic-embed-text (768 dimensions) through scripts/ollama-embed.py.
- Token counts: claude -p (claude-haiku-5-5).
- Queries: 120 natural-language queries (21, 54 and 45 per store) by labelling agent A, who read every live head on main (p8_g6 export).
- Labels: agents A and B each labelled the relevant keys independently; neither saw any system output.
- Raw queries, labels and outputs contain project text and stay out of the repository. p8-g6-score.txt has only the aggregates.
| System | Agreed relevance (both labellers): recall@5 / recall@10 / MRR | Lenient (either): recall@5 / recall@10 / MRR |
|---|---|---|
| key only | 0 / 0 / 0 | 0 / 0 / 0 |
| key + FTS | 0.706 / 0.805 / 0.769 | 0.644 / 0.749 / 0.801 |
| hybrid | 0.710 / 0.820 / 0.770 | 0.657 / 0.771 / 0.822 |
- The labellers' relevant sets agreed exactly on 68 queries and differed on 52. Every query had at least one key both agreed on.
- Key only scores 0 because the queries are natural-language sentences, and the key ranker matches only a key equal to the query, starting with it or containing it. It serves agents that already know a key or a key path.
- Hybrid against key + FTS. Hybrid is slightly ahead on every measure. With 120 queries the difference is within noise: hybrid helps, but not by much on stores of this size (at most a few hundred heads each).
- Token cost (packed recall at the outline level, summed over 120 queries,
bytes/4):
| Budget | Tokens returned | Relevant records included | Relevant full bodies |
|---|---|---|---|
| 1,000 | 110,870 | 237 of 349 | 271,333 tokens |
| 2,000 | 117,552 | 237 of 349 | 271,333 tokens |
| 4,000 | 117,552 | 237 of 349 | 271,333 tokens |
Ten outlines fit within 2,000 tokens, so larger budgets change nothing at limit 10. The packed responses cost 41–43% of reading the relevant records in full and include 68% of them.
- bytes/4 against real tokens. On 10 sampled bodies, the estimate was 0.57–0.78 of claude -p's count (median 0.61). bytes/4 therefore undercounts by about 40%, and a budget in real tokens is overrun by up to 1.6×.
- The method: the extra input tokens over an empty-body prompt of 833 tokens.
- The estimate is labelled bytes/4 v1 in every response, so a calibrated v2 can replace it without changing the meaning of old responses.
- Follow-up: replace the estimate (for example bytes/2.5, or a tokenizer table).
- min_cosine. The nearest-neighbour pairs: 132 pairs (each Decision, Plan and Fact head with its three nearest neighbours in its lane at cosine ≥ 0.55). Both labellers labelled them: 130 agreed, 6 of them conflicts, and 2 disputed.
- No threshold separates contradictions well. The best F1 is 0.17, at 0.77.
- At the default 0.82, 7 pairs are kept and 1 of the 6 conflicts is found.
- Cosine measures topic, not contradiction. The default stays 0.82, so embedding candidates stay few and an LLM pair validator does the judging.
- The 6 conflicts are too few to calibrate on; this is redone when real conflicts accumulate.
- Caveats (review m6):
- Token cost uses the eval's own bytes/4 sum, not the response's estimate field.
- The real-token sample takes the first bodies by key in each store, measured inside the validator prompt; JSON escaping inflates the count a little.
- The min_cosine recall is relative to pairs at cosine ≥ 0.55.
- The ADR's comparison with P4's recorded reads is not implemented; follow-up.
G7¶
On the remote Linux host, 2026-11-06, final tree. p8-g7-regression.txt (scripts/g7-p8.sh) ends with G7 PASS. It runs:
- scripts/gate-regression.sh: the paranoid testkit (P0 goldens, P1–P3 properties at 10,000 seeds), exhaustive depth 6 (gate) and 8 (report), store and daemon crash injection (1,000 per point), PROP10 at 10,000 seeds, and the P4, P5a and P5b suites in release;
- scripts/g3-p6.sh: the P6 properties at gate counts;
- the P7 properties at 10,000 seeds, and the daemon, validate, MCP and CLI suites in release;
- P7 G4: a kill at each job step, 25 runs each;
- the P7 stress run, 1,800 s: 99,280 moves, 12,343 records, 18,361 worker reviews, 0 store errors and 0 violations;
- P8 G4 (above).
3. Independent implementation review (2026-11-06)¶
A reviewer who did not implement P8 read the M7 diff against ADR 0016 and SPEC §5 P8: the ranking windows, the reader connection, the candidate refresh, the mirror fixes, the benches and the G4 tests. No blocker. It found these sound: - the window mapping (same filters in both queries, exact skips, the last window, the single-window case equal to plain bm25); - the reader fallback and its visibility (a response never says Ready at an epoch the reader has not seen); - the release no-op of the crash points; - the CAS fallback; - the G4 tests and the CHANGELOG.
| # | Severity | Finding | Disposition |
|---|---|---|---|
| M1 | major | On the new autocommit reader, each bm25 page (and each statement inside one) had its own snapshot. An index write between pages could shift a row past a page boundary, so a page could be short while eligible matches remained. | Fixed: one read transaction (read_snapshot) covers the whole text-ranker loop and every statement in it. WAL readers do not block the writer. Test pages_in_one_snapshot_ignore_a_concurrent_write. |
| M2 | major | Windows followed SQLite's rowid, which records indexing history. A rebuild reinserted rows in another order, so a query with more than 2,048 matches gave different results after ctx reindex (contrary to G3). |
Fixed: explicit row ids (logical << 16) \| branch, so windows follow creation order on every path; an older projection is rebuilt on open. Tests ranking_windows_survive_a_rebuild_in_another_order, a_projection_with_ordinal_rowids_is_rebuilt. |
| m3 | minor | The candidate pass's refresh could run a full rebuild that failed after clear(). The pass then set its watermark over a partial index, and pairs were lost. |
Fixed: the refresh is incremental only. A requested or due full rebuild waits for the pass to end. |
| m4 | minor | A deleted ref with a cached tip skipped the new truncation check and was recreated on a history the log no longer had. | Fixed: the check applies there too. A mismatch starts the ref fresh. The p8_g4 truncation test covers it. |
| m5 | minor | The bench measured indexer lag idle only, and its "hits scanned" counted returned hits, not rows scored. | Fixed: lag is also measured under each commit stream. The figure is reported as "hits examined per returned item". |
| m6 | minor | G6 metric caveats (token cost from the eval's own sum, the real-token sample, min_cosine recall relative to ≥ 0.55, no P4 read comparison). |
Disclosed in §G6. |
| m7 | minor | Finding a window's bounds uses OFFSET, so a certified recall that walks many pages of ineligible hits costs O(matches²/page). |
Open; follow-up: carry the window bounds across pages. It is far cheaper than scoring every match, and G5 passes. |