Adversarial review: two implementations, and one that could ask nothing - #273
Merged
Merged
Conversation
adamjohnwright
force-pushed
the
010-t020-review
branch
from
September 20, 2026 02:30
8a8db2e to
a09b5c5
Compare
Three findings on the expansion switch. I wrote the rule twice -- once for the sync path, once for the async -- in a file that already carries a note about those two drifting. Worse, the test written to catch that drift cannot: `test_sync_async_equivalence` drives `retrieve_documents` directly, *below* the expansion step, so a divergence here would have been invisible to it. One `_queries` now serves both, with a test asserting the source keeps it that way, because the behaviour is only equal while the code is shared. `include_original=False` -- which is `from_subdirectory`'s default -- together with zero alternates produced an empty query list, and retrieval with no queries returns nothing at all. A retriever that finds nothing reads exactly like a question that has no answer, which is the worst available way for a recall mechanism to fail. `_queries` never returns empty now: it falls back to the original question and says so. And my own "falls back loudly" test asserted only the fallback value, so it would have passed against a silent one. That is the vacuous shape that bit the collection guards this morning, written by me a few hours after fixing them. It asserts the warning now. Verified beyond the unit tests: `answer-sweep` 13/13 after the refactor, so the shared path retrieves what the two separate ones did. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
adamjohnwright
force-pushed
the
010-t020-review
branch
from
September 20, 2026 02:41
a09b5c5 to
2f2c8e0
Compare
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.
Follow-up review of #272. Three findings.
Two implementations of one rule
I wrote the expansion rule twice — once for the sync path, once for the async — in a file that already carries a note about those two drifting. Worse, the test written to catch that drift structurally cannot:
test_sync_async_equivalencedrivesretrieve_documentsdirectly, below the expansion step.One
_queriesnow serves both, with a test asserting the source keeps it that way — the behaviour is only equal while the code is shared, so that is the thing worth pinning.A configuration that asks nothing at all
include_original=False— which isfrom_subdirectory's default — plus zero alternates produced an empty query list, and retrieval with no queries returns nothing. A retriever that finds nothing reads exactly like a question with no answer, which is the worst available way for a recall mechanism to fail._queriesnever returns empty now: it falls back to the original question and logs that it did.My own test was vacuous
The "falls back loudly" test asserted only the fallback value, so it would have passed against a silent fallback. That is the same shape that bit the collection guards this morning — written by me a few hours after fixing those. It asserts the warning now.
Verified beyond the unit tests
answer-sweep13/13 after the refactor, so the shared path retrieves what the two separate ones did.584 passed, 1 skipped; mypy over 149 files, ruff clean.
🤖 Generated with Claude Code