Repository navigation
fix(ci): the shell check lists only tracked files - #9286
Conversation
`sh/shell.sh` walked the whole tree with `shfmt -f .` and kept the tracked results. A concurrent `bun install` creating and removing a temporary directory under an untracked `node_modules` stopped the walk early, and the process substitution hid shfmt's failure, so the check linted a partial set. Without `test/lib/harness.sh` in it, shellcheck flagged `bench/browser/run.sh` and the merge queue dropped an unrelated PR. Ask shfmt about `git ls-files` instead, and fail if the listing fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound. Listing candidates from git ls-files -z and handing them to shfmt -f keeps shfmt from walking untracked trees, which removes the race at its source. wait "$!" also stops a failed listing from silently linting a partial set.
Reviewed changes
Reviewed the single changed file, sh/shell.sh.
- Tracked-only listing: candidates come from
git ls-files -z, and tracked files deleted from the worktree are skipped with[[ -f $file ]]. This replaces onegit ls-files --error-unmatchcall per script with a single listing. - Listing failure propagates:
wait "$!"after theshfmt -f=0process substitution surfaces its exit status underset -e.
I didn't run the script. The PR description reports 190 scripts found by both the old and new listings on a clean tree.
claude-sonnet-5-5 | 𝕏

Problem
The merge queue dropped moq-dev/moq#9251 on a shell check failure that had nothing to do with it (job):
sh/shell.shwalked the whole tree withshfmt -f .and then kept the tracked results. The workers check runsbun installalongside it, and bun creates and removes a temporary directory under the untrackedinfra/nix/node_modules. When that directory vanished mid-walk, shfmt stopped early. The process substitution hid shfmt's exit status, so the check linted a partial list. Withouttest/lib/harness.shin it, shellcheck flaggedbench/browser/run.sh.Approach
git ls-files -z, skip tracked files deleted from the worktree, and pass the rest toshfmt -fto pick out the scripts. shfmt never walks a directory, so untracked trees can't race it. This also replaces onegit ls-files --error-unmatchper script with a single call.wait "$!"on the listing's process substitution, so a failed listing fails the check instead of linting a partial set.Verified:
sh/shell.sh checkpasses.infra/nix/node_modules/.bun-tmp-probe, mode 000, standing in for one that vanishes), the old script fails withopen infra/nix/node_modules/.bun-tmp-probe: permission deniedand the new one passes.Impact
just check/just fix: the shell check no longer reads untracked directories. No change to which scripts it lints.🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: 825099c
Base: origin/main at 3728b96
Risk: medium,
The shell lint command could select the wrong files or fail for contributors and CI, changing existing behavior, but reverting the script fully undoes the change.Classified: medium by Codex, gpt-6.1-sol, low effort, session
01a1fc12-7de7-7511-ad2d-df85bce14c7bReviewer: Codex, gpt-6.1-sol, high effort
Session:
01a1fc12-96f8-7621-b386-707a50d5c52d, round 1Score: 9/10,
No actionable defects were found: tracked-file listing avoids transient untracked directories and explicit waiting propagates shfmt listing failures, though validation was static only.Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none