Segment merge, durable serialization, and reusable execution infrastructure #18
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.75) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.75 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.075
Real PR Conversation Timeline
1 comments
"Review active on #18"
general
weight: 0.35
waywardmonkeys
What
Eight commits, each one idea, resequenced so the branch can be reviewed a commit at a time.
Reading order
| # | Commit | What to look for |
|---|---|---|
| 1 |
test(leit_index): create test segment files with tempfile| Pre-existing cleanup, first because everything after it inherits the habit. The mmap tests composed temp paths from pid + clock + counter and deleted the file at the end of the test body; nowTempDirgives uniqueness from an exclusive create by the OS and cleanup on drop, including on panic. Net −35 lines. || 2 |
feat(leit_text): add analysis schema identity| The shared primitive.AnalysisSchemaId+ schema-awareFieldAnalyzersaccessors, factored out ahead of both consumers. || 3 |
feat(leit_index): merge segments deterministically| Merge policy, input validation, deterministic doc-id remap planning, merge execution, and a scoring oracle proving a merged segment scores identically to its sources. || 4 |
feat(leit_index): serialize merged segments durably| On-disk form for compressed segments, rebuilt block metadata, and postings-encoding validation on full open. Ends with a merge → serialize → reopen → rescore round trip. || 5 |
docs: design reusable execution infrastructure| Design and staged plan, committed before the implementation so commits 6–7 read against a stated intent. || 6 |
test(index): add reference oracle and allocation measurement| The apparatus, before any optimization: a naive reference execution index used as a correctness oracle (with a feature-boundary test that compiles a consumer crate to provebench-internalsdoes not leak), plus a scoped allocation counter so tests assert exact allocation budgets. || 7 |
feat(index): reuse execution allocations across queries| The optimization:finish_intofor top-k sinks, a reusable preplanned execution scratch onExecutionWorkspace, and compressed decode scratch moved out of the cursor. Each step pinned by the counter from commit 6, results held constant by the oracle. Ends with recorded allocation baselines. || 8 |
feat(query): typed query pipeline|plan_program/search_program. |On commit 7
Planner::plan_programlowers aUserQueryProgramdirectly to anExecutionPlan;ExecutionWorkspacegainsplan_program/search_programalongside the textual variants, andleit_indexre-exports the builder types so consumers need no directleit_querydependency.Motivation: callers routing natural-language prose through the textual parser hit hard parse failures on operator-looking input — colons read as field qualifiers, stray parens. A typed program lets a front-end guarantee totality on arbitrary user input and treats the string syntax as one client among several. Downstream consumer: graphrag-rs builds
UserQueryProgramfrom a total parser and callssearch_program; that change rides separately in its own repo.boost default_boostcomposition are literally the same code on both paths. Parity is pinned by plan-equality and end-to-end hit-equality tests.max_depth/max_nodesguards as the textual path. Depth uses an iterative tri-color DFS with memoized depths: linear on shared-child DAGs, rejects over-deep chains mid-traversal instead of overflowing, and rejects cyclic hand-built arenas.QueryError::InvalidBoost. The textual path cannot produce these inputs, so this surface is typed-path-only.The textual parser is untouched.
Verification
cargo fmt --all --check,taplo fmt --check,cargo clippy --workspace --all-targets --all-features --locked, andcargo test --workspace --locked --all-features. The branch is bisectable and each commit satisfies the repo's formatting and lint rules on its own, not just at the tip.prek run --all-files --hook-stage pre-push: 21/21 hooks pass, includingcargo fmt,taplo fmt, all four clippy variants,--doc, andcargo doc.Changes since the previous push
Relative to the previous push of this branch (
03083893), three fixes, each folded into the commit that introduced the affected lines rather than added on top:1.
cargo fmt --checkfailed on the previous head —pub useordering inleit_index/src/lib.rsplus call formatting inplanner.rs,program_search.rs,plan_program.rs.2.
taplo fmt --checkfailed — three feature arrays needed sorting inleit_wind_tunnelandleit_wind_tunnel_query.3. A real test bug in
reference_feature_boundary: the temp directory was built by hand from pid +as_nanos(), but both tests in that file run in parallel in the same process*, so when they started inside one clock tick they got the identical path — one test then read the other'smain.rswhile the other'sDropdeleted the tree mid-build. Now usestempfile::TempDir, so uniqueness comes from an exclusive create by the OS rather than from a name predicted out of the process id and the clock, and cleanup survives a panicking test.tempfilewas already inCargo.locktransitively viaproptest, so this adds no new crate to the build graph. Separately, the nestedgenerate-lockfilecall now sets its ownCARGO_TARGET_DIRinstead of inheriting an ambient one.The same hand-rolled helper existed in
leit_index/src/segment_format/mmap.rsonmain. That is fixed here too, in commit 1.Provenance
Implemented and reviewed with LLM assistance under red-first TDD; an independent cross-model review produced three robustness findings in the typed query work — parser recursion bound, DAG traversal memoization, boost validation — all fixed and covered by tests here.