Skip to content

feat(retrieval): composition plumbing — flag policy + placeholder flags + telemetry (#232) - #234

Merged
robotrocketscience merged 3 commits into
mainfrom
feat/composition-tracker-v1.5
Apr 28, 2026
Merged

feat(retrieval): composition plumbing — flag policy + placeholder flags + telemetry (#232)#234
robotrocketscience merged 3 commits into
mainfrom
feat/composition-tracker-v1.5

Conversation

@robotrocketscience

Copy link
Copy Markdown
Owner

Closes #232.

Implements the v1.5 retrieval composition plumbing split off from #154 (#154 retargeted as the v1.7 default-on-flip tracker).

What ships

Three atomic commits:

  1. refactor(retrieval): rename bm25f_enabled -> use_bm25f_anchors per #154 flag policy
    Standardises the v1.5 flag-name surface on use_<lane>_<modifier>. Renames kwarg / TOML key / helper across retrieve(), retrieve_with_tiers(), retrieve_v2(), RetrievalCache.retrieve. AELFRICE_BM25F env var unchanged. [retrieval] Augmented BM25F (incoming-edge anchor text) + vectorized BM25 sparse matvec #148 just shipped so no released-flag breakage.

  2. feat(retrieval): placeholder flags + per-lane telemetry
    Four placeholder flags (default-OFF, no-op): use_signed_laplacian, use_heat_kernel, use_posterior_ranking, use_hrr_structural. Setting any true in .aelfrice.toml emits one stderr warning per process per flag, naming the flag and the tracker issue. Adds LaneTelemetry dataclass + last_lane_telemetry(); populated in retrieve() / retrieve_with_tiers() with one assignment each.

  3. test: composition-tracker placeholder flags + LaneTelemetry
    8 deterministic tests: warner once-per-process idempotency, empty-TOML quiet, explicit-False quiet, PLACEHOLDER_FLAGS regression guard, LaneTelemetry populates for FTS5 default + use_bm25f_anchors=True, posterior_weight round-trip.

Acceptance (per #232)

  • AC1: rename complete across all four surfaces ✅
  • AC2: four placeholder flags resolve through env > kwarg > TOML > default ✅
  • AC3: stderr warning idempotent per flag per process ✅
  • AC4: LaneTelemetry populates for both L1 lanes + posterior round-trip ✅
  • AC5: byte-identical regression tests preserved (full suite was green at HEAD pre-rebase: 1471 pass / 4 skip; this PR rebases onto current main clean and CI staging-gate revalidates).

Out of scope

Note on rebase

Branch was 6 commits behind main after #211 / #221 / #231 / #202 / #210 / #209 landed. Rebased onto github/main with no conflicts. Force-pushed.

… flag policy

The v1.5.0 composition tracker (#154) standardises retrieval
feature-flag names on the use_<lane>_<modifier> form. Rename:

- kwarg bm25f_enabled         -> use_bm25f_anchors
- TOML key  bm25f_enabled     -> use_bm25f_anchors
  (constant BM25F_FLAG holds the new value; ENV_BM25F unchanged
  since the env-var name AELFRICE_BM25F still cleanly maps)
- helper is_bm25f_enabled()   -> resolve_use_bm25f_anchors()
- retrieve_v2 use_bm25f       -> use_bm25f_anchors (was already
  inconsistent with the other surfaces)

#148 just landed in v1.5; no released users have the old flag
name yet so a one-shot rename without an alias is safe. The
default-OFF contract is unchanged.

Tests + bm25.py docstring updated. Full suite green
(1463 pass / 4 skip).
…ope)

The v1.5.0 composition tracker stands up the unified retrieve()
flag-resolution surface ahead of the v1.6 / v1.7 component waves:

Placeholder flags (default-OFF, no-op at v1.5.0):

- use_signed_laplacian   -- v1.6 (issue #149)
- use_heat_kernel        -- v1.6 (issue #150)
- use_posterior_ranking  -- v1.6 (issue #151) -- partial form already
                            shipped as posterior_weight at v1.3.0;
                            this placeholder reserves the full name
                            for the v1.6 composition wave
- use_hrr_structural     -- v1.7 (issue #152)

Setting any placeholder True in [retrieval] of .aelfrice.toml emits
a once-per-process stderr warning naming the flag and #154; no
behavioural change. The fail-soft contract matches the rest of the
config surface (malformed TOML never raises, just traces).

Per-lane telemetry surface:

- LaneTelemetry dataclass: locked / l25 / l1 / bfs counts (post-
  dedupe), bm25f_used (was the BM25F lane the L1 implementation),
  posterior_weight (resolved value).
- last_lane_telemetry() returns the LaneTelemetry of the most
  recent retrieve() / retrieve_with_tiers() call in this process.
- Populated at the end of both retrieve() and retrieve_with_tiers()
  with one assignment each. Zero overhead.

Consumers: aelf doctor (v1.5.x surface), the v1.6+ benchmark
gates that flip use_signed_laplacian / use_heat_kernel etc.
default-on per their owning issues.

No default-on flip in this PR. The benchmark gate that flips
use_bm25f_anchors default-on lands separately once we have data.
tests/test_composition_tracker.py:

- Placeholder warner emits one stderr line per use_<lane> flag
  set to true in .aelfrice.toml; the warning names the flag and
  references #154.
- Warner is idempotent within a process (already-warned flag
  produces no new line on a second call).
- Empty TOML produces no warnings; explicit False on a flag
  produces no warning either.
- PLACEHOLDER_FLAGS constant matches the four v1.6/v1.7 lane
  names (regression guard against accidental drift).
- LaneTelemetry populates correctly for the FTS5 default lane,
  flips bm25f_used=True when use_bm25f_anchors=True is opted
  in, and round-trips the resolved posterior_weight.

8 deterministic tests, all in-memory store. Full suite green
(1471 pass / 4 skip).
@robotrocketscience
robotrocketscience merged commit c2b4fcb into main Apr 28, 2026
8 checks passed
@robotrocketscience
robotrocketscience deleted the feat/composition-tracker-v1.5 branch April 28, 2026 21:06
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.

[v1.5] Retrieval composition plumbing — flag policy + placeholder flags + per-lane telemetry

1 participant