Skip to content

refactor(scripts): simplify five check scripts without changing behavior - #14385

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14353

Summary

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

Simplified the five listed check scripts and kept their outputs, exit codes, flags and exports the same. In check-detector-eval-coverage.sh, scan_emits is now one shfmt | jq pipeline (pipefail still fails it when either tool fails) instead of three temp files with cleanup on every branch, eight separate mktemp files share one temp directory, the argument check is one test, and discovery's glob loop lost two redundant guards. The other four lose duplicated checks: a repeated extension list, a repeated fileURLToPath call, an awk BEGIN block that only zeroed variables, two UNARGUED tests merged into one if/else, a separate error counter and its second if, and a guard and manual counter in the case-collision pass. While reading I noticed check-discriminating-test-skips.sh prints a single-line if ...; fi finding twice. I kept that, because fixing it would change the printed text.

Not verified

  • The co-located test suites (scripts/check-*.test.sh, check-declared-prerequisites.test.mjs) were not run: this lane cannot run them, so the PR's CI runs them
  • Tidy not run: the change is under scripts/, a listed shared path
  • Known rare differences in failure paths only: scan_emits now returns shfmt's or jq's own non-zero code instead of 1 (both callers test only pass or fail), and jq could add one stderr line if shfmt ever printed non-JSON before failing
  • ci-status green is left to the PR's CI

Fix

  • scripts/check-declared-prerequisites.mjs: one SELF constant for the module path; usesOf computes the PowerShell extension test once and folds the block-comment branch into one condition; drops a needless template literal
  • scripts/check-detector-eval-coverage.sh: one usage check; scan_emits is a single shfmt | jq pipeline with no temp files; working files live in one mktemp -d directory with one trap; qualifying_detectors drops a redundant directory test and a case statement
  • scripts/check-detector-findings-crosswalk.sh: removes an awk BEGIN block that only zeroed variables; merges the two test-cell checks into if/else if
  • scripts/check-discriminating-test-skips.sh: removes the errors counter and its second if by printing findings and the trailer in one block; one-line is_any_skip
  • scripts/check-docs-naming.sh: the docs/ and non-docs exemptions sit in one if/else; the fold and duplicate passes share one guard; printf replaces a per-element loop; a for ((...)) loop replaces a while loop with a manual counter

Verification

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

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

The run reports:

  • .lane/checks/bin/check-affected: 10 passed, 6 skipped over 5 changed files (run again after the last edit)
  • .lane/checks/bin/check-changelog-fragments: all 4 fragments valid; scripts/ is not a plugin, so it needs no fragment
  • .lane/checks/bin/check-changed-skills: no changed skills
  • Fresh-context review subagent, hunk by hunk against HEAD: found no behavior difference you could hit in practice; it flagged one stale comment ('Returns 1 when...' in scan_emits), now fixed
  • Grep of the co-located tests: check-docs-naming.test.sh parses the EXEMPT_NAMES line, which is unchanged, and check-declared-prerequisites.test.mjs imports main and usesOf, whose signatures are unchanged
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42570394074

Left out: the items under Not verified.

Related

#14353

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

Security review: PR #14385

No security issues found.

I read every hunk of all 5 changed files. The PR refactors repository lint/check scripts without changing behavior. None of these files matches a trusted-path glob. None is a trust control (trusted-trigger, token broker, kill switch, merge hold), a plugin manifest or a standing instruction surface.

What I checked:

  • scripts/check-detector-eval-coverage.sh: scan_emits is now a single shfmt | jq pipeline. The script still sets set -uo pipefail (L252), so a shfmt failure still fails the function, and a registered detector still turns that into exit 2. The working files now sit in one mktemp -d directory that an EXIT trap removes. The paths stay private and are not predictable, and no new input reaches a shell. The argument check still rejects extra words and unknown modes with exit 2.
  • scripts/check-declared-prerequisites.mjs: the module path is computed once as SELF, and the PowerShell block-comment handling is the same logic folded into one condition. No new input handling.
  • scripts/check-detector-findings-crosswalk.sh, scripts/check-discriminating-test-skips.sh, scripts/check-docs-naming.sh: the control flow is restructured but the gate outcomes are the same. The docs-naming exemptions still continue under the same conditions, just in a different order. The skip checker still exits 1 on any finding. No user-controlled data reaches a command or path in a new way.

The PR description and closing-issue context hold no embedded directives aimed at the review.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14385, simplify five check scripts

No findings. I read every hunk in all 5 changed files and found no change in behavior that any caller or input could hit.

What I checked, file by file

  • scripts/check-declared-prerequisites.mjs
    • The powershell flag gives the same shellish set as the old extension list.
    • The block-comment branch is now gated on powershell &&, which is the same as the old nested if.
    • found is now declared after the early callUses return. Nothing reads it before then.
    • SELF replaces two fileURLToPath(import.meta.url) calls.
    • details[0] is always a string because addGap only stores strings, so dropping the template literal changes nothing.
  • scripts/check-detector-eval-coverage.sh
    • The script runs under set -uo pipefail (line 252), so the shfmt | jq pipeline still fails when either tool fails.
    • Both callers only test pass or fail: line 534 sets count=0 and line 577 exits 2. So it doesn't matter that $scan_tmp is now truncated when shfmt fails.
    • The files in the temp directory are no longer pre-created. Each one is written before it is first read (lines 581 and 595–599), and report/advisory are created explicitly.
    • In qualifying_detectors, dropping the -d guard is safe: an unmatched glob fails the -f test.
    • The combined argument check accepts and rejects the same argv as before.
  • scripts/check-detector-findings-crosswalk.sh
    • Without the BEGIN block, the variables start uninitialized, which awk reads as 0. That is how END uses them (!seen_header, rows == 0, errors > 0, %d).
    • The merged if/else if gives the same result as the two old tests.
  • scripts/check-discriminating-test-skips.sh
    • The errors counter was used only here. A non-empty $out always produced at least one line, so the trailer and exit 1 behave the same, on the same stream and in the same order. The exit runs in the main shell, not a subshell.
  • scripts/check-docs-naming.sh
    • Every exemption branch is a continue with no side effects, so their order doesn't matter.
    • printf '%q\n' given many arguments prints the same lines as the old loop, including when the array is empty.
    • The for ((…)) loop has no continue in its body, so it counts the same way as the while loop.
    • The EXEMPT_NAMES line the co-located test parses is unchanged.

Closing issue #14353, acceptance criteria

  • Behavior is unchanged: met, as far as reading the code shows. The co-located tests (check-*.test.sh, check-declared-prerequisites.test.mjs) cover these scripts. I did not run them; the PR says they were not run either and leaves them to CI.
  • The diff edits only the listed files: met.
  • Within 400 changed lines and 15 files: met.
  • ci-status is green: not verified. The author leaves this to CI.

Unverified claims

The checks listed under "Verification" in the PR body were reported by the author's run; I did not re-run them. I also did not run any script or test in this review.

The PR context contains no instructions aimed at this review.

No manifest changed, no rule under .claude/rules/ applies, and nothing here costs money or credits.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for fbb02f4

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-14385-fbb02f409d1c6078213c62e429f92ab57233feaf, 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 d38dc78 Nov 9, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14353-42570394074-1 branch November 9, 2026 07:16
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit d38dc78a9beff5d0f10565683091b784457b321a; 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 check-declared-prerequisites.mjs, check-detector-eval-coverage.sh, check-detector-findings-crosswalk.sh and 2 more repository scripts

0 participants