9a81f9eaf7
Records the ratified naming decisions (Lexical/Hybrid, c/a kept as input aliases, diagnostics string free to change — no downstream consumer) and the bite-sized rename task list for the implement step. refs #2 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3.5 KiB
3.5 KiB
Plan — Rename Mode variants A/C to self-describing names (closes #2)
Context
The retrieval-mode enum uses opaque single letters Mode { C, A }
(src/model.rs). Neither the identifier nor the CLI token --mode a
conveys intent. The letters trace the design ledger's three-stage axis
(docs/specs/2026-05-18-…:60-63): C = lexical baseline (BM25 + tag
filter, offline), B = generative rerank (reserved, NOT in scope,
no enum variant), A = hybrid (lexical ∪ semantic → RRF → rerank).
Ratified decisions (resolved during this iteration)
Mode::C → Mode::Lexical,Mode::A → Mode::Hybrid(maps onto the glossary one-line definitions).- CLI canonical tokens:
lexical/hybrid. Keepc/aas accepted input aliases (zero-cost backward compatibility; no external consumer exists, but it protects typed-by-hand invocations). - Diagnostics
modestring (format!("{:?}", mode)in src/pipeline.rs) may change freely to"Lexical"/"Hybrid": verified no downstream consumer parses it. doctate is the future integrator and embeds the library (theModeenum), not the JSON string (spec §103). - The reserved generative tier keeps conceptual room: a future
Mode::Generativedoes not collide withLexical/Hybrid.
Tasks (one cohesive rename — review as a unit)
-
Enum + parser (src/model.rs)
- Rename variants
C → Lexical,A → Hybrid. FromStr: canonical"lexical"/"hybrid"; keep"c"/"a"as accepted aliases (case-insensitive, as today). Unknown → same error.
- Rename variants
-
CLI (src/bin/alpha_id.rs)
--modedefault_value"c"→"lexical"on bothSuggestandEval.eval --mode bothexpansionvec![Mode::C, Mode::A]→vec![Mode::Lexical, Mode::Hybrid].
-
Pipeline (src/pipeline.rs)
- Match arms
Mode::C/Mode::A→Mode::Lexical/Mode::Hybrid. - Rename private methods
collect_mode_c → collect_lexical,collect_mode_a → collect_hybrid, and update their doc comments and the inline "Mode C/A" comments to the new names. (Leavingcollect_mode_cbehind aMode::Lexicalarm would reintroduce the exact opaqueness this issue removes.)
- Match arms
-
Tests
git mv tests/pipeline_mode_c_tests.rs tests/pipeline_lexical_tests.rsand…mode_a_tests.rs → …hybrid_tests.rs; updateMode::C/Mode::Aand anymode_c/mode_atest-fn names inside to the new names.- tests/model_tests.rs: update the parse assertions to the new
variants; add an assertion that the
c/aaliases still parse (to the new variants) so the alias contract is pinned.
-
Glossary (docs/glossary.md) — record-reality update
- Headings
### Mode C→### Mode Lexical,### Mode A→### Mode Hybrid. Move the old letter forms into the Avoid lines (Mode C,Modus C,mode c, etc.). - Update the cross-references that name "Mode A"/"Mode C" in the RRF, rerank, vector_index, and degrade entries.
- Headings
-
Spec synopsis (docs/specs/2026-05-18-…:200,202)
--mode c|a→--mode lexical|hybridon both synopsis lines. In-place token edit only; the surrounding German prose is pre-existing and out of scope to translate.
Acceptance
cargo buildandcargo testgreen.alpha-id suggest --mode lexical/--mode hybridwork;--mode c/--mode astill accepted (alias); default islexical.- No
Mode::C/Mode::A/collect_mode_[ca]/### Mode C|Areferences remain anywhere in src, tests, or docs (except as Avoid synonyms in the glossary).