Skip to content

refactor(scripts): simplify affected-tests.sh without changing its behavior - #14394

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14348

Summary

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

Simplified scripts/affected-tests.sh through /simplify's checks, keeping its behavior byte-for-byte: select_for's R5 and R6 frontier seeding now share one loop that appends each source and its copies in the original order, the stderr list loops (deleted, UNMAPPED, NOT RUN) became single guarded printf calls, build_sync_map's skip test folds the case statement into one [[ ]], parse_shard combines its two range checks and drops a redundant return 0, and colocated_suites drops an empty-array guard on an array that is never empty. The --help header (lines 2-236, printed by usage) and the cd "${AFFECTED_TESTS_ROOT:-...}" line the replay rewriter keys on were left untouched, and the need_value comment now names its fourth argument. This is an uncommitted working-tree change, left for the runner to turn into a patch.

Not verified

  • tidy: skipped because the change is under scripts/, a listed shared path for the tidy cutoffs
  • scripts/affected-tests.test.sh and the other suites that exercise the selector were not run as a test suite in this lane (only the lane's check-affected wrapper ran); left to the PR's CI
  • The review subagent could not run git ls-files, so its check that no new token is a tracked basename used Glob over the files on disk

Fix

  • scripts/affected-tests.sh: merged the duplicated R5/R6 frontier seeding in select_for into one loop (same frontier order); replaced three echo loops with guarded printf calls (same bytes); folded build_sync_map's *.test.sh case into the -f test; combined parse_shard's range checks and dropped its…

Verification

The runner ran each check from the base copy against 2093faf:

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

The run reports:

  • check-changelog-fragments: All 39 changelog fragment(s) under .changes/ are valid (scripts/ is not a plugin, so no fragment is owed)
  • check-changed-skills: no changed skills under plugins/*/skills/, nothing to gate
  • check-affected: 10 passed, 6 skipped over 1 changed file
  • grep of .test. files for the script's function names and changed message prefixes: no test asserts on the edited lines
  • fresh-context review subagent over the whole diff: no behavior change found in any hunk (frontier order, printf vs echo output on guarded non-empty arrays, set -u safety, parse_shard return status, and no new token naming a tree file)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42569824336

Left out: the items under Not verified.

Related

#14348

Merge-Risk: max=MEDIUM demote=false head=2093faf7adc32082db17490ecc24d8de411a00c0 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 2093faf7adc32082db17490ecc24d8de411a00c0: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14394

No security issues found.

I read all 7 hunks of the only changed file, scripts/affected-tests.sh. It matches none of the trusted-path globs. The change is a behavior-preserving refactor of the test selector:

  • parse_shard: the two range checks are now one ((n >= 1 && i < n)) check, and a redundant return 0 is gone.
  • build_sync_map: the *.test.sh skip moved into the [[ -f ]] test.
  • colocated_suites: the empty-array guard is dropped. The candidates array is a literal list, so it is never empty.
  • select_for: the R5 and R6 frontier seeding now share one loop. frontier is still a fresh local -a frontier=() at L1081, so changing = to += carries nothing over from one seed to the next.
  • stderr lists: three echo loops became printf calls with the same output.

None of these touches a secret, a token, a trust control, a merge hold or a kill switch. No untrusted input reaches a shell evaluation in a new way: the new code adds no eval and no unquoted expansion of external text. Under-selecting tests would be a correctness concern for /review:code-review, not a security path.

No userConfig keys or manifests changed, so there are no manifest lines. The pull request text contains no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14394 (refactor of scripts/affected-tests.sh)

I found nothing to block or flag. I read all 6 hunks of the one changed file and checked each against the code around it at head. I did not run the script or its tests.

  • parse_shard (L292-L303): the two checks ((n >= 1)) and ((i < n)) become one ((n >= 1 && i < n)), which accepts and rejects the same inputs. Dropping return 0 is safe because the last statement is a plain assignment, which returns 0. The caller at L397 still gets the same status.
  • build_sync_map: [[ -f "$script" && "$script" != *.test.sh ]] is a direct replacement for the -f test plus the case statement. The unquoted right-hand side of != inside [[ ]] is still a pattern match.
  • colocated_suites (L1047-L1063): candidates always starts with six literal entries, so the plain "${candidates[@]}" expansion is safe under set -u.
  • select_for (L1095-L1106): the frontier order is unchanged. Before and after, it is the seed, then the seed's copies, then each sync-script source followed by that source's copies. frontier and line are both locals that start empty (L1081-L1082), so appending in place of the old frontier=("$seed") carries nothing over from an earlier seed. Empty lines are still skipped, and the :- defaults keep set -u happy when a key is missing.
  • stderr lists (deleted, UNMAPPED, NOT RUN): each printf sits inside a ${#arr[@]} -gt 0 guard, so the list is never empty. The format strings are fixed and the file names go in only as %s arguments, so the output bytes match the old echo loops.

Closing issue #14348:

  • "Behavior is unchanged": met, from reading the code. No added test would catch a regression, but this criterion is about keeping existing behavior, which the repository's existing suites already exercise.
  • "The diff edits only the listed files": met, since only scripts/affected-tests.sh changes.
  • 400-line / 15-file limit: met, with one file changed.
  • "ci-status is green": the author claims it and I could not check it. The PR body says scripts/affected-tests.test.sh was not run in the lane and was left to CI.

No .claude/rules/ rule file's paths: glob matches scripts/*.sh. No plugin manifest changed. Neither the PR context nor the prior-findings file contains embedded instructions, and this lane has no earlier findings on the PR.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 9, 2026
@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 8ee4b23 Nov 9, 2026
81 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14348-42569824336-1 branch November 9, 2026 08:02
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 8ee4b23ae05799f05fbc8c9c27de46e8809b3acc; 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.sh repository script

0 participants