Background
PR #139 review finding [WARN-2]: The mut array regex />/ matches any command containing >, including benign uses like echo "version > 2" or commands with > inside quoted strings.
PR #139 amplified this by adding review_state reset on mutating bash commands (line 1024). Now harmless commands can falsely invalidate review state.
Fix
Tighten the > pattern to only match file redirects, not > inside quotes:
- Option A:
/>(?!\s*&)(?!\s*\/)(?!.*['"].*>.*['"])/ — exclude fd redirects and quoted strings
- Option B: Use a simple heuristic — split on unquoted
|/&&/; first, then check each segment
Acceptance Criteria
Source
PR #139 review comment [WARN-2], pre-existing amplified by review_state reset
Background
PR #139 review finding [WARN-2]: The
mutarray regex/>/matches any command containing>, including benign uses likeecho "version > 2"or commands with>inside quoted strings.PR #139 amplified this by adding
review_statereset on mutating bash commands (line 1024). Now harmless commands can falsely invalidate review state.Fix
Tighten the
>pattern to only match file redirects, not>inside quotes:/>(?!\s*&)(?!\s*\/)(?!.*['"].*>.*['"])/— exclude fd redirects and quoted strings|/&&/;first, then check each segmentAcceptance Criteria
echo "version > 2"does NOT trigger mut detectiongcloud list --format=json 2>&1does NOT trigger mut detectionecho test > file.txtDOES trigger mut detectionsed -i 's/old/new/' fileDOES trigger mut detectionSource
PR #139 review comment [WARN-2], pre-existing amplified by review_state reset