Skip to content

refactor(scripts): simplify six repository scripts without changing behavior - #14533

Merged
kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14368-42595248172-1
Nov 9, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14368-42595248172-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #14368

Summary

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

Ran /simplify's four checks over the seven listed scripts and applied the fixes that keep every output, exit code, written file, flag and name the same. upstream-drift-issues.sh gains a fail helper for its eight repeated 'print and set failed=1' blocks, a usage_error helper for its three usage exits, and a write_body that picks its lead and footer in one branch. sync-plugin-options-docs.py names the repeated sensitive-count test once and skips building the stripped text in --check mode. The other changes: sync-shared-copies.sh splits the copy's plugin name once in check_bump, test-git-helpers.sh replaces a case with an empty default arm by one [[ ]] test, test-plugin-mods.sh turns a three-line if into ((unloaded == 0)) || exit 1, and time-gates.sh runs dirname once instead of three times. sync-hold-floor.py is unchanged: the one candidate, caching floor_classes()/gate_workflows(), would break test_babysit_risk.py, which swaps sync.WORKFLOWS and calls floor_classes() again, and the rest of the file is already tight.

Not verified

  • The suites for these scripts (scripts/upstream-drift-issues.test.sh, sync-shared-copies.test.sh, test-git-helpers.test.sh, test-plugin-mods.test.sh, time-gates.test.sh, and the babysit-prs Python tests that load sync-plugin-options-docs/sync-hold-floor) were not run: this lane runs no interpreter…
  • tidy skipped: every changed file is under scripts/, a listed shared path, so the change is not tidied
  • ci-status green: a PR check, left to the PR's CI

Fix

  • scripts/upstream-drift-issues.sh: added usage_error and fail helpers and replaced the inline usage exits and GH -failure blocks with them; write_body picks lead and footer text in one if instead of two (same body bytes)
  • scripts/sync-plugin-options-docs.py: render names len(sensitive) < len(options) once as settable_by_hand; strip_stale_block returns 'stale' before it builds the stripped text
  • scripts/sync-shared-copies.sh: check_bump derives plugin and the in-plugin path once, before the manifest path, instead of splitting rest again later
  • scripts/test-git-helpers.sh: git_init_safe's inside-repo refusal is one [[ == || == ]] test instead of a case with an empty default arm
  • scripts/test-plugin-mods.sh: the unloaded-register exit is ((unloaded == 0)) || exit 1
  • scripts/time-gates.sh: the --timings directory is computed once into timings_dir

Verification

The runner ran each check from the base copy against 6e15eae:

  • 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

#14368

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 6e15eae1c70096b16329453dc583be7ba8982522: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14533 (head 6e15eae)

I found no security issues.

I read every hunk in all 6 changed files. None of them matches a trusted-path glob, and none is a trust control, merge hold, manifest or instruction surface.

  • scripts/test-git-helpers.sh: the check that refuses to run git init inside the current repository changed from a case to [[ "$abs_dir" == "$abs_repo" || "$abs_dir" == "$abs_repo"/* ]]. The quoted $abs_repo still matches literally and only the trailing /* acts as a glob, the same as before, so the guard blocks the same paths.
  • scripts/upstream-drift-issues.sh: fail, usage_error and the reworked write_body produce the same exit codes and the same failed=1 handling. ((PINNED[$1])) evaluates a 0/1 value that the script fills itself (lines 124 and 146) at an index the script supplies, so no outside input reaches the arithmetic. Issue bodies are built from the same span, RUN_* and DETAIL values as before.
  • scripts/sync-shared-copies.sh: plugin and rest are now derived earlier, from the same copy path. rest is only read in the rc == 1 branch and is reset on each loop pass.
  • scripts/sync-plugin-options-docs.py, scripts/test-plugin-mods.sh, scripts/time-gates.sh: these only move code around or compute a value once. They add no new input, path or command.

The PR context file contains no embedded instructions to the lane. There are no earlier findings from this lane on this PR, 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 6e15eae1c70096b16329453dc583be7ba8982522: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #14533, simplify six repository scripts

No findings. I read every hunk of all 6 listed files, plus the surrounding code at head. Each change keeps the script's behavior the same.

  • scripts/upstream-drift-issues.sh
    • usage_error sends usage to stderr and exits 2, the same as the three inline blocks it replaces.
    • fail prints the same "$SELF: <msg>" text as the old printf calls and sets failed=1. It is defined before its first use at line 240.
    • Every call site runs in the main shell. The issue loop is a for and the sweep reads a here-string, so failed still reaches exit "$failed".
    • The 8 replaced blocks match the PR body's count.
    • write_body builds the same bytes as before: Upstream <span> <lead>\n\nRun: …\n<detail>\n<footer>\n.
    • ((PINNED[$1])) is safe: every index in PINNED is set to 0 or 1 (lines 124 and 146).
  • scripts/sync-shared-copies.sh: rest is now trimmed before the manifest path is built instead of inside the rc == 1 branch. Its only later reader is the ${rest%%/*} on line 278, which sits inside that branch, so the value it sees is unchanged. plugin is also unchanged.
  • scripts/sync-plugin-options-docs.py: settable_by_hand is a plain rename of the repeated test. In strip_stale_block, the early return "stale" in check mode skips only building a local string, which has no side effect.
  • scripts/test-git-helpers.sh: the new [[ "$abs_dir" == "$abs_repo" || "$abs_dir" == "$abs_repo"/* ]] test matches the same paths as the old case patterns, because the quoted part is still literal and only the trailing * is a glob.
  • scripts/test-plugin-mods.sh: unloaded starts at 0 (line 38) and the script runs set -uo pipefail without -e, so ((unloaded == 0)) || exit 1 behaves like the old if.
  • scripts/time-gates.sh: dirname now runs once into timings_dir. That name appears nowhere else in scripts/, and the error message text is unchanged.

Closing issue #14368, acceptance criteria:

  • "Behavior is unchanged…": met on reading. I ran no tests. The PR says the suites for these scripts were not run, and that is the author's claim, unverified by me. Existing suites such as scripts/upstream-drift-issues.test.sh and scripts/time-gates.test.sh cover these paths, and CI runs them.
  • "The diff edits only the listed files…": met. All 6 changed files are on the issue's list. sync-hold-floor.py was left unchanged, and the PR body explains why.
  • "Within 400 changed lines and 15 hand-edited files": met. About 60 lines changed across 6 files.
  • "ci-status is green": left to the PR's CI. I can't check it from here.

No plugin manifests, path-scoped rules or paved-path files are touched. No changed file matches a trusted-path glob. The PR context contains no embedded instructions aimed at this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 6e15eae1c70096b16329453dc583be7ba8982522. The lanes clear this reason on their own; the next scheduled run judges it again.

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

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit e431521 Nov 9, 2026
67 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-14368-42595248172-1 branch November 9, 2026 11:43
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 sync-hold-floor.py, sync-plugin-options-docs.py, sync-shared-copies.sh and 4 more repository scripts

1 participant