Skip to content

fix(ci): run selected Node package suites in check-affected --tests instead of passing them - #10418

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-8814-40441460431-1
Oct 27, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-8814-40441460431-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Refs: #8814

Summary

Opened by the work-resolve-issue lane. The run's own summary:

check-affected.sh --tests used to treat affected-tests.sh exit 3 (selected suites it does not run) as a pass. Now affected-tests.sh writes those suites to a --write-not-run file. check-affected runs the ones under a package in scripts/outside-node-packages.txt through scripts/run-outside-node-suites.sh --paths, the runner CI's test-node lane uses, so a failing one fails tests. Any selected suite still unrun makes tests a SKIP that counts it, through the existing run_check skip path, never a pass.

Remaining work

  • Host run (host-run label): time scripts/check-affected.sh --tests on a branch that touches .github/scripts/pr-unblock/dispatch.mjs, before and after this fix, and record both against #8757's budget.

Not verified

  • The changed suites scripts/check-affected.test.sh and scripts/affected-tests.test.sh were not executed: this lane's Bash runs only the named wrappers, none of which runs a test suite. The PR's CI shell-test lane runs them, so whether the new cases pass, and whether the planted Node case fails agains
  • Host run from the issue's decision (host-run label): time scripts/check-affected.sh --tests on a branch touching .github/scripts/pr-unblock/dispatch.mjs, before and after this fix, and record both against #8757's budget. It needs a real branch and wall-clock timing on a host, which this lane cannot
  • No case for the npm/jq-missing branch of check-affected's affected(): removing npm from PATH in the fixture would also remove the directory that holds bash and git on most hosts.

Fix

  • scripts/affected-tests.sh: new --write-not-run FILE (only with --run). It empties FILE up front, then writes each selected suite that --run did not execute, one per line. The usage header documents it.
  • scripts/check-affected.sh: affected() passes --write-not-run and, on exit 3, sorts each listed suite. A suite under a registered Node package runs through run-outside-node-suites.sh --paths, and its failure fails tests. A .test.js/.test.mjs beside a .test.sh wrapper counts as run (rule R9), and a pa
  • scripts/check-affected.test.sh: the affected-tests stub now writes STUB_NOT_RUN to its --write-not-run file. The fixture carries the real run-outside-node-suites.sh, lib/read-list.sh, a registered pkg/demo and an exclusions list. New cases: unrun suites give a counted SKIP, not a pass; an exit 3 nam
  • scripts/affected-tests.test.sh: the '--run refuses to guess a runner' case still asserts exit 3 with NOT RUN. It now also checks that --write-not-run replaces a stale file with the unrun suite, comes back empty after a shell-only run, and is a usage error without --run.

Verification

The runner ran each check from the base copy against 96b45ad:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • .lane/checks/bin/check-changelog-fragments: 'All 8 changelog fragment(s) under .changes/ are valid.' (no fragment is required for root scripts/ changes)
  • .lane/checks/bin/check-affected: '9 passed, 5 skipped over 4 changed files', including shellcheck, shell-portability, exec-bit, changelog-fragments, changelog-parity and machine-specific-paths on the four changed scripts. The skips were markdown, validate-plugins, ruff and changed-skills (no such fi
  • .lane/verify/bin/cant-fail-scan --file scripts/check-affected.test.sh --check: PASS, no gating findings
  • .lane/verify/bin/cant-fail-scan --file scripts/affected-tests.test.sh --check: PASS, no gating findings
  • fresh-context subagent review of the whole diff: no bugs. It raised two risks: jq was not checked before the runner, and excluded eval-fixture paths would become permanent skips. It also raised nits on the missing-tool skip message, an untested truncation path and an undocumented relative-path base.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40441460431

Left out: the items under Not verified.

Related

#8814

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 96b45ad9178eaff5232d4e327876d9f76e5d6a1f: 0 finding(s), 0 as inline comments.

No security issues found in this pull request.

critical-findings: 0

Scope: four developer-tooling shell scripts and their tests (scripts/affected-tests.sh, scripts/check-affected.sh and the two .test.sh files). None match a trusted path. The diff touches no trust control, workflow, manifest, instruction surface or .github/ file, so there are no manifest <field> lines.

  • Execution surface. check-affected.sh now hands selected Node suites in packages listed in scripts/outside-node-packages.txt to run-outside-node-suites.sh --paths, which runs npm test there. The old path already ran PR-controlled .test.sh suites through affected-tests.sh --run. The new path runs only packages from the repository's registered list, so it adds no new class of execution. I also read the runner's cd "$pkg" && npm test call and the npm ci --ignore-scripts call for file: dependencies.
  • Pattern matching. The exclusion and package matching quote their variables ("$ex"*, "$pkg"/*), so a suite path cannot inject glob patterns.
  • Temp files. $out.not-run and $out.node derive from mktemp, and the trap cleans them up.
  • --write-not-run FILE. The file path is caller-supplied on the command line, so it opens no cross-trust-boundary write.
  • Fail-closed behaviour. An exit 3 that names no unrun suite, unreadable lists, or missing npm or jq all become a SKIP or failure. They no longer count as a pass. This narrows an old pass-through rather than widening one.

Cost: no billed resources or paid settings are involved. The changes add some local test runtime only, and the planned timing run on a host is a measurement, not a charge.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 96b45ad9178eaff5232d4e327876d9f76e5d6a1f: 0 finding(s), 0 as inline comments.

No findings. I read the full diff and the surrounding code in scripts/check-affected.sh, scripts/affected-tests.sh, scripts/run-outside-node-suites.sh and scripts/lib/read-list.sh. I did not run any suite; the author's verification claims are unverified here.

What I checked in the changed code:

  • Paths: affected-tests.sh does its cd to the repo root (line 225) before argument parsing. The relative-FILE rule in the usage text holds, and check-affected.sh passes absolute $out.* paths anyway.
  • Foreign trees: in a snapshot or foreign tree, check-affected skips tests entirely (line 539). The runner's cd "$(dirname "$0")/.." therefore always runs against the same tree as affected-tests.sh, so the Node package suites run in the checked tree.
  • Classification vs the runner:
    • Exclusion prefix matching is the same as in run-outside-node-suites.sh.
    • The .test.js / .test.mjs plus .test.sh wrapper rule matches affected-tests.sh rule R9, which also covers only those two.
    • A .test.cjs beside a wrapper, a *.Tests.ps1 suite, or a path under one of the four sub-projects is counted as not run. The runner treats those as owned elsewhere. This errs toward a counted SKIP, never a false pass, so I did not flag it.
  • Exit codes:
    • A failing package suite returns 1, so tests fails.
    • An exit 3 with an empty list, an unreadable list file, or missing npm/jq gives a counted SKIP (exit 2) rather than a pass.
    • read_list::into accepts --comments inline, and ${arr[@]+...} guards keep set -u safe.
  • --write-not-run: it is empty up front, written only from the delegated list, and rejected without --run. The new affected-tests.test.sh cases cover the stale-content, empty-file and usage-error paths.
  • Tests: the stub and fixture setup in check-affected.test.sh match the real runner's cd behaviour. The planted failing and passing Node cases are consistent with the code path.

Gaps the author already disclosed, not counted as findings:

  • The missing-npm/jq branch has no test case.
  • The host timing run is still to do.

No closing issue is listed in the PR context beyond the Refs: #8814 mention, so I had no acceptance criteria to check. There is no embedded imperative text in the PR body. I found no spend beyond prepaid or subscription usage, and no hold.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 96b45ad9178eaff5232d4e327876d9f76e5d6a1f.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 6c4e881 Oct 27, 2026
43 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-8814-40441460431-1 branch October 27, 2026 05:02
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.

0 participants