Skip to content

refactor(scripts): simplify the read-caller-key, scan-carrier shadow and shell-portability checks - #14393

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14359

Summary

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

Simplified three of the four listed scripts without changing their outputs, exit codes or flags. check-read-caller-keys.mjs now uses one exact-scalar-pair helper for its carrier key lookups and one value helper for the secrets: inherit and permissions: write-all findings, and computes the carrier flag and the tip index once each. check-shell-portability.sh reads the cross-plugin registry once rather than once per file (still a literal comparison, which the test suite pins) and runs one find for skill and reference markdown. check-scan-carrier-secret-shadow.sh drops two four-line if blocks. check-read-caller-keys.sh is an argument and node guard with nothing to simplify, so it is unchanged.

Not verified

  • scripts/check-read-caller-keys.sh --check (node plus the yaml package) was not run here: this lane runs only its named wrappers, and check-affected marks it CI-only. The PR's CI runs it.
  • The scripts/check-shell-portability.test.sh suite and any read-caller-keys tests were not run directly here; left to the PR's CI.
  • Tidy was skipped: the change is under scripts/, a shared path listed in the tidy cutoffs.
  • check-shell-portability.sh's long header comment was left as written: it documents the gate's rules and operating advice, not code that /simplify's four checks cover.
  • Untracked dotfiles at the repository root (.bashrc, .gitconfig, .mcp.json, .idea, .vscode and others) are sandbox mount points that this change did not create; leave them out of the patch.

Fix

  • scripts/check-read-caller-keys.mjs: added pairsOf/exactPairs helpers used by carrierPairOf, carrierPassesOf and checkReadShape; added valueIs/valueLine for the inherit and write-all findings; moved the carrier flag out of the per-expression loop; isTipCheckout uses findIndex once in place of find…
  • scripts/check-scan-carrier-secret-shadow.sh: the two if \[\[ $hit -eq 1 \]\]; then exit 1; fi blocks became ((hit)) && exit 1.
  • scripts/check-shell-portability.sh: the cross-plugin-source-registry is loaded into an array once and is_scannable compares against it literally; the two find calls for plugins//skills and plugins//reference markdown became one find with an -o group (the output still goes through sort -u).

Verification

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

  • 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

#14359

Merge-Risk: unrated reason=pending

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of the 3 changed files. I checked each edit against the closing issue #14359's criterion that behavior stays unchanged.

scripts/check-read-caller-keys.mjs

  • The removed names = [] in the catch: names is already declared let names = []; just before the try, at L107. The catch only fires before anything is assigned, so names is still [].
  • The new pairsOf / exactPairs helpers: they match the old loops exactly. They test the same non-map guard on with, secrets and jobs, and do the same exact scalar compare of key and value. carrierPassesOf still collects pair.value nodes into a Set.
  • valueIs / valueLine: valueLine is only called after valueIs has confirmed a scalar value, so reading pair.value.range is as safe as before.
  • Moving carrier out of the per-expression loop: it reads only node and text, so this is a pure hoist.
  • isTipCheckout using findIndex: results are the same for every value yaml can produce. The one difference is that the old indexOf(undefined) path could throw a TypeError, and the new code does not.

scripts/check-scan-carrier-secret-shadow.sh

  • The script runs set -uo pipefail with no -e, and hit is always 0 or 1. So ((hit)) && exit 1 behaves the same as the removed if blocks, and a printf follows each one, so neither sets the script's final exit status.

scripts/check-shell-portability.sh

  • Reading the registry at top level: this happens after the script's cd at L193, so the relative path resolves to the same file as before. The tests write their fixture registries before they run the script, so reading it once gives the same answer.
  • The global line left by the new loop: nothing else in the script reads line.
  • The empty-array expansion: ${sync_copies[@]+"${sync_copies[@]}"} is safe under set -u. It keeps each entry as one word with no globbing, and the compare is still a literal quoted ==.
  • The merged find: the \( -path … -o -path … \) -name '*.md' group matches the same files as the two old calls, and the output still goes through sort -u.

Closing issue criteria

  • Behavior unchanged: I found no behavior change, though I could not run anything; the reasoning is above.
  • Only the listed files are edited: met. The diff touches 3 of the 4 listed files and nothing else.
  • Within 400 lines and 15 files: met.
  • ci-status green: CI's to judge, and I can't see it.

The author's verification is their own claim and I didn't check it. This includes the claim that CI covers check-read-caller-keys.sh --check and the shell-portability test suite. I had no shell, so I ran nothing.

Prior findings: none, as this is the lane's first review of this pull request. The PR context contains no embedded instructions. No plugin manifest changed. There is no hold.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14393 (head f0db840)

No security issues found.

All three files are pure refactors, and I checked each for changes in behavior that would affect security:

  • scripts/check-read-caller-keys.mjs
    • Catch block: the catch no longer resets names = []. This is safe because names is already initialized to [] at L107, so an unreadable workflows directory still leaves an empty list rather than an undefined value.
    • Helpers: pairsOf and exactPairs apply the same exact-scalar key and value test that the inline loops in carrierPairOf and carrierPassesOf did. carrierPairOf still returns a pair only when there is exactly one match.
    • isTipCheckout: findIndex gives the same ordering check as the old find + indexOf pair.
    • valueIs: keeps the trim and lowercase comparison for both secrets: inherit and permissions: write-all.
    • carrier flag: the expression depends only on node and text, so computing it once outside the per-expression loop gives the same result.
    • None of these changes narrows what the gate reports.
  • scripts/check-scan-carrier-secret-shadow.sh: the script runs set -uo pipefail with no -e, and hit is initialized to 0 at L34. So ((hit)) && exit 1 behaves the same as the old if blocks: exit 1 when a shadow was found, and otherwise fall through to exit 2 (organization not listable) or the success message. Failing closed on an unreadable repository listing is unchanged.
  • scripts/check-shell-portability.sh: the registry is now read once at top level. That happens after the cd to the data root at L193, so the relative path resolves to the same file as before. The comparison is still a literal quoted ==, and the empty-array expansion is safe under set -u. The merged find ... \( -path A -o -path B \) still passes through sort -u, so the file set is the same.

Other checks:

  • No changed file matches a trusted-path glob or a trust control (trusted-trigger, lane token, kill switch, broker signer, merge holds).
  • No manifest, instruction-surface or workflow changes, and nothing that spends credits or can bill.
  • There are no prior findings from this lane on this PR. This was a full review, not blocking-only.
  • The PR context contains no embedded directives aimed at the review.

I did not dispatch any subagents. There were no candidates to verify and no CRITICAL candidates needing a refute pass.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@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 e642059 Nov 9, 2026
77 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14359-42570836149-1 branch November 9, 2026 07:53
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
scripts/check-read-caller-keys.mjs 4 1 0 0 0 0
scripts/check-scan-carrier-secret-shadow.sh 1 0 0 0 0 0
scripts/check-shell-portability.sh 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
scripts/check-read-caller-keys.mjs:323 ROR equivalent none

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit e642059e2f779967e67a83883e73cb873b2797cf; 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-read-caller-keys.mjs, check-read-caller-keys.sh, check-scan-carrier-secret-shadow.sh and 1 more repository scripts

0 participants