Skip to content

Lint: flag path-dependent negative greps in test scripts - #2348

Merged
remigiusz-antczak merged 2 commits into
mainfrom
fix/path-hermetic-lint-2
Nov 13, 2026
Merged

remigiusz-antczak merged 2 commits into
mainfrom
fix/path-hermetic-lint-2

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

Supersedes #2327, which conflicted with main. It also carried #2326's commit, and #2336 has since landed that change.

This is one squashed commit on current main. The lint now exempts the while-read strip that #2336 put in test-review-checks-scan-summary.sh: the strip may sit in a loop body when the redirect follows done. A strip that writes a different file still does not count. Before the fix, the new lint flagged main's own test.

Tests: 25/25 (6 lint unit tests, including the loop-body and strip-into-other-file cases, plus 19 scan-summary checks). The lint is clean over the repo. On the old lint, 2 of the 6 tests fail.

🤖 Generated with Claude Code

remigiusz-antczak and others added 2 commits November 13, 2026 12:32
A test that runs `! grep` for a path-segment word (worktrees, home, tmp, ...)
over a log holding absolute paths passes in CI but fails in a lane worktree,
because the checkout path contains the word. path_hermetic_lint.py flags that
in scripts/test-*.sh.

Each line is split on ; && || | outside quotes. In every segment starting with
`! grep`, any listed word appearing as a whole word in the literal (non-$var)
text is a hit, so a second grep on a line, unbalanced quotes, -e/-eX/--regexp=,
and -m N/-A N all flag. A hit is exempt only when the grep's input file (its
last arg) is written on that line or the previous one by a sed/replace that
uses $ROOT/$PWD; the strip may sit in a loop body (`while read ...; do
${l//"$ROOT"/}; done >f`), but a strip that writes a different file does not
count. The baseline is keyed on `path<TAB>stripped line text` and
messages print path:line, so a new offender in a baselined file fails. Two
reviewed offenders are baselined. Regression test covers each reviewer case.

Tests: 25/25 (6 path-hermetic lint unit tests, incl. loop-body strip and
strip-into-other-file cases, + 19 scan-summary checks); path_hermetic_lint over repo clean, no stale rows
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@remigiusz-antczak
remigiusz-antczak merged commit 0e535ed into main Nov 13, 2026
11 checks passed
@remigiusz-antczak
remigiusz-antczak deleted the fix/path-hermetic-lint-2 branch November 13, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant