Merged
Conversation
…, so a filtered run reported files as unparsed that were never offered to the parser (#374) `transcripts_parsed` is now taken before the filter, so `transcripts_found - transcripts_parsed == len(unreadable_files)` unconditionally. Making the two agree is only half of it: on its own it erases the fact that a filter ran, so the filtered subset is reported as its own number in three states -- `transcripts_matched_agent_filter` is null when no filter was applied, an integer when one was, and 0 is a real finding. `agent_filter` echoes the filter. Measured against this machine's real transcript tree: a filtered run reported 160 of 489 parsed with unreadable_files empty; it now reports 489 parsed and 160 matched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HuQoqn4iLmW2ULpvhKnwj
…te claim (#374 review) Review finding: the docstring and README claimed three states for `transcripts_matched_agent_filter` without saying they are the `measured` state's three. In `no-transcripts-found` the key is absent (as `transcripts_parsed` already was), so a caller using `.get()` saw None -- which the prose defined as "no filter was applied" -- while `agent_filter` said one was. Prose corrected in both places and the shape pinned by a test with a populated control. A contract pin, not a regression: the code already behaved this way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015HuQoqn4iLmW2ULpvhKnwj
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.
scripts/transcript_refusals.pyapplied the--agentfilter before computingtranscripts_parsed, so a filtered run reported files as unparsed that were never offered to the parser.Reproduced first
Three clean synthetic transcripts, one matching the filter, against the code at
be36015:The issue was found with three synthetic transcripts and was not run against a real transcript directory. It was here, and the real figure is the argument for the fix: against this machine's own
~/.claude/projects/-Users-…-claude-osstree,--agent oss:developerreported 160 of 489 parsed withunreadable_files: []— 329 files rendered as parse failures, none of which failed.The judgment call, stated
The issue offered two fixes and they are not equivalent. Moving the filter below the count makes
foundandparsedagree, but it destroys the information that a filter ran at all: a filtered run and an unfiltered one over the same directory then render identically apart from aggregates nobody compares. Both halves are taken here.transcripts_parsedis the count of files the parser actually read, taken before the filter, sotranscripts_found - transcripts_parsed == len(unreadable_files)holds unconditionally. The gap can now only mean parse failures, and they are always named.transcripts_matched_agent_filterisnullwhen no filter was applied (there was no question), an integer when one was, and0is a real finding meaning it matched nothing.agent_filterechoes the filter itself.After:
Tests
Red first, four failures on the counting (
assert 1 == 3,assert 0 == 3). Green after:37 passedin the module,2615 passed, 2 skippedfor the full suite.The fixture is three transcripts with a filter matching one, with two controls in the same fixture as the issue asked: an unfiltered run over the same three proving
foundandparsedstill agree, and a file that genuinely cannot be parsed provingunreadable_filesstill fills under a filter. A third control covers a file that cannot be opened —chmod 000, in its own test so its skip cannot swallow the deterministic assertions, with the deny confirmed by attemptingPath.read_text(the exact callanalyze_transcriptmakes) rather than trusting the mode bit, and skipping loudly with what went untested when it does not take.Review
One reviewer finding, fixed in
12c88ae: the new field's prose claimed three states without saying they are themeasuredstate's three. Inno-transcripts-foundthe key is absent (astranscripts_parsedalready was), so a consumer using.get()sawNone— which the prose defined as no filter was applied — whileagent_filtersaid one was. Corrected in the docstring and the README, and the shape pinned by a test with a populated control. Labelled as a contract pin rather than a regression: the code already behaved this way.The auditor returned no findings across four classes.
Closes #374
Verified by the maintainer
Independent red re-run: this branch's
tests/test_transcript_refusals.pyonorigin/mainin adetached worktree, product code untouched.
Five, where the report says four — and the difference is not a disagreement. The author ran the
new tests targeted with the rest deselected; this is the whole module, so it also catches the
contract-pin test added during review. Recorded because two numbers for one run would otherwise read
as one of them being wrong later.
The
chmod 000case skipped here rather than asserting, and its skip names what went untested inits own words, which is the behaviour that arm was written for.