fix: harden extractTouchedFiles bash-redirect parsing — junk tokens in the partial narrative (#87) - #95
Merged
Conversation
…n the partial narrative (#87) Root cause of the #87 garbling: the redirect/tee heuristic captured any token containing / or . — so ">" characters inside quoted strings, heredoc bodies, and echoed code text yielded junk ("cache.load(name,,", "[...active],,"), and the char class also swallowed trailing punctuation from code-y commands ("/tmp/e2e-out.txt),"). The budget-cut framing was incidental; the junk accumulated because the affected task was E2E-heavy. New shapeToken filter: strip wrapping quotes, trim trailing punctuation, require a real path shape (contains "/", dotted filename, or leading-dot file), and exclude /dev pseudo-devices (/dev/null was silently listed as a touched file before — arguably wrong too). extractTouchedFiles is now exported + unit-tested (6 tests pin the verbatim reported junk tokens, punctuation trimming, quote unwrapping, and the /dev/null exclusion).
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.
Closes #87.
Root cause
The garbled "Files modified before the cut" list was not a truncation artifact — the bash redirect/tee heuristic in
extractTouchedFilescaptured any token containing/or., so>characters inside quoted strings, heredoc bodies, and echoed code text yielded junk (cache.load(name,,,,[...active],,), and the char class swallowed trailing punctuation from code-y commands (/tmp/e2e-out.txt),). The budget-cut framing was incidental: the affected task was E2E-heavy (lots of heredoc bash), so the junk accumulated.Fix
New
shapeTokenfilter on every redirect/tee capture:'/tmp/x.txt',)/, dotted filename (name.ext), or leading-dot file (.gitignore)/dev/*pseudo-devices —/dev/nullwas silently listed as a touched file beforeextractTouchedFilesis now exported + unit-tested (7 tests pin the verbatim reported junk tokens). The advisory-only nature of the list bounds all heuristic trade-offs (nothing is written from these names; controllers re-inspect).Deliberately out of scope (issue suggestion 1 — an injected final state-note turn): a larger engine change (the session is already disposed at the budget branch); happy to see it re-filed standalone if wanted.
Verification
810/810 tests (+7), typecheck clean. Review: approve (regression audit incl. globs/env-var targets, claude-path parity,
m[1]guards).