Skip to content

fix(ci): the shell check lists only tracked files - #9286

Merged
kixelated merged 1 commit into
mainfrom
fix/shell-check-tracked-files
Nov 21, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/shell-check-tracked-files

Conversation

@kixelated

@kixelated kixelated commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The merge queue dropped moq-dev/moq#9251 on a shell check failure that had nothing to do with it (job):

open infra/nix/node_modules/.bun-tmp-57a271e920280c3f/dist/src: no such file or directory
In bench/browser/run.sh line 20: SC1091 (info): Not following: ../../test/lib/harness.sh was not specified as input
In bench/browser/run.sh line 97: SC2153 (info): Possible misspelling: HARNESS_RUN may not be assigned.

sh/shell.sh walked the whole tree with shfmt -f . and then kept the tracked results. The workers check runs bun install alongside it, and bun creates and removes a temporary directory under the untracked infra/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. Without test/lib/harness.sh in it, shellcheck flagged bench/browser/run.sh.

Approach

  • List candidates with git ls-files -z, skip tracked files deleted from the worktree, and pass the rest to shfmt -f to pick out the scripts. shfmt never walks a directory, so untracked trees can't race it. This also replaces one git ls-files --error-unmatch per 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:

  • On a clean tree, the old and new listings find the same 190 scripts, and sh/shell.sh check passes.
  • With an untracked directory the walk can't open (infra/nix/node_modules/.bun-tmp-probe, mode 000, standing in for one that vanishes), the old script fails with open infra/nix/node_modules/.bun-tmp-probe: permission denied and the new one passes.

Impact

  • CI and just check/just fix: the shell check no longer reads untracked directories. No change to which scripts it lints.
  • Public API, wire: none.

🤖 Generated with Claude Code

Review

Rewritten by quest review after 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-df85bce14c7b

  • Reviewer: Codex, gpt-6.1-sol, high effort

  • Session: 01a1fc12-96f8-7621-b386-707a50d5c52d, round 1

  • Score: 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

`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>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8c3d2f9f-7d91-40cb-b667-46b8a942464f
Commits

Reviewing files that changed from the base of the PR and between 3728b96 and 825099c.

Files selected for processing: 1

  • sh/shell.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 one git ls-files --error-unmatch call per script with a single listing.
  • Listing failure propagates: wait "$!" after the shfmt -f=0 process substitution surfaces its exit status under set -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.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit b4496b1 Nov 21, 2026
7 checks passed
@kixelated
kixelated deleted the fix/shell-check-tracked-files branch November 21, 2026 03:18
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