Skip to content

refactor(scripts): simplify affected-tests-live.sh - #14377

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14347-42569815100-1
Nov 9, 2026
Merged

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

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14347

Summary

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

Simplified scripts/affected-tests-live.sh without changing what it checks or prints. It now changes to the repo root once instead of prefixing every command with cd "$REPO_ROOT" &&. A select_for helper replaces eight copies of the selector call plus its RC=$? line. The sync manifest is read once instead of once per loop pass. The single-element wf_yaml array and its loop became a scalar and an if/else, and two single-use helpers (contains, contract_suite) are inlined. Every path the script spells is kept, since scripts/affected-tests.sh selects suites by spelled paths (R3).

Not verified

  • Did not run scripts/affected-tests-live.sh itself or shellcheck on it: this lane's Bash runs only the named wrappers. check-affected lists the selector-live gate as CI only, so the PR's lint-repo job runs it.
  • Tidy skipped: the change is under scripts/, a listed shared path, so the tidy cutoffs exclude it.
  • No changelog fragment: scripts/ is repository tooling, not a plugin, so no plugin release record applies.
  • ci-status green is left to the PR's CI.

Fix

  • scripts/affected-tests-live.sh: cd to the repo root once; added the select_for helper; read the sync manifest once before the copy-set loop; replaced a case statement with a [[ ]] test; turned the .github YAML probe from an array and two loops into a scalar, a while-read loop and an if/else;…

Verification

The runner ran each check from the base copy against fd6ef5f:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

Left out: the items under Not verified.

Related

#14347

Merge-Risk: max=LOW demote=false head=fd6ef5f4b0ab487a603e33aecc220b794527366a rubric=8.1.2 rater=claude-opus-5-5 checker=claude-opus-5-5

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed fd6ef5f4b0ab487a603e33aecc220b794527366a: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14377 (refactor(scripts): simplify affected-tests-live.sh)

I found no security issues.

The PR changes one file, scripts/affected-tests-live.sh, a CI test script that checks the affected-test selector against the live repository. I read every hunk.

  • Trusted paths: none. The file matches no listed glob, and it is not a trust control, merge hold, token or kill-switch path, plugin manifest or instruction surface.
  • What changed: the script now does cd "$REPO_ROOT" || exit 1 once, where it used to put cd "$REPO_ROOT" && in front of each command. A select_for helper replaces the repeated bash scripts/affected-tests.sh ...; RC=$? pairs. --print-manifest is now read once before the loop instead of on every pass. The wf_yaml array and its loops became a scalar and an if/else, and the contains and contract_suite helpers were inlined.
  • Data flow: every argument still comes from tracked repository files (git ls-files) or from paths spelled in the script. Expansions stay quoted, so this adds no new injection surface. No secrets, tokens, permissions, external sources or untrusted PR or issue text reach the script.
  • Behavior: the one fail-fast addition (|| exit 1 on the cd) only makes the script stricter. Nothing that used to fail now passes.

The PR context file contains no embedded directives aimed at this lane. No prior findings exist (0 earlier heads), so this was a full review, not a blocking-only one.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed fd6ef5f4b0ab487a603e33aecc220b794527366a: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #14377, refactor(scripts): simplify affected-tests-live.sh

Scope: full review of the one changed file, scripts/affected-tests-live.sh. I read every hunk in the diff, the whole file at head, and the harness it sources (scripts/lib/test-harness.sh).

Result: no findings.

I checked each refactor against the base behavior:

  • Single cd "$REPO_ROOT". It runs after SELF_DIR, REPO_ROOT and the harness source are resolved, so nothing before it depends on the caller's directory. In the old code, cd X && a | b | c ran the whole pipeline (including the [[ -e "$pat" ]] and glob checks) from the repo root. The new code does the same. [[ -e "$file" ]] now replaces [[ -e "$REPO_ROOT/$file" ]] and resolves to the same path.
  • select_for helper. It sets the same globals (out, RC) with the same 2>/dev/null redirect. The --explain case, which captures with 2>&1, correctly stays inline. The script runs under set -uo pipefail without -e, so moving the capture into a function changes no exit-on-error behavior.
  • Sync manifest read once. The ok message still prints $manifest with the same value, and the later for manifest in … loop reassigns it. On failure, stderr from a failing --print-manifest now prints once instead of three times. This only happens on a failing run and changes no assertion result.
  • Case statement → [[ … ]] && continue, and dropping live_out="". Same behavior: the assignment always runs, and -e is not set.
  • wf_yaml array → scalar plus while read over the process substitution. It picks the same first candidate, keeps the same .github/workflows/* exclusion, and prints the same ok/fail text. git grep -q does not read stdin, so the loop's input is safe.
  • contains and contract_suite inlined. The suite path scripts/validate-plugin-contracts.test.sh is still written out literally in the assertion, so renaming the suite still fails this case. Nothing else in the repo uses either name.
  • The script still ends with test_harness::report, as the harness suite requires.

Closing issue #14347, acceptance criteria:

  • Behavior unchanged: met as far as I can tell from reading the code (see above). I did not run the script; I had no shell.
  • Diff edits only the listed files: met. Only scripts/affected-tests-live.sh changes.
  • Within 400 changed lines / 15 files: met.
  • ci-status green: the PR's own CI decides this. The author says they did not run the selector-live gate (bash scripts/affected-tests-live.sh) or shellcheck, and that the lint-repo job runs it. I have not verified this.

The PR description's verification results (check-affected, changelog-fragment and changed-skills checks) are as the author reported them; I did not re-run any of them.

No embedded instructions in the PR context. No prior findings from this lane, and this is not a blocking-only review. No manifest, paved-path or cost items apply.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head fd6ef5f4b0ab487a603e33aecc220b794527366a, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for fd6ef5f

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-14377-fd6ef5f4b0ab487a603e33aecc220b794527366a, expires on 2026-12-09.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 48c356e Nov 9, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14347-42569815100-1 branch November 9, 2026 06:55
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 48c356ed8ad7c7828f986c4bc37ceb95570ac8b0; later checks count it verified from this comment.

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.

Simplify the affected-tests-live.sh repository script

0 participants