Skip to content

design: ranked search nominates from the index and confirms in one snapshot (D142, #504) - #505

Merged
fazpu merged 61 commits into
mainfrom
design/index-driven-ranked-search
Oct 22, 2026
Merged

fazpu merged 61 commits into
mainfrom
design/index-driven-ranked-search

Conversation

@fazpu

@fazpu fazpu commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Fixes #504: ranked search scans every chunk instead of using its BM25/vector index. Design (approved in review round 3) plus implementation. Draft — do not merge; dual review (GPT-6.1 Sol + Antigravity) pending.

✅ Owner decision on P1-6 (2026-10-22): latency criterion amended; merge, then WP-RS.11

The owner's words: "definitely this way. It still sounds like a significant improvement. Let's get it in." The amendment is recorded in D142, in design §9 (the scaling gate), in the plan, in analysis §8.3, and in the retrieval design's budget note.

What changes. The blanket "p95 ≈ 300 ms at target size" criterion is replaced by measured budgets, per size and per stratum. They hold at 300k chunks only. The workload is public search_chunks (BM25, k = 20) over a synthetic corpus: 6,000 lineages × 5 versions × 10 chunks, half periodised, half with duplicated editions. It ran on an n2-highmem-8 VM with a warm cache, using 40 fixed queries, each run once per stratum. Every stratum also requires 0 early stops.

Stratum Eligible rows p95 budget Measured p95
current, unfiltered 60,000 ≤ 300 ms 263 ms
history, unfiltered 180,000 (of 300,000 indexed edition rows) ≤ 300 ms 267 ms
0.1% of documents 60 ≤ 300 ms 90 ms
1% of documents 600 ≤ 500 ms 351 ms
10% of documents 6,000 ≤ 1,000 ms 859 ms
exact tier at 4,990 rows 4,990 ≤ 2,500 ms 2,084 ms
pushdown at 5,010 rows 5,010 ≤ 1,000 ms 780 ms
  • Accepted for now: filtered reads that take several seconds.
  • Not gated: 3M chunks (that run is diagnostic) and the 50M target. They stay ungated until measured.
  • Still the target: about 300 ms for every common stratum.

Next work item: WP-RS.11 (#508), not in this PR. It covers two things:

  • store an immutable doc_id on the search rows;
  • re-tune the document exact-tier threshold, which is currently 2.1 s at 4,990 rows against 0.8 s for the pushdown at 5,010.

It has its own measured gate: p95 ≤ 300 ms for the filtered strata at 300k with 0 early stops, plus 3M on hydratable results.

Post-merge follow-ups (owner decision):

  • the paid LoCoMo answer-quality gate, after the owner's current full LoCoMo run finishes, never on that deployment;
  • WP-RS.0, real-data EXPLAIN on a copy of a deployment;
  • real-embedding recall.

Review round 8 (GPT-6.1 Sol, on cb437aa03): Approve (closure; review text kept outside the repo to avoid another CI cycle)

Review round 7 (GPT-6.1 Sol, on 30228a419): one PR-description P2 (annotate historical pending headings) → fixed in this description

Review round 6 (GPT-6.1 Sol, on cdc22288d): two documentation P2s (history eligible population 180,000; superseded pending statuses) → fixed in 30228a419

Note on the review history below: every "P1-6 open / pending the owner" status in rounds 2–5 is historical. P1-6 was resolved by the owner's latency amendment on 2026-10-22 (top of this description). Verdicts and measurements are kept as originally recorded.

Review round 5 (GPT-6.1 Sol): Approve, pending the owner's P1-6 decision — resolved by the owner's amendment, 2026-10-22

The review is copied to design/reviews/REVIEW_gpt-6.1-sol_d142_impl_r5_2026-10-22.md. Its one non-blocking nit is done, as a test-only change:

  • The dynamic result-type lookup returns statement_timeout with no row fetched, for both 57014 and 25P04. These tests fail if the re-raise is disabled.

  • The timeout classifier now has negative controls: timeout wording inside other errors (raw and wrapped), a lock timeout, a built-in TimeoutError, and an implicit exception context.

  • CI: all green on 1223ba6f5; only deploy was skipped.

  • Still open: R2 P1-6, the latency gate, waiting on the owner's decision. Resolved 2026-10-22 by the owner's amendment (top of this description).

Review round 4 (GPT-6.1 Sol): one item left, now fixed; R2 P1-6 (latency) still open for the owner — resolved by the owner's amendment, 2026-10-22

The response is design/reviews/RESPONSE_d142_impl_r4_2026-10-22.md, with the review copied next to it.

Finding Status
R3 P2-1 at the snapshot export and generation handlers fixed. Both handlers now return statement_timeout for 57014 and 25P04, keeping the original cause, before their usual p1_unavailable or confirmation_failed mapping. I also checked every other broad catch in the query sandbox. The only other one, the executor's format_type fallback, now re-raises a budget error instead of continuing in an aborted transaction. Database-free tests go through query_sql: both SQLSTATEs at both points, using a double that really exposes imported_snapshot, plus UndefinedColumn controls. The four budget cases fail on the old bridge.
  • CI: all green on fb90bfd24; only deploy was skipped.
  • VM: none used in this round.

Review round 3 (GPT-6.1 Sol): round 2 closed apart from one P2 and four nits, now fixed; R2 P1-6 (latency) still open for the owner — resolved by the owner's amendment, 2026-10-22

The response is design/reviews/RESPONSE_d142_impl_r3_2026-10-22.md, with the review copied next to it.

Finding Status
P2-1: budget errors at the SQL bridge fixed. A single classifier recognises 57014 and 25P04, including when SQLAlchemy has wrapped them, and also admission timeouts. It applies on the nomination, confirmation, coordinate and body paths, which now return statement_timeout. Genuine failures keep p1_unavailable and confirmation_failed. Database-free tests run through the public executor: 9 of 11 fail on the old code.
Nit 1: cursor planning contract fixed. Design §9.1 now states cursor_tuple_fraction = 1 and force_custom_plan, with the rationale.
Nit 2: sweep description fixed. It describes what the harness measures and what it does not.
Nit 3: per-call reuse trace fixed. A Counter of the chunks actually called must equal the expected Selection and Claimify rerun IDs, with one chunk per call. This sits outside the expected-failure test, and it passes in CI on Postgres.
Nit 4: margin domain fixed. The domain is validated before the cursor opens.
  • CI: all green on 9ad1451bd; only deploy was skipped.
  • VM: none used in this round.

Review round 2 (GPT-6.1 Sol, on 0ad5a0be9): REQUEST CHANGES → P1-1 to P1-5, every P2 and the nits addressed; P1-6 (latency) open for the owner — resolved by the owner's amendment, 2026-10-22

The full response is design/reviews/RESPONSE_d142_impl_r2_2026-10-22.md, with the review copied next to it. origin/main is merged in, so Rule 4 and the AGENTS.md pointer are present. Rule 4 holds: nothing here changes chunking, reuse keys or the Selection/Claimify/embedding inputs.

Finding Status
P1-1 sandbox authority instant fixed. Bridge fact nomination uses the imported request instant. Fact confirmation applies facts_current's own predicates at the request's now() instead of statement_timestamp(). Tested on Postgres: two SRFs across a validity boundary that passes during nomination keep the fact, at one reported instant.
P1-2 deadlines fixed. Fact and entity entry points derive their deadline from the operation. The loop re-clamps statement_timeout before attestation, every FETCH and every confirmation. The sandbox re-clamps before confirmation and before the outer statement. Standalone facts_context uses the operation deadline. Covered by Postgres tests.
P1-3 typed timeouts fixed. 25P04 is treated like 57014. nominate_* and standalone facts_context return typed boundaries. Settings are restored only in a healthy transaction, so the original error survives. Real timeouts during attestation and confirmation return p1_deadline (Postgres tests).
P1-4 resolve / compound accounts fixed. resolve runs in one operation and keeps the T3 account: a capped search with no hits is a boundary, not unknown_entity. The compound keeps the fact stop reason. The test fails on the old code.
P1-5 survivor-expanded budget fixed. The budget counts the stored endpoints of every absorbed entity, at most budget + 1 rows. Postgres test: a hub with absorbed-entity endpoints returns entity_scope_too_broad, both directly and through facts_context.
P1-6 latency gate Resolved 2026-10-22 by the owner's amendment (was: open, an owner decision; not started, by instruction). The reviewer recommends an immutable doc_id on search rows plus a measured fix (or an owner amendment) for unfiltered p95. New data at 300k: unfiltered p95 263–267 ms; filtered 351 ms to 2.1 s; the exact tier is slower than the pushdown at its threshold (analysis §8.3).
P2-1 margin proof fixed. n is the parser's real term count (ts_debug, compound tokens included). The derivation has explicit denominators and is proved for m·u ≤ 1/4; anything larger is refused.
P2-2 LoCoMo loader fixed. load_recorded_run reuses the runner's self-consistency checks without the current pins. Every question needs an answer and a judge. A genuine old-pin fixture loads; edited or mismatched runs are refused.
P2-3 tier budget fixed. One work budget is shared across the tiers, and the effective limits are reported.
P2-4 sweep fixed. Public results hydrate, per-query accounts are recorded, the plan proxy uses the real LIMIT, and claims are corrected. Rerun at 300k (analysis §8.3).
P2-5 owner-invariant proof fixed. Every Selection and Claimify call is traced to its target. Claimify reruns are bounded to the eight-chunk window. Reuse identity and text origin are asserted. The expected failure is narrowed.
P2-6 vectors as stored fixed. Validation runs after float4 conversion. Zero vectors are excluded from every exact path.
P2-7 fact tiers fixed in the design. The bounded exact entity-scoped fact scan is adopted in design §8.5 and D142 as a post-approval alternative.
Nits fixed.

Checks run (round 2)

  • CI: all green on 156a9eb6c (only deploy skipped).
  • Isolated GCE VM d142-r2, using the branch's built image: the full integration suite gives 1,231 passed, 2 skipped, 1 expected failure, and the 300k sweep was run. The VM was deleted, and gcloud compute instances list and disks list both come back empty.

Review round 1 (GPT-6.1 Sol, implementation, on 304ada30b): REQUEST CHANGES → addressed

Antigravity is still to review (its quota ran out). The full response is in design/reviews/RESPONSE_d142_impl_r1_2026-10-22.md, with the review copied next to it.

⚠️ Post-approval design changes, for the reviewers to judge

  1. Bounded reconciliation instead of the scorer patch (from before round 1). The margin is now query-dependent: (1+ε(n))⁴/(1−1/9), with ε(n) = 2(n+16)·2⁻²⁴ (P1-2).
  2. Eligible-set pushdown for document-filtered chunk searches (commit 69a68e407; design §8.3/§8.4, D142).
    • The search enumerates its eligible rows from the matching versions.
    • At most 5,000 rows: scored exactly.
    • At most 20,000 rows (a measured limit): pushed into the BM25/HNSW index scan as a hashed membership filter. The cursor then streams only eligible rows, in index order, under the same stop rules.
    • Above that: the plain loop.
    • Claim searches with a document filter always use the loop.
  3. One operation context (§8.2, D142). Each ranked operation owns one snapshot, one deadline and one pinned authority instant. The sandbox exports its own instant and deadline.
  4. hnsw.ef_search 200 in the semantic loop (the §9 recall gate).
  5. Full fact authority (facts_visible_history) applies before the fact nomination cut (§8.5).

Status per finding

Finding Status
P1-1 accounts end to end fixed. Port returns are explicitly structured. Accounts reach the public searches, the testimony RRF/union, fact fusion, the profile channel and the sandbox (fetched/rejected). A capped search never yields known_empty. Failing-first tests: 4 of 5 fail on the old code.
P1-2 float slack fixed. Query-dependent ε(n). The reviewer's counterexample is emulated in float32. A built-image test runs a randomized half-spilled corpus and checks both inequalities and the index order against bm25_get_current_score().
P1-3 one snapshot fixed. Public searches, nominate_*, claims_and_sources_context (entity check included) and standalone facts_context run in one operation. Confirmation, hydration and pending/freshness reads use its connection. The sandbox import spans hydration. Document search is read-only REPEATABLE READ.
P1-4 pinned instant fixed. The snapshot pins evaluated_at, and the adapter defaults to it. The bridge exports now() with its snapshot. pg_confirmed_at reports the pinned instant.
P1-5 fact authority before the cut fixed. Applies to the loop and to the scoped branches.
P1-6 entity work fixed. The budget counts mention and endpoint rows (budget + 1) before any scoring. The shared tiers also cover nominate_testimony_scored. entity_scope_too_broad is a typed boundary in every caller.
P1-7 deadline fixed. Nested reads clamp statement_timeout to the remaining time. The loop checks the deadline before every fetch. The SQL sandbox passes its one request deadline to every SRF. Covered by Postgres tests.
P1-8 pending cap fixed. doc_ids is applied before the cap, with one row read past it. An overflow sets complete=false in both surfaces.
P1-9 3M / 1% stratum completeness fixed, latency open. The pushdown takes early stops from 25% to 0 at 3M chunks (adapter p50 618 / p95 827 ms, against 3.9 s / 4.5 s in the plain loop). The p95 ≈ 300 ms interactive budget is not met: 0.8–3.1 s for the 1% filter and 2.3 s unfiltered at 3M on the test VM. Design-level options for the owner are in analysis §8.2; none is implemented.
P2-1 LoCoMo harness fixed. Each run is checked against its own recorded hashes, so a main baseline loads with its own fingerprint. Question sets must be identical and judging complete. Tested.
P2-2 recall harness fixed and run. It shares eligibility, snapshot and instant with the adapter, uses production paths, and treats exact-tier answers as inconclusive. On a clustered 100k-vector synthetic corpus it passes: 0.999 unfiltered, 0.9975 filtered, minimum 0.9. It had failed at the default ef_search 40 (0.887).
P2-3 image gates fixed in part. Every image build now runs the upstream regression suite (82 of 82 pass). The remaining adversarial cases are listed as pending in the plan.
P2-4 sweep fixed. Covers the public operation, a fixed query set, 0.1%/1%/10% filters and the 4,990/5,010-row boundary, with eligibility counts and corpus/query hashes. Results are archived in plan/analysis/data/.
P2-5 owner invariant fixed. Traced per input for living and dated lineages: Selection, embedding (by input hash) and claim IDs. The Claimify eight-producer window is a strict expected failure. D142 states exactly what is proved.
P2-6 profile vectors fixed. One shared validation path; exhaustion counts skip zero vectors.
Nits fixed. The tier is described as chunk-only. The cursor plan matches the attested plan (cursor_tuple_fraction=1, force_custom_plan). The caller's planner settings are restored.

Checks run

  • CI: all green on the final head 0ad5a0be9; only deploy was skipped.
  • Isolated GCE VM d142-r1 (now deleted; no instances or disks remain), using the branch's built image:
    • The full integration suite: 1,215 passed, 2 skipped.
    • The new Postgres proofs.
    • The owner-invariant regression: 8 passed, 1 expected failure.
    • The upstream pg_textsearch suite: 82 of 82.
    • The recall gate and the 3M sweep.

Owner-gated items still PENDING

  • ⏳ WP-RS.0, the real-data EXPLAIN check: not run. The harness is ready: benchmarks/p1_ranked/explain_real.py --deployment <uuid> --query … --out explain_real.json, run against a copy of a real deployment once the current LoCoMo run has finished.
  • ⏳ The paid LoCoMo answer-quality gate (WP-RS.9): not run. The harness is ready: benchmarks/p1_ranked/locomo_gate.py --main <3 runs> --change <3 runs>. It implements the predeclared paired non-inferiority test and exits 0 for pass, 1 for fail, 2 for inconclusive.
  • ⏳ HNSW recall on real embeddings: the gate passed on synthetic clustered vectors; a run on real vectors waits for the WP-RS.0 deployment copy.
  • ✅ The latency half of the scaling gate: resolved by the owner's 2026-10-22 amendment (above). Follow-up: D142 follow-up: immutable doc_id on search rows + re-tune the exact-tier threshold #508.
  • The distinct-text search index stays an unchosen proposal and is not implemented. Its adoption rule is approved by the owner (2026-10-21) and recorded in D142 and the proposal.

⚠️ Post-approval design change, for the reviewers to judge

The round-3-approved design made the two BM25 scorers identical with a local pg_textsearch patch. During implementation that patch proved broad: the index accumulates float4 terms in index order on four scoring paths (memtable, segment WAND, single-term fast path, top-k heap), while the standalone operator accumulates float8 in query-term order. So the implementation uses bounded reconciliation instead, with no extension change:

  • The standalone operator stays the one canonical score that every result carries.
  • Length quantization only rounds down, by less than 1/9: the worst case is 0.111108. This was checked against all 256 entries of FIELDNORM_DECODE_TABLE at the pinned revision. Hence, for every row, index ≤ canonical ≤ index/(1−1/9), give or take float slack.
  • The cursor stops k_filled only when the k-th canonical score is greater than (1+ε(n))⁴/(1−1/9) (≈ 1.126 for a 4,096-character query; ε(n) from the parser's term count) × the last fetched canonical score. No unfetched row can then enter the result or tie with it.
  • Exactness is unchanged (BM25 results equal an exact canonical oracle under one scoring generation). The cost is extra fetching of rows within about 12.5% of the k-th score, which shows in the counters.
  • The scorer-bound gate:
    • A unit gate fails when the image pins a pg_textsearch revision other than BM25_BOUND_VERIFIED_REVISION.
    • Postgres proofs run on the built image: the loop equals the oracle under a restrictive filter, the 48/50/67 counterexample, and the 40/41 tie.
    • Round 1 built the randomized spill-mixed, multi-term corpus that compares every streamed row's index score with its canonical score.
  • Recorded as a post-approval change in D142, design §8.3/§9, analysis §6.1 and the plan.

What is implemented (by WP)

WP Status
RS.0 ⏳ pending (harness only)
RS.1 pg_textsearch 1.5.1 (fa142d04) is pinned, the D98 patch is deleted, and every pin, checksum and doc is updated. Writers reject zero-norm and non-finite vectors.
RS.2 Ranked-read context: a read-only REPEATABLE READ pool snapshot. The SQL sandbox exports its snapshot and P1 imports it (SET TRANSACTION SNAPSHOT). The P1 reads of claims_and_sources_context share one snapshot.
RS.3 adapters/p1_ranked.py: nominate → confirm → continue. One streamed cursor per channel with LIMIT = the work budget. Planner controls are scoped to the statement, and the plan is EXPLAIN-attested (otherwise plan_rejected). Fetches are disjoint and doubling from 4k. Terminations are k_filled/exhausted/work_budget/deadline/ann_scan_bound/plan_rejected. HNSW exhaustion is proven by an exact count. Covers chunk and claim searches, semantic and BM25.
RS.4 Structured P1SearchResult/P1SearchIds with P1SearchAccount. Envelopes disclose p1_<termination> truncation and return a boundary negative, not known_empty, when a search was incomplete. Also covers testimony lists, sandbox SemanticInvocation, and scope_pending.complete (new field: OpenAPI, TS client and manifest regenerated).
RS.5 Coverage tiers for testimony searches: exact up to 5,000 items, otherwise the loop; an entity budget of 50,000 (otherwise P1EntityScopeTooBroadError). Post-approval addition: document-filtered chunk searches with at most 5,000 eligible rows are scored exactly; the probe is driven from the matching versions.
RS.6 Deployment-wide fact and entity searches run on the loop.
RS.7 Unit proofs (test_p1_ranked.py), Postgres proofs (test_p1_ranked_pg.py) and the owner's incremental-ingestion regression (below).
RS.8 Passes the amended criterion at 300k chunks (design §9, analysis §8.3; final configuration, hydrated public results, 0 early stops). The 3M runs on isolated, now-deleted VMs are diagnostic only; 3M and 50M are ungated until measured.
RS.9 The recall gate passes on synthetic clustered vectors. Real-embedding recall and the paid LoCoMo gate are ⏳ pending.
RS.10 Docs: the retrieval concepts, result types and versions-in-force pages, plus llms-full.txt.

Migrations: none. D142 adds no Alembic revision, so there is nothing to collide with #506 (WP-ET.7).

Owner invariant: incremental ingestion

D142 touches none of the following: anchor-stabilized chunking (D58), the extraction_input_hash/reuse_identity_hash inputs, text-origin logic, embedding carry-forward, or search_text/embedding inputs. The only change near ingestion is that writers refuse zero-norm and non-finite vectors.

New CI regression test_reuse_lifecycle.py::test_one_paragraph_edit_reuses_every_chunk_outside_its_neighbourhood: v1 then v2 of a three-section document, with one paragraph of section B rewritten. It asserts:

  • Only chunks with a new extraction input identity are re-extracted, and they lie in the edited chunk ∪ its same-section neighbours.
  • The model's Selection-call count equals that set.
  • Every other chunk (all of A and C) keeps its v1 vector.
  • Embedding calls stay within the neighbourhood.

Scaling sweep (WP-RS.8)

See analysis §8.1 (the first run), §8.2 (the round-1 rerun at 3M, diagnostic) and §8.3 (the final-configuration 300k run that passes the amended criterion). Results are archived in plan/analysis/data/.

Deviations from the plan

  1. Bounded reconciliation instead of the scorer patch (above: a design change for review).
  2. Entity-scoped fact searches stay exact scans, now bounded by a proven input-row budget (endpoint rows ≤ 50,000, otherwise entity_scope_too_broad).
  3. Hydration outside the snapshot: fixed in round 1 (P1-3).
  4. The LoCoMo protocol fingerprint and the manifest hash changed (new scope_pending.complete), so earlier run artifacts don't compare by hash.
  5. Confirmation probes each candidate with a LATERAL subquery instead of = ANY(:batch_ids) (design §8.3 step 3, updated). It does not yet report the rejection class for each rejected ID; it reports counts only.
  6. The scorer-bound gate is a revision pin, a float32 unit gate and Postgres proofs, including the randomized spill-mixed corpus.
  7. A document-filtered chunk search uses the exact tier (at most 5,000 rows) or the pushdown (at most 20,000 rows); both are post-approval changes. Claim searches with a document filter always use the loop.

Design history

Reviewed by GPT-6.1 Sol in three rounds; round 3 approved. Responses are in design/reviews/RESPONSE_d142_design_r{1,2,3}_2026-10-21.md, with each review copied next to its response. Design: plan/designs/postgres_p1_search_projection_design.md §6, §8, §9, §12, §14. Analysis: plan/analysis/index_driven_ranked_search.md. Plan: plan/plans/index_driven_ranked_search.md. Decision: D142.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF

fazpu and others added 30 commits October 21, 2026 13:04
…one snapshot (#504)

Analysis of why ranked P1 search scans every chunk, the nominate-confirm-refill design in the P1 search design (§6, §8, §9, §12, §14) with wording reconciled in the open query space, retrieval, document search and D140 designs; D142 with refinement notes in D94 and D98; the unchosen distinct-text search index proposal with its pilot-based adoption trigger; and the delivery plan.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Ranked-read context with snapshot export/import for the SQL sandbox and pinned instants; one nomination cursor per channel (one BM25 scoring generation), disjoint fetches, scores carried; positive-match-only lexical semantics; channel-specific termination and a structured search result through RRF, fact merge, envelopes, semantic_invocations and scope_pending.complete; enforced and EXPLAIN-attested nomination plans; coverage-first facts merged by (coverage, distance, kind, id); cost-model limits; executable quality gates; distinct-text proposal fans out to member chunks with an isolated-prototype prerequisite; contrary contracts reconciled (D94/D98/D140 notes, graph, open query space, retrieval).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
One canonical BM25 score (fieldnorm-quantized length, one shared routine, bitwise ties) across index, exact tiers, SRFs, probe and oracle, with a reviewed memtable scorer-identity patch and a per-build scorer-identity gate; fetched-candidate vs index-internal work separated; predeclared paired non-inferiority LoCoMo gate; remaining same-statement clauses reconciled; open query space sequencing moved to plan/plans; immutable source links.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Pin float8 accumulation order in the canonical BM25 score and qualify equivalence with today's ordering as measured (the upgrade comparison includes the scorer patch); fix the three residual statement-snapshot wordings; record review round 3.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Pins upstream v1.5.1 (fa142d04), which supports PostgreSQL 19 and fills post-filtered BM25 top-k scans; removes docker/pg_textsearch-pg19.patch; updates the graph catalog version map, the D98 audit test, image provenance and the self-hosting requirements page. License and notice checksums are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…ions

Adds a CI regression test: v2 of a three-section document with one edited paragraph re-extracts and re-embeds only the changed chunk and its immediate same-section neighbours, while every other chunk reattaches its v1 claims and carries its v1 vector. Records the owner's approval (2026-10-21) of the distinct-text investigation/adoption rule and the incremental-ingestion invariant in D142 and the proposal.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Adds adapters/p1_ranked.py: one nomination cursor per search (join-free index statement, planner controls scoped to DECLARE, EXPLAIN-attested index plan), disjoint doubling fetches confirmed by primary key with the unchanged eligibility predicates, positive-match-only BM25, the canonical-score stop margin (index score <= canonical <= index/(1-1/9)), channel-specific termination and HNSW exhaustion by exact count. Claim/chunk semantic and BM25 searches run on it in one read-only REPEATABLE READ ranked-read connection; explicit candidate sets stay exact; entity-scoped searches rank coverage tiers (exact up to 5,000 items, loop inside larger tiers, entity work budget). Results are P1SearchResult (tuple + account). Writers reject zero-norm and non-finite vectors. Unit tests pin the stop margin to the fieldnorm table and the reviewer's 48/50/67 counterexample.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Implementation decision: keep the standalone <@> operator as the canonical BM25 score, evaluated in the nomination cursor's executor, and stop only past a proven margin (quantization rounds lengths down by < 1/9, so index <= canonical <= index/(1-1/9)). No extension patch; a scorer-bound gate re-verifies the bound per image build. Design §6/§8.3/§9, D142, D98 note, graph design, analysis and plan updated; flagged for the next review round.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…ult propagation

Deployment-wide fact search and fact nomination run one D142 loop per fact table merged by (distance, kind, id); entity profile search runs on the loop; entity-scoped and explicit-key fact searches stay exact scans and report their account; entity-scoped testimony nomination enforces positive-match BM25 and the entity work budget. Accounts propagate: P1SearchIds keeps the account for unscored ids, nomination envelopes disclose early stops as truncation (reason p1_<termination>) and report a boundary instead of known_empty when a search stopped on a bound, and claims_and_sources_context marks its testimony lists truncated when any channel stopped early. SQL-shape tests updated to the join-free nomination plus confirmation.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…register unit test

Connection.execution_options() mutates the connection in SQLAlchemy 2.0, which turned later statements into server-side cursors; stream_results is now passed per statement. Nomination statements carry LIMIT = work budget because both extensions use their index only for ORDER BY ... LIMIT. Registers test_p1_ranked.py in the unit test inventory.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
The previous commit's inventory edit dropped unrelated entries; this restores the file byte-for-byte and inserts the one new path.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
The SQL sandbox exports its READ ONLY, REPEATABLE READ request snapshot and the P1 adapter imports it (BoundedPostgresReadPool.snapshot(import_snapshot=...)), so nomination, continuation and the executor's D48 confirmation read one state; a failed export is p1_unavailable. Invocation records carry the D142 termination (completed or p1_<reason>).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…ontracts

Freshness.scope_pending gains complete (false when a probe nomination stopped on a bound; count is then a lower bound), threaded from every probe's account. claims_and_sources_context runs its P1 reads in one pool snapshot (nested operations reuse the enclosing one). Regenerates openapi.json, the TypeScript client contracts and the memory_v1 surface manifest; re-pins the LoCoMo surface manifest hash and protocol fingerprint that embed it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Real pg_textsearch/pgvector proofs: BM25 loop equals the canonical (standalone) oracle under a restrictive document filter, scores included; absent/stop-word queries return no lexical rows and end exhausted, with no zero-score tail; the reviewer's 48/50/67 counterexample returns the 67-token canonical winner at k=1; a 40/41-token canonical tie orders by stable id; a rejecting confirmation ends work_budget; HNSW nomination with confirmation proves exhaustion by count; an imported snapshot hides rows committed after export.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
benchmarks/p1_ranked: explain_real.py (WP-RS.0, for a copy of a real deployment), sweep.py (size sweep with current, 1% filter and history strata over superseded duplicate editions), recall.py (HNSW recall gate with the design's starting thresholds) and locomo_gate.py (predeclared paired non-inferiority test; unit-tested). Docs: positive-match BM25, early-stop truncation reasons (p1_*), invocation termination reasons and scope_pending.complete; llms-full.txt regenerated. Plan records per-WP status, including what is pending.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…traction identity

The ranked Postgres proofs now publish the deployment's P1 channels, as the
adapter requires. The owner-invariant reuse test counted claim rows on v2
chunks as re-extraction, but a D56 Selection replay also materializes claims
on the new chunk; it now compares extraction input identities and pins the
model-call count to them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…hange; revision-pinned scorer-bound gate

The approved design bound the scorers with a local pg_textsearch patch; the
implementation replaced it with the §8.3 margin. D142, the design, the
analysis and the plan now say so as a design change for the dual review. The
scorer-bound gate text now matches what exists: a unit gate that fails when
the image pins a revision other than the one the margin was verified on, and
Postgres proofs on the built image; the randomized spill-mixed corpus is
named as not built.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…e eligible rows

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
`= ANY(:batch_ids)` let the planner drive confirmation from the
eligibility joins: every eligible chunk, each re-probing the whole id array.
The scaling sweep caught it at 17 s for one 4,000-id batch at 30k chunks.
Confirmation and the exact tier now unnest the batch and probe each
candidate through a LATERAL existence/score subquery (131 ms for the same
batch). Testimony, fact and entity confirmation share the shape.

Verified on an isolated Postgres (built engine image): test_p1_ranked_pg,
test_postgres_p1, test_postgres_p1_document_filters,
test_d140_scoped_retrieval — 61 passed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…per-candidate confirmation

The D140 seed's words come from hashint8 (a 32-bit hash) divided by 2**63,
so every word is w0 and every chunk has 24 words: every BM25 score ties and
the sweep measured only tie runs. The sweep now rewrites search text with
Zipf-skewed words of 20-300 words per chunk before measuring.

Design §8.3 step 3 records the LATERAL per-candidate confirmation and that
per-rule-class rejection counts are not implemented yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
With a 1% document filter the loop fetched up to the work budget and still
stopped short (sweep: 5% of queries at 30k chunks, 30% at 300k). A
document-filtered search now reads its eligible rows up to the exact-tier
threshold + 1 and scores them exactly when they fit, as entity tiers do.
The oracle proof runs both through the loop and through the tier.
Design §8.4 records it as a post-approval addition.

Verified on an isolated Postgres (built engine image): 62 passed across
test_p1_ranked_pg, test_postgres_p1, test_postgres_p1_document_filters,
test_d140_scoped_retrieval.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…eeds D134 metadata

The tier's eligibility probe let the planner start from every chunk: 6 s at
3M chunks for a 60-document filter. It now starts from the matching
versions (live_matching_versions, the set form of live_version_matches) and
reads each version's chunks through a LATERAL subquery: 511 ms for 60
documents, 107 ms for 6. The sweep now gives every seeded version D134
metadata; without it the document stratum matched nothing.

Verified on an isolated Postgres (built engine image): 62 passed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…d the open 1% stratum

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
… test (review r1 P1-2)

A fixed 1e-4 slack is not a bound: float4 accumulation error grows with the
number of terms, and 40,000 single-occurrence terms in one long document
reach canonical/index = 1.12533 against the fixed margin 1.12523 (the
reviewer's counterexample, emulated in a unit test). The margin is now
(1+ε)^4/(1-1/9) with ε = 2(n+16)u, n an upper bound on analyzed query terms
((len+1)//2) and u the float4 unit roundoff. A new Postgres test spills half
a randomized corpus and checks both inequalities and the index order for
every streamed row against bm25_get_current_score().

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…ero vectors (review r1 P2-6)

require_p1_vector (port contract) now guards every P1 vector writer,
including both profile-refresh paths on the provider response, before any
write transaction. HNSW exhaustion counts exclude zero-norm legacy rows,
which cosine HNSW does not index.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…nput rows; shared tiers; pinned operation (review r1 P1-5, P1-6, part of P1-4/P1-7)

- P1-5: fact nomination (loop and scoped branches) joins
  facts_visible_history before a row counts toward the candidate cut.
- P1-6: the entity budget counts mention rows (and, for scoped fact scans,
  endpoint fact rows) at most budget+1 before anything is scored;
  nominate_testimony_scored runs the same coverage-tier execution as
  ordinary search (exact small tiers, the index loop in large ones).
- The bounded read pool's snapshot pins a ReadOperation (deadline and the
  transaction's now() or an explicit instant); nested reads clamp
  statement_timeout to the time left, and the P1 adapter takes its default
  instant and deadline from it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…napshot, deadline and instant (review r1 P1-1, P1-3, P1-4, P1-6 mapping)

- Port methods return P1SearchResult/P1SearchIds explicitly; test doubles
  follow. merge_accounts moves to the port and keeps limits.
- search_claims/search_chunks, claims_and_sources_context and standalone
  facts_context own a ranked-read operation: nomination (always with an
  explicit scope at the pinned instant), confirmation, hydration, entity
  checks and pending/freshness reads use its snapshot connection.
- Early stops are disclosed (p1_<reason>) and never become known_empty:
  public searches, the testimony hybrid (per-channel reason through RRF and
  combine_evidence), fact fusion and the profile channel (even with no
  profile ids). Statement-timeout expiry answers with a typed p1_deadline
  boundary; entity_scope_too_broad is a typed boundary in every caller.
- New failing-first tests (test_d142_accounts.py: 4 of 5 fail on the old code).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…ans hydration (review r1 P1-1, P1-3, P1-4, P1-7)

- The SQL bridge exports pg_export_snapshot() with the request's now(); the
  P1 adapter imports both, so every default scope and fact time inside the
  SRF uses the request's authority instant. pg_confirmed_at reports that
  pinned instant (now()) instead of statement_timestamp().
- The imported snapshot stays open through confirmation and chunk-body
  hydration.
- BridgeSettings carries the request's absolute statement deadline; every
  SRF spends that one budget instead of a fresh 30 s each.
- SemanticInvocation publishes fetched and rejected from the search
  account (nominated is only the returned prefix); OpenAPI and the
  TypeScript contracts are regenerated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
fazpu and others added 22 commits October 21, 2026 23:30
…ocument-filtered searches (review r1 P1-9, post-approval design change)

A document-filtered chunk search enumerates its eligible rows from the
matching versions (at most FILTER_PUSHDOWN_LIMIT = 100,000). Up to the
exact-tier threshold they are scored exactly; above it the set is pushed
into the BM25/HNSW index scan as a hashed membership filter, so the cursor
streams eligible rows only, in index order, under the same stop rules; the
HNSW exhaustion count is filtered alike. Confirmation still applies every
predicate. The oracle proofs now cover the plain loop, the pushdown and the
exact tier; the semantic exhaustion proof covers loop and pushdown.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…nd more strata (review r1 P2-4)

Queries come from the generator's own Zipf distribution, identical at every
size; strata add 0.1%/10% document filters and both sides of the 5,000-row
tier; each query runs through QueryEngine.search_chunks and reports the
public outcome (k returned, boundary reason) with the adapter's account
(fetched, rounds, termination); eligible-row counts, corpus and query
hashes are recorded; the nomination-work proxy explains the production
statement read to the measured depth. --measure-only measures an existing
corpus.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…e measures production paths (review r1 P2-2, P1-9)

On a clustered 100k-vector corpus the gate failed at pgvector's default
ef_search 40 (mean recall@10 0.887, single queries at 0.0); 200 measured
0.999 unfiltered and 0.996 with a 1,000-document filter. The recall
harness no longer disables the exact tier: the filtered stratum is sized
above it (pushdown + HNSW) and any stratum answered exactly makes the gate
inconclusive.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…egression suite (review r1 P2-3)

The builder stage starts a throwaway cluster of the exact PG19 server build
and runs make installcheck; a failure prints regression.diffs and fails the
build. On the pinned image all 82 upstream tests pass (verified on an
isolated VM build).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…eds the pushdown

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…y gate open; pushdown limit 20,000 (measured)

The eligible-set pushdown removes the 1% stratum's early stops at 3M chunks
(25% -> 0; adapter p50 618 ms / p95 827 ms vs 3.9 s / 4.5 s), but a 10%
filter is slower pushed down (4.7 s vs 1.7 s), so the limit is 20,000 rows.
The interactive p95 budget (~300 ms) is not met at 3M by the filtered or the
unfiltered stratum; analysis §8.2 records the numbers and design-level
options for the owner. Results and the recall gate run are archived under
plan/analysis/data/. D142, design, plan and the review response are updated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…us update

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…rywhere, typed timeouts, resolve accounts, survivor fact budget (review r2 P1-1..P1-5)

- P1-1: bridge fact nomination no longer overrides the imported instant;
  fact confirmation applies facts_current's predicates at the request
  transaction's now() instead of the view's statement_timestamp().
- P1-2: fact/entity entry points derive their deadline from the operation;
  the loop re-clamps statement_timeout before attestation, every FETCH and
  every confirmation; the sandbox re-clamps before bridge confirmation and
  before the outer statement; standalone facts_context uses the operation
  deadline.
- P1-3: 25P04 (transaction_timeout) is a deadline like 57014;
  nominate_claims/nominate_chunks and standalone facts_context answer a
  typed p1_deadline boundary; planner settings are restored only in a
  healthy transaction, so a cancelled EXPLAIN/DECLARE keeps its error.
- P1-4: resolve runs in one operation, keeps the T3 account (boundary for
  a capped empty search, reason on a partial one); default_facts_context
  keeps the fact stop reason. Failing-first unit test for resolve.
- P1-5: the scoped fact-scan budget counts the raw endpoints of every
  entity the requested survivors absorbed (the scoring scope), at most
  budget+1 rows across both tables.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…alidates each run's recorded identity (review r2 P2-1, P2-2)

- The BM25 stop margin counts query terms with the real parser (ts_debug,
  compound tokens and their parts) before the loop; the epsilon derivation
  now proves both rounding directions with explicit denominators and holds
  exactly for m·u <= 1/4 (longer queries are refused). Domain tests at the
  boundary; a Postgres test checks the parser count (a-b -> 3).
- The runner gains load_recorded_run: every self-consistency check of
  _load_run (recomputed fingerprint, hashes, rendered documents, state and
  judge/answer identity) without the current code's pins. The gate uses it
  and requires an answer and a judge for every question. The old-pin
  fixture is now prepared under that pin (a genuinely valid baseline);
  missing-answer, mismatched judge id and edited-fingerprint runs are
  refused.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…ted as float4; zero vectors never eligible (review r2 P2-3, P2-6)

- _entity_tiers passes the remaining per-search work budget to every tier
  loop and stops with work_budget when it is spent; limits report the loop
  and HNSW settings. Unit test: two rejected large tiers get 20,000 then
  the remaining 5,000.
- require_p1_vector checks the float4 values pgvector stores: underflow to
  zero and overflow are rejected before any write.
- Zero-norm legacy vectors are excluded from every exact semantic path
  (testimony tiers, scoped fact scans), as HNSW already cannot reach them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
… and traced-reuse proofs; sweep hydrates public results (review r2 P1-1..P1-5, P2-4, P2-5)

- Bridge: two fact SRFs across an already-declared validity boundary that
  passes during nomination confirm at one request instant; SRFs that use
  up the request budget leave the outer statement a timeout, and a
  cancelled confirmation answers statement_timeout.
- Adapter: real statement timeouts during attestation and confirmation
  answer p1_deadline through search_chunks; fact and entity searches
  inherit the operation deadline; a hub whose facts store an absorbed
  entity's id is entity_scope_too_broad directly and through
  predicate-filtered facts_context; the parser term count.
- Reuse regression: every Selection and Claimify call traced to its target
  chunk; one call per new Selection/Claimify identity; Claimify reruns
  bounded to the known eight-chunk window; reuse identity and text origin
  carried; the expected failure holds only the requirement-vs-gap assertion.
- Sweep: hydration ignores the absent embedding generation so public
  results hydrate; the plan proxy uses the production LIMIT without
  ANALYZE; per-query accounts are recorded.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…nding design; ef_search 200 with its evidence; correct stale claims (review r2 P2-7, nits)

- Design §8.5 and D142 describe the implemented alternative: a
  survivor-expanded stored-endpoint budget (50,000 rows) counted first, the
  typed entity_scope_too_broad above it, exact scoring below it; not the
  tier loop, and not a 5,000-row tier.
- Design §8.5 states hnsw.ef_search = 200 and links the synthetic recall
  evidence.
- D142 names the vector write validation change and states exactly what
  the owner-invariant regression proves.
- Plan and analysis: hydration and the spill-mixed test are no longer
  gaps; latency growth is sublinear, not corpus-independent; the 3M rerun
  is labelled diagnostic. Test docstrings match what they test.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
The deadline test's clock is keyed to the first confirmed round (the
per-statement clamp also reads the clock); merged entities carry their
status; the sandbox budget test uses only grammar-allowed SQL; the hub
fixture scopes without requiring a mention-backed anchor.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
… with hydrated public results

At 300k chunks no stratum stops early and public results hydrate;
unfiltered p95 263-267 ms; filtered 351 ms to 2.1 s; the exact tier is
slower than the pushdown on either side of its threshold (input to the
owner's latency decision, review r2 P1-6, not changed here). Full
integration suite on the built image: 1,231 passed, 2 skipped, 1 expected
failure.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…s (review r3 P2-1, nits 1-4)

- budget_exhausted unwraps SQLAlchemy-wrapped errors and recognises 57014,
  25P04 and admission timeouts; nomination, confirmation, coordinate
  confirmation and body reads answer statement_timeout for them and keep
  p1_unavailable / confirmation_failed for genuine failures; the executor
  catches TransactionTimeout like QueryCanceled. Database-free tests through
  the public executor (9 of 11 fail on the previous code).
- Design §9.1 states cursor_tuple_fraction = 1 and force_custom_plan with
  their rationale and the healthy-transaction restore.
- The sweep docstring describes what it measures and what it does not.
- The reuse regression compares a Counter of called chunk ids with the
  expected Selection and Claimify rerun ids, one chunk per call.
- The BM25 margin domain is validated before the cursor opens.
- Review r3 copied; response added.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…on reads; sweep every sandbox catch (review r4)

_shared_snapshot and _pinned_generations answer statement_timeout for
57014/25P04 (cause kept) before their p1_unavailable / confirmation_failed
mapping; the executor's format_type fallback re-raises a budget error
instead of continuing in an aborted transaction. No other broad catch in
the query sandbox maps a budget error to another code. Database-free
public-executor tests for both SQLSTATEs at both points, with an
imported_snapshot double and non-budget controls (the four budget cases
fail on the previous bridge). Review r4 copied; response added.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…d classifier look-alikes (review r5 nit)

An uncached result-type OID whose format_type lookup hits 57014 or 25P04
answers statement_timeout with no row fetched (both fail with the re-raise
disabled). The classifier ignores timeout text in another error (raw and
wrapped), lock timeouts, a built-in TimeoutError and an implicit context,
and follows an explicit cause. Review r5 (approve pending the P1-6 owner
decision) copied.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
fazpu and others added 3 commits October 22, 2026 11:03
…S.11 follow-up (#508); post-merge gates

The owner (2026-10-22) replaced the blanket p95 ≈ 300 ms scaling criterion
with named size- and stratum-specific budgets measured at 300k chunks on the
final configuration, each paired with completeness (0 early stops), with the
public operation, corpus shape, machine and cache conditions, query
population and repetitions stated. Multi-second filtered reads are accepted
for now; 3M and 50M are ungated until measured; the 300 ms goal stays the
target for WP-RS.11 (immutable doc_id on search rows + re-tuned document
exact-tier threshold, issue #508, own gate). The paid LoCoMo gate and
WP-RS.0 are post-merge follow-ups. Reconciled in D142 (status accepted), the
binding P1 search design §9, the retrieval design's budget note, the plan
and the analysis.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
…he latency decision resolved (review r6)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xd3Dz4iq5SKNAJcefffvqF
@fazpu
fazpu marked this pull request as ready for review October 22, 2026 09:44
@fazpu
fazpu merged commit 05d412a into main Oct 22, 2026
22 checks passed
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.

Ranked search scans every chunk instead of using the BM25/vector index

1 participant