Skip to content

refactor(scripts): parse the shard spec in one shared helper - #15490

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-15431-43137982666-1
Nov 12, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-15431-43137982666-1

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #15431

Summary

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

Moved parse_shard into a new scripts/lib/shard-spec.sh and made scripts/affected-tests.sh and scripts/run-plugin-tests.sh source it, removing the two copies. Behavior is unchanged: the lib body is the affected-tests.sh copy token for token, and the run-plugin-tests.sh copy's inline 10# form computes the same values once the regex has matched. Each script keeps its own error line and exit 2 for a rejected spec. The run-plugin-tests.sh comment on why shard_spec defaults to 0/1 moved onto that assignment. scripts/affected-tests.test.sh needed no change: its fixture is built with affected-tests.sh as the script under test, which now names shard-spec.sh, so fixture-tree's lib closure copies the lib for the hand-copied run-plugin-tests.sh too.

Not verified

  • The shell suites for these scripts (scripts/affected-tests.test.sh, scripts/run-plugin-tests.test.sh, scripts/plan-test-lanes.test.sh) were not run directly here; the lane runs only its named wrappers, so they are left to the PR's CI
  • ci-status green is a PR CI check, left to the PR's CI
  • Tidy not run: the change touches scripts/, a listed shared path
  • cant-fail-scan ran but reports whole-repo findings only in files this change does not touch; no test file was changed

Fix

  • scripts/lib/shard-spec.sh: new sourced-only library holding parse_shard, with the header comment the two copies carried
  • scripts/affected-tests.sh: sources lib/shard-spec.sh beside its other libs; inline parse_shard removed
  • scripts/run-plugin-tests.sh: sources lib/shard-spec.sh beside its other libs; inline parse_shard removed; the 0/1-default rationale comment moved onto shard_spec="0/1"

Verification

The runner ran each check from the base copy against 41f7b60:

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

The run reports:

  • check-changelog-fragments: all 5 fragments valid (no plugin changed, so no fragment owed)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 10 passed, 6 skipped over 3 changed files
  • fresh-context review subagent over the diff: no correctness problems; confirmed the lib matches both removed copies, is sourced before the only call site in each script (before the --worker early exit and argument parsing), the fixtures in affected-tests.test.sh and plan-test-lanes.test.sh pick up…
  • git-read diff --stat HEAD: 2 tracked files, 7 insertions, 30 deletions, plus the new 27-line lib
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43137982666

Left out: the items under Not verified.

Related

#15431

Merge-Risk: max=MEDIUM demote=false head=e1663d207f78cbfe681e395f3818641a1d95d0e7 rubric=8.4.8 rater=claude-opus-5-5 checker=claude-opus-5-5

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

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review: PR #15490 (head e1663d2)

No security issues found. This was a blocking-only review: the lane already reviewed the earlier head 41f7b604, so it would report only CRITICAL and IMPORTANT findings. It found none at any severity.

I read every hunk of all 3 changed files. The new head is a merge from main, and the PR's own diff matches what the earlier head reviewed.

  • scripts/lib/shard-spec.sh (new, sourced only): holds parse_shard. The regex ^[0-9]+/[0-9]+$ runs before 10#$i / 10#$n reach arithmetic expansion, so only digits ever get there. That rules out arithmetic or command injection through --shard. A rejected spec returns 1 and sets nothing, so it still cannot fall through to a "leg 0 of 1" run of every suite.
  • scripts/affected-tests.sh: sources the lib from $SCRIPT_DIR/lib/ with || exit 2, next to its existing libs, and drops its own copy of parse_shard. Behavior is unchanged.
  • scripts/run-plugin-tests.sh: sources the lib from $script_dir/lib/, next to its existing libs, and drops its inline copy. Once the regex has matched, the inline 10#${spec%%/*} form and the shared two-step form give the same values. The comment explaining why shard_spec defaults to 0/1 moved onto that assignment.

Scope checks:

  • None of the changed files is on a trusted path.
  • None is a trust control, merge hold, kill switch, token request or plugin manifest.
  • The diff deletes no standing instruction: only code comments moved.
  • The source paths come from each script's own directory, not from input a caller controls.

Prior findings: the lane's only earlier post is a summary with no findings (0 findings, 0 critical), so there is nothing to restate.

PR context: it holds no embedded text aimed at the lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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

Code review: no blocking findings (blocking-only review)

This lane already reviewed an earlier head (41f7b604), so this pass reports blocking findings only, and advisory findings are dropped. I read every hunk of all 3 changed files: scripts/lib/shard-spec.sh (new), scripts/affected-tests.sh and scripts/run-plugin-tests.sh. None of them is on a trusted path.

What I checked at this head

  • Same function as before. The new parse_shard in scripts/lib/shard-spec.sh matches the removed affected-tests.sh copy, with two SC2034 disables added. The removed run-plugin-tests.sh copy did the 10# step inline, which gives the same values once the regex has matched. So accepted and rejected specs (the empty spec included) and the resulting shard_index / shard_total are unchanged.
  • Sourced before use. Each script sources the lib before its only call:
    • affected-tests.sh sources it at L251 and calls parse_shard at L383.
    • run-plugin-tests.sh sources it at L150 and calls parse_shard at L316.
    • Each new source line follows its neighbours: || exit 2 in affected-tests.sh, none in run-plugin-tests.sh.
    • Each script still prints its own error line for a rejected spec.
  • Merge from main. The new head is a merge of main. The diff for this PR's 3 files is the same as at the head reviewed before.

Closing issue #15431, acceptance criteria

  • parse_shard exists once and both scripts use it: met.
  • Behavior unchanged: met, from reading the code.
  • Only the listed files are edited, within 400 lines and 15 files: met.
  • ci-status green: this lane cannot check it, so it is left to CI.

Not verified by me: I had no shell and ran no tests. The PR's verification claims come from the author and I have not confirmed them.

I found no embedded instructions in the PR context or the prior-findings file. The one earlier post from this lane is a no-findings summary, so nothing is restated here.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Verification evidence for e1663d2

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-15490-e1663d207f78cbfe681e395f3818641a1d95d0e7, expires on 2026-12-12.

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 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 12, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 12, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head e1663d207f78cbfe681e395f3818641a1d95d0e7. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 12, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 21e4df4 Nov 12, 2026
66 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15431-43137982666-1 branch November 12, 2026 06:16
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 21e4df47f2804d78c638276bdd5c2f949758c20a; 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.

Parse the shard spec in one shared helper

1 participant