Repository navigation
fix(ci): install npm dependencies before check-affected runs suites - #9682
Conversation
…suites scripts/check-affected.sh --tests now runs npm ci at the root and in .github/standards/runner-policy when that tree has a package.json and no node_modules, so a fresh worktree's first verify run passes. A failed install fails the run with the command named. CI lanes run npm ci first, so there node_modules exists and nothing installs. Fixes #9122 Co-Authored-By: Claude Opus 5.5 <[email protected]>
check-affected.sh --tests now calls scripts/setup-env.sh --node instead of its own npm ci loop, so the lockfile-hash stamp also reinstalls a stale node_modules after a lockfile change. --node runs only setup-env's Node step, which now runs npm ci under nice with --no-audit --no-fund and names each install. A failed run fails check-affected with that command named and runs no suite. Refs #9122 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n suites A missing npm or nice (exit 127 or 2) is a tool that could not run, which check-affected's contract makes a SKIP, not a failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-review reviewed No findings. I read the full diff and the PR context, and checked the changed code against the surrounding
Design note, not a finding: the install runs before test selection, so a fresh worktree pays for No |
|
claude-security-review reviewed I found no security issues in this pull request. The diff has four files:
critical-findings: 0 |
Closes #9122
Summary
A fresh worktree's first
scripts/check-affected.sh --testsrun failed on missing npm packages (htmlhint at the root,yamlunder.github/standards/runner-policy), not on the change, so each fresh worktree lost a verify cycle. That happened at least eight times across 2026-10-22 to 2026-10-24.Fix
scripts/setup-env.shgets--node, which runs only its Node step:npm ciin the root and runner-policy trees when thepackage-lock.jsonhash stamp is missing or stale. That step is now a function the full run also calls, withniceand quiet npm flags.scripts/check-affected.sh --testscallsbash scripts/setup-env.sh --nodeonce before the suites. A failed install fails the run naming that command and skips the suites; one that could not run (npm or nice missing, exit 127 or 2) is a SKIP and the suites still run, per the script's could-not-run contract. A tree with a current stamp installs nothing. A tree installed by plainnpm cihas no stamp and reinstalls once; no CI job runscheck-affected --testsorsetup-env --nodetoday.Verification
bash scripts/check-affected.test.sh: 54 passed, 0 failed. npm is stubbed, and the cases cover missing, current, stale lockfile, failed install, and setup-env that could not run (that case fails without the fix).node --test scripts/setup-env.test.mjs: 17 passed. The 4 new or changed cases fail against main'ssetup-env.sh.check-affected.sh --testsin the fresh worktree installed both trees and passed (10 passed, 4 skipped, 56 s with the install); a second run installed nothing. shellcheck is clean.scripts/setup-env.test.mjskeeps its existing space indentation, which Biome would rewrite throughout; that is unrelated to this change.Related
setup-env.shrun used by thepr-run-activity-read/writeworkflows: same installs, plus quiet flags and one "installed" log line per tree.🤖 Generated with Claude Code