Skip to content

ADR-051: change keys that ignore line endings and slice positions (B-054, B-048, B-034) - #91

Merged
ethanblauw-hub merged 7 commits into
masterfrom
feature/adr-051-stable-change-keys
Oct 20, 2026
Merged

ethanblauw-hub merged 7 commits into
masterfrom
feature/adr-051-stable-change-keys

Conversation

@ethanblauw-hub

Copy link
Copy Markdown
Collaborator

Implements ADR-051 (backlog B-054, B-048 fix 1, B-034 tier 1).

What changes

  • The file key ignores line endings (B-054). It is the MD5 of the bytes with \r\n and \r normalized to \n, so an LF-only file hashes as before. Git mode keeps the blob id.
    • Existing indexes re-key in place once, marked by index_meta.file_key = "md5-lf". Nothing is re-embedded or re-summarized.
  • CHUNKER_VERSION is not bumped (§2). No chunk's text changes, and a bump would tell every user to run a full rebuild for nothing.
  • Summary keys and the summarizer's input drop the slice position (B-048 fix 1). The header's (Part i/N) becomes (Part).
    • Existing caches carry over through a one-time re-key, marked by index_meta.summary_key = "no-lines-no-part".
    • The embedded and stored text is unchanged.
  • An edited file's unchanged tier-1 chunks keep their vectors (B-034 tier 1). The vector is reconstructed from the FAISS id map just before the purge and reused when the chunk id and chunk_text_hash match. The vectors-equal-rows invariant (ADR-037) is kept.

Tests

  • Full suite: 745 passed, 1 skipped (with ADR-055 merged in) (Windows, CPU). flake8 clean. Conformance, resolution and L5X teeth baselines all hold.

Still open (left in the ADR)

  • Measure the summarizer input change on a GPU.
  • Reuse summary vectors too.
  • Re-run the replay with the real tokenizer.

🤖 Generated with Claude Code

claude and others added 7 commits October 20, 2026 20:03
Proposed design for B-054, B-048 fix 1 and B-034 tier 1.

Co-Authored-By: Claude <noreply@anthropic.com>

[ADR-051]
B-054: a checkout whose line endings differ from the indexed one no longer
reprocesses those files. md5_file normalizes \r\n and a lone \r to \n, as
both readers already do for the text they chunk, so chunks and summary keys
were never affected; only the file key was. An LF-only file hashes as
before.

An index built before this re-keys in place on its first run: a file whose
stored hash is the raw MD5 of its current bytes gets the new key without
being re-indexed. index_meta.file_key marks the index done. Git mode keeps
blob ids as its file key.

Co-Authored-By: Claude <noreply@anthropic.com>

[ADR-051 src/incremental_indexer.py src/source.py]
B-048 fix 1, as ADR-029 designed it: summary_cache_key and the text sent to
the summarizer turn a slice header's (Part i/N) into (Part), so adding or
dropping a window no longer re-summarizes every slice whose code did not
move, and a cached summary cannot quote a stale position. The embedded and
stored text keep the part number.

Existing caches carry over the way ADR-045's did: the one-time re-key now
copies each indexed chunk's summary from whichever older key it has to the
new one, under index_meta.summary_key = "no-lines-no-part".

Co-Authored-By: Claude <noreply@anthropic.com>

[ADR-051 src/db.py src/incremental_indexer.py]
B-034, tier 1: before a modified file's vectors are purged, its tier-1
vectors are read back from the FAISS id map with their chunk_text_hash. A
re-ingested chunk with the same id and hash gets that vector instead of an
embedding; a moved symbol keeps its vector and gets its new line range.
Vectors are still added in _write_plan, before the file's rows, so vectors
equal rows and the overlapped build writes the same bytes as the serial one.
Summary vectors and tiers 2/3 are embedded as before.

Co-Authored-By: Claude <noreply@anthropic.com>

[ADR-051 src/incremental_indexer.py]
Co-Authored-By: Claude <noreply@anthropic.com>

[ADR-051]
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

[ADR-051]
…ble-change-keys [ADR-051 src/hybrid_retriever.py src/iterative_retriever.py]
@ethanblauw-hub
ethanblauw-hub merged commit 15c37d9 into master Oct 20, 2026
6 checks passed
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.

2 participants