Skip to content

feat(index): E26 file-level chunk augmentation behind flag (default OFF) - #73

Merged
ManSio merged 7 commits into
mainfrom
feat/e26-chunk-format
Oct 10, 2026
Merged

ManSio merged 7 commits into
mainfrom
feat/e26-chunk-format

Conversation

@ManSio

@ManSio ManSio commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

What

Phases 1–3 of the search-stack migration, all three behind default-OFF flags, so the production path is byte-identical without any env var:

  1. Phase 1 — E26 AST augmentation (src/core/indexing/chunk_augment.py): FILE/SYMBOLS/DOC prefix on chunks, parity 27/27 with the frozen E26 template, flag MSCODEBASE_AUGMENT_CHUNKS.
  2. Phase 2 — on-demand cosine rerank (src/core/search/ondemand_rerank.py): top-N fused candidates re-scored with live embeddings instead of stored vectors + BGE, flag MSCODEBASE_ONDEMAND_RERANK.
  3. Phase 3 — dense-off (measurement, not a deletion): flag MSCODEBASE_DENSE_OFF skips the dense stage, plus EXP-28/EXP-29 which decided the question.

Phase 3 conclusion: LanceDB stays. Quality without dense is unchanged (net +1 of 33 = noise) and the dependency analysis showed LanceDB is the chunk primary store, not a vector index — bm25.py:93 builds the BM25 index from table.to_pandas(), and only 5 of 52 table-API call sites in 13 src/ files are vector search. Removing it is a store migration, not cleanup.

Measured results

experiment question result
E26 does AST augmentation help? hit@1 8/17 → 10/17, MRR 0.659 → 0.709, zero regressions
EXP-28 can dense be switched off? A 11/33 hit@1 vs B 12/33, 0 errors both arms; 2 better / 1 worse / 30 same
EXP-29 do symbolic queries suffer without dense? NL 3/18 → 5/18, symbolic 8/15 → 7/15 (one lexical regression); speedup stable 7.2% / 7.9%

Two corrections worth reading:

  • EXP-28's published 18.0% speedup is retired — EXP-29 reproduced 7.2% and 7.9%; the old figure was inflated by one noisy run. Logged as a supersede entry, not a silent edit.
  • EXP-28 could not test its H5 hypothesis (no symbol/NL labelling, and labelling cannot be added after the run). EXP-29 froze the labelling rule first and closed it.

Verification

  • Local: 29/29 adjacent suites, ruff clean, clean-state 2052 passed / 0 failed.
  • This PR now runs the real CI (its base is main): ubuntu, windows, clean-state, manifest-parity, transport-equiv-e2e, CodeQL and the Analyze matrix — all green.
  • origin/main was merged in to resolve the conflict; the E24 fast-fallback try/except and the MSCODEBASE_DENSE_OFF condition were checked together by hand (auto-merge kept both correctly).

Safety

Every flag defaults to OFF and reloads from env through the same field(default_factory=...) pattern as the existing late_enrichment flag. No reindex is required. KNOWN_ISSUES.md was deliberately not touched (another session has uncommitted edits) — proposals live in experiments/e28_denseoff/PENDING_LEDGER.md.

Notes

Phase 1 of the approved stack migration. New pure helper chunk_augment.py (FILE/SYMBOLS/DOC = frozen E26 template, parity 27/27); single wiring point in index_parser.parse_one_file covering AST+fallback paths; MSCODEBASE_AUGMENT_CHUNKS default off (byte-identical output). Flip changes chunk_hash=sha256(text) so vectors recompute instead of going stale. Tests: test_chunk_augment.py 10/10 (template pin, flag on/off, wiring both modes); adjacent suites 47/47. No prod reindex triggered.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 39a9d284-3bfe-42a3-9090-1e4b5337826e

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Phase 2 of the approved stack migration (E25). New pure ondemand_rerank.py (cosine, stable ties, skips text-less); MSCODEBASE_ONDEMAND_RERANK (+TOP_N) config mirroring late_enrichment; hybrid hook reranks top-N fused pool with live embeddings INSTEAD of BGE only when flagged. Default OFF: prod path byte-identical. Tests: test_ondemand_rerank.py 6/6 exact math on fake vectors; adjacent 36/36. Live proof with flag: quality h1 3/10 h5 4/10 = baseline, rerank_timing.mode=ondemand_cosine in 1041ms; fast untouched.
Phase 3 as a measurement, not a deletion. Flag skips the whole dense stage (query embedding + LanceDB vector search); default OFF so the prod path is byte-identical.

EXP-28: frozen 33-case panel (sha256 f31e594e, union of three pre-existing frozen sets, frozen before the run), 2 runs per arm, same session and index.
A dense ON: hit1 11/33, hit5 15/33, 0 errors, mean 3359/3534ms.
B dense OFF: hit1 12/33, hit5 16/33, 0 errors, mean 3163/2492ms.
Per case 2 better / 1 worse / 30 same; speedup mean-of-means 18% but per-run spread 5.8-29.5%.
Verdict: H1/H2/H6 refuted as expected, H4 confirmed (0 errors), H3 PARTIAL, H5 untested (no symbol/NL labelling in the panel). Harness proven by a _vector_search_async call counter 1 -> 0 with the embedder alive.

Key finding: of 52 table-API call sites in 13 src files only 5 are vector search; bm25.py:93 builds BM25 from table.to_pandas(), so LanceDB is the chunk primary store, not a vector index. Dense removal NOT recommended; the flag stays as an operational kill-switch.

KNOWN_ISSUES untouched (foreign session edits it) - proposals in experiments/e28_denseoff/PENDING_LEDGER.md. Tests: 3 flag tests + adjacent suites 29/29, ruff clean.
MSCodeBase Agent and others added 4 commits October 10, 2026 18:11
…up claim

EXP-28 left H5 untested: no symbol-vs-NL labelling, and it could not be added after the run (freeze-before-look). This experiment freezes the labelling rule first (snake_case | CamelCase | pathy | single token -> symbolic 15 / NL 18, sha256 7639ba1b), then runs both arms twice.

A dense ON : NL 3/18 (16.7%), symbolic 8/15 (53.3%), 0 errors, mean 2559/2555ms
B dense OFF: NL 5/18 (27.8%), symbolic 7/15 (46.7%), 0 errors, mean 2375/2354ms
NL 2 better / 0 worse; symbolic 0 better / 1 worse (TR-P2). Speedup stable at 7.2% / 7.9%.

Verdicts: H1 CONFIRMED (symbolic loses exactly 1 of 15, within the declared tolerance), H2 REFUTED as expected (NL is better), H3 REFUTED as expected (7.5%, below 15%), H4 CONFIRMED (0 errors), H5 CONFIRMED against expectation (two NL cases improved).

CORRECTED: EXP-28 published an 18.0% speedup; two runs here show 7.2% and 7.9%. The old number was inflated by one noisy run (21% spread vs 0.2% here). Logged as a new entry with the supersede reference, not a silent edit.

Harness incident: the first run from the worktree printed hit1=0/33 with rc=0 and 167ms - a silent zero on an empty index (index is per-project-path). Guard added: all-empty exits 2, and the project root is an explicit manifest parameter. That run is not counted.

Phase 3 decision unchanged: no observed harm from dense, no proven gain (1-2 of 33 cases is noise), LanceDB stays as chunk primary store, the flag stays a kill-switch.
feat(search): MSCODEBASE_DENSE_OFF kill-switch + EXP-28 dense-off A/B
feat(search): on-demand cosine rerank path behind flag (Phase 2)
@ManSio
ManSio merged commit b62b80a into main Oct 10, 2026
12 of 13 checks passed
@ManSio
ManSio deleted the feat/e26-chunk-format branch October 10, 2026 18:41
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.

1 participant