feat(retrieval): graduate HRR structural-query lane onto production retrieve() (#1107 phase 5, #152) - #1117
Conversation
…phase 5 gate) Deterministic on-HEAD analogue of the #437 reproducibility-harness gate: a synthetic edge-connected corpus of <KIND>:<target_id> marker queries whose answers share no vocabulary with the marker string. recall@k 0.000 -> 1.000 (textual BM25 cannot reach a structural answer; the lane routes it exactly). CI-safe, no live-store content. Complements the existing tests/test_retrieve_v2_hrr_structural.py IT1-IT6 wiring tests.
…etrieve() (#1107 phase 5, #152) The #1107 shim now passes use_hrr_structural resolver-driven (None -> env->TOML->default-ON) instead of hard-off, so the marker-routed structural lane reaches the production retrieve() hook path. The resolver default was already True (v2.1, #154/#437 gate) so this is a single-step graduation. The lane is marker-routed: on any non-marker query parse_structural_marker returns None and the call falls through byte-identically, adding only one fast-failing regex to the non-marker hot path; the expensive HRR index build is gated behind a marker hit. SHIM_LANES mirrors the shim (four graduated lanes None, two held False) so retrieve() == retrieve_v2(**SHIM_LANES) stays a by-construction identity. test_shim_runs_graduated_lanes_others_off gains a fourth graduated-lane clause (structural marker over a CONTRADICTS edge) and keeps origin tie-break as the held-off proof. Full suite 5840 passed.
PR-size soft capThis PR is over the advisory size threshold:
Bigger PRs collide with more open work, which under the parallel-session workflow tends to produce repeated This is advisory only — nothing is blocked. If the size is intentional (large refactor, module removal, generated code), apply the |
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reviewer's GuideGraduates the HRR structural-query lane from staged to production by wiring it through the Sequence diagram for HRR structural-query lane on the production retrieve() pathsequenceDiagram
actor User
participant retrieve
participant resolver
participant retrieve_v2
participant parse_structural_marker
participant HRR_lane
User->>retrieve: retrieve(store, query)
retrieve->>resolver: resolve use_hrr_structural (env, TOML, default)
resolver-->>retrieve: use_hrr_structural (True/False)
retrieve->>retrieve_v2: retrieve_v2(store, query, use_hrr_structural)
alt use_hrr_structural is True
retrieve_v2->>parse_structural_marker: parse_structural_marker(query)
alt marker query
parse_structural_marker-->>retrieve_v2: marker
retrieve_v2->>HRR_lane: structural routing
HRR_lane-->>retrieve_v2: structural beliefs
else non-marker query
parse_structural_marker-->>retrieve_v2: None
retrieve_v2-->>retrieve_v2: [fall through to textual stack]
end
else use_hrr_structural is False
retrieve_v2-->>retrieve_v2: [skip structural lane]
end
retrieve_v2-->>retrieve: beliefs
retrieve-->>User: beliefs
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[claim:review:Setr:2026-07-07T17:14:08Z] |
|
Review: approve. This is the Phase-5 graduation I was about to build; it correctly builds on the #1107 characterization I posted earlier today and completes the cutover. Verified:
Epic disposition is accurate — Adding |
|
merge-train: merged 811140b → |
|
[release:review:Setr:2026-07-07T17:16:50Z] |
What
Graduates the HRR structural-query lane (
use_hrr_structural, #152) ontothe production
retrieve()path — the final staged lane in the #1107 cutover.The shim now passes
use_hrr_structural=None(resolver-driven: env → TOML →default-ON) instead of hard-off, so a production host runs the lane the moment
its resolver says on. The resolver default has been
Truesince v2.1(#154/#437 gate), so this is a single-step graduation.
Why it's safe
The lane is marker-routed.
retrieve_v2calls_route_structural_query→parse_structural_marker(query), which returnsNonebefore any index buildunless the query starts with an exact
<KIND>:<target_id>marker (e.g.CONTRADICTS:<id>). On any natural-language query — the only kind theUserPromptSubmithook,context_rebuilder, andmcp_servercallers issue —the lane is a pure pass-through: one fast-failing regex, then
None, then thebyte-identical legacy path. The expensive HRR index build is gated behind a
marker hit.
Characterization evidence (epic #1107, 2026-07-07):
queries (spine corpus, 10k beliefs).
TEMPORAL_NEXT:<id>marker returned 0 hitswith the lane off (textual match on the literal string) vs 50 hits on.
Changes
src/aelfrice/retrieval.py— shim flipsuse_hrr_structuralFalse → None;comments move it from held-off to graduated (four graduated lanes now, two
held).
tests/test_retrieve_v2_equivalence.py—SHIM_LANESmirrors the shim soretrieve() == retrieve_v2(**SHIM_LANES)stays an identity by construction;test_shim_runs_graduated_lanes_others_offgains a fourth graduated-laneclause (structural marker over a
CONTRADICTSedge), keeping origintie-break as the held-off proof.
benchmarks/hrr_structural_ablation.py— deterministic on-HEAD analogue ofthe [v2.0] Reproducibility harness —
benchmarks/results/v2.0.0.jsonis canonical,uv sync && aelf bench all#437 gate: synthetic edge-connected<KIND>:<target_id>marker corpuswhose answers share no vocabulary with the marker string. recall@k
0.000 → 1.000 (textual BM25 cannot reach a structural answer; the lane routes
it exactly). CI-safe, no live-store content.
docs/user/CONFIG.md,CHANGELOG/v3.md— record the graduation.Epic disposition
This is Phase 5, the last staged pack-touching lane. With it merged, the
#1107 cutover is complete:
entity-persist demotion (Entity-persistence demotion prior: a deterministic organic sink for coordination junk (follow-up to #1086/#1081) #1096, Phase 3), intentional clustering ([v2.0] Intentional clustering — co-locate related beliefs for multi-fact coherence #436,
Phase 4), HRR structural ([retrieval] HRR structural-query lane (bind/probe over outgoing edges) #152, Phase 5).
(recall-neutral eval: run the deferred +HRR-expand ablation arm on the #977 canonical sweep (gated on edge-type expansion) #1001).
Production
retrieve()now converges onretrieve_v2with every valuable lanelive and the refuted/neutral lanes explicitly held off.
Closes #1107.
Refs #152.
Summary by Sourcery
Graduate the HRR structural-query lane onto the production retrieve() path as the final phase of the #1107 cutover while keeping non-marker queries behavior byte-identical.
New Features:
<KIND>:<target_id>marker queries.Enhancements: