Repository navigation
Fix the retrieval baseline tool, and capture spec 009's before state - #254
Merged
Merged
Conversation
Spec 009 T002 says capture the retrieval baseline before any code change. The
tool could not run, and when it ran it measured something that would not survive
the next release.
**It crashed.** `client_settings=chroma_settings` passed the factory rather than
calling it. `chroma_settings` used to be a constant and became a function --
because langchain_chroma mutates the Settings it is given, so a shared object
leaks one store's persist directory into the next -- and this call site was not
updated. Nothing exercises this tool, so it has been broken silently since.
**Then it recorded unstable identities.** `doc_id` prefers a Reactome stable id
and falls back to a row number, with the docstring "Reactome stable IDs survive a
bundle rebuild; row numbers do not". Measured: 1000 of 1000 BM25 ids were
row-based while all 1000 vector ids were stable, because the tool built BM25 from
a plain CSVLoader, whose documents carry only {row, source}. A bundle rebuild
happens every release, so a before/after comparison spanning one would have shown
spurious total disagreement on the BM25 half.
That is the same defect as the application had, in a third caller -- the pattern
the website session named this morning, and the reason I now grep for the shape
rather than fixing the instance I was shown. Same fix: MetaDataCSVLoader with the
columns read from the header.
After: 1000 of 1000 BM25 ids stable, matching the vector side.
before.json captures 20 questions across all five collections, which is the
comparison collection routing will be measured against.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Starting spec 009 the way its own task list says (T002) and Principle II requires: measure before changing anything. The measurement tool turned out to be broken in two ways.
It could not run
chroma_settingsused to be a constant and became a function — becauselangchain_chromamutates the Settings it is given, so a shared object leaks one store's persist directory into the next. This call site was never updated. Nothing exercises this tool, so it has been broken silently since that refactor.Then it recorded identities that do not survive a release
doc_idprefers a Reactome stable id and falls back to a row number, with the docstring:Measured against its own output:
st_id✓row:✗Because it built BM25 from a plain
CSVLoader, whose documents carry only{row, source}. A bundle rebuild happens every release, so a before/after comparison spanning one would have shown spurious total disagreement on the BM25 half — and spec 009's entire method is before/after comparison.That is the same defect the application had, in a third caller. It is the pattern the website session named this morning — a second caller kept doing the wrong thing after the first was fixed — and the reason I now grep for the shape rather than fixing the instance I was shown. Same fix:
MetaDataCSVLoaderwith columns read from the header.After: 1000 of 1000 BM25 ids stable, matching the vector side.
The baseline
specs/009-collection-routing/before.json— 20 questions across all five collections (complexes,disease_variants,ewas,reactions,summations), bm25 and vector separately, at k=10. That is what collection routing will be measured against.Context
I marked spec 009 done earlier today and was wrong — corrected in #253. Source routing landed; collection routing did not, and
retrieve_documentsstill searches all five collections for every question. This is the first real step on it.ruff, mypy, full suite with no API keys set.
🤖 Generated with Claude Code