Skip to content

refactor(git-hooks): share staged_gone as checks_staged_gone in check-lib.sh (part 1 of 2) - #15634

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-15627-43272987681-1
Nov 12, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #15627

Summary

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

Moved the duplicated staged_gone helper into the canonical lib/git-hooks/check-lib.sh as checks_staged_gone (same body, beside checks_partly_staged, listed in the function index next to it), and switched the actionlint, bash-format, biome-format and go-format hooks to call it with their local copies removed. The ten generated plugin copies of check-lib.sh were regenerated with scripts/sync-shared-copies.sh, and each carrier plugin got a patch changelog fragment. The markdown-format, powershell-format and ruff-format hooks keep their own staged_gone until part 2; the checks_ prefix does not collide with it.

Not verified

  • sync-shared-copies --check-bump origin/main: the wrapper refused to run from outside the repository and there is no origin/main ref here; left to the PR's CI. Each of the ten carrier plugins has a patch fragment.
  • Test suites lib/git-hooks/check-lib.test.sh, actionlint-check.test.sh, shell-check.test.sh, biome-check.test.sh and goimports-format.test.sh: this lane cannot run test scripts; left to the PR's CI
  • ci-status green: a PR CI check, left to the PR's CI
  • tidy not run: the change is over the tidy cutoffs (25 changed files against 10, more than one area) and touches the shared path lib/

Fix

  • lib/git-hooks/check-lib.sh: added checks_staged_gone after checks_partly_staged and its function-index entry
  • plugins/actionlint/git-hooks/actionlint-check.sh: removed local staged_gone; call checks_staged_gone
  • plugins/bash-format/git-hooks/shell-check.sh: removed local staged_gone; call checks_staged_gone
  • plugins/biome-format/git-hooks/biome-check.sh: removed local staged_gone; call checks_staged_gone
  • plugins/go-format/git-hooks/goimports-format.sh: removed local staged_gone; call checks_staged_gone
  • plugins/{typos-format,ruff-format,bash-format,biome-format,go-format,markdown-format,powershell-format,actionlint,guardrails,instruction-placement}/lib/git-hooks/check-lib.sh: regenerated from the canonical library
  • .changes/{typos-format,ruff-format,bash-format,biome-format,go-format,markdown-format,powershell-format,actionlint,guardrails,instruction-placement}/work-resolve-issue-issue-15627-*.md: new patch fragments, ### Changed Internal restructuring, no behavior change.

Verification

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

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

The run reports:

  • sync-shared-copies (regenerate): exit 0, regenerated the ten plugin copies of check-lib.sh
  • sync-shared-copies --check: All 818 registered copies match their canonical sources (exit 0)
  • check-changelog-fragments: All 15 changelog fragments under .changes/ are valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 13 passed, 6 skipped over 25 changed files, no failures
  • Grep for staged_gone across plugins/: only the markdown-format, powershell-format and ruff-format hooks keep a local definition; the four switched hooks call checks_staged_gone only
  • Grep for line citations into the edited scripts (e.g. check-lib.sh:<n>): none found, so no cited line numbers shifted
  • fresh-context review subagent over the diff: no correctness findings (body identical, library sourced and CHECKS_MODE set by checks_init before each call, no name collision, index entry accurate)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43272987681

Left out: the items under Not verified.

Related

#15627

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

Copy link
Copy Markdown
Contributor

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

Security review: PR #15634

No security issues found.

This change is a pure refactor. A staged_gone helper was copied into four hooks. It now lives once in lib/git-hooks/check-lib.sh as checks_staged_gone, with the same body:

  • the CHECKS_MODE == pre-commit guard
  • the ! -e / ! -L checks
  • git ls-files -s -- ":(literal)$1" with the 100* mode match

The actionlint, bash-format, biome-format and go-format hooks now call the shared copy. The :(literal) pathspec stays, so pathspec-magic handling of staged filenames is unchanged. The symlink and submodule exclusions are also unchanged.

What I checked:

  • Library loaded first. Each switched hook loads its plugin's check-lib.sh before any call to the new function (for example actionlint-check.sh#L28-L31). So the function is always defined when it is called, and no hook falls back to treating a gone file differently.
  • Plugin copies. The ten plugin copies of check-lib.sh are byte-identical regenerations of the shared library. I read the first copy (plugins/actionlint/lib/git-hooks/check-lib.sh). Each copy sits at the same relative path inside its own plugin, so none of them acts differently because of where it lives.
  • Changelog fragments. The ten .changes/* fragments are identical patch-bump notes. They contain no instructions or other risky content.
  • Out-of-scope surfaces. No trusted paths, trust controls, merge holds, plugin manifests or instruction files are touched.
  • Embedded text. The PR description contains no instructions aimed at this review.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

The PR moves the duplicated staged_gone helper into lib/git-hooks/check-lib.sh as checks_staged_gone, then points the actionlint, bash-format, biome-format and go-format hooks at it. I read the whole diff for all 7 files in scope. The 9 other changelog fragments and the 9 other generated check-lib.sh copies are identical to the ones I read. None of them sits at a path that changes what its content does: they are changelog fragments and library copies under plugins/<plugin>/lib/git-hooks/.

Correctness

  • The new function body is the same as each removed local copy, character for character: same CHECKS_MODE check, same -e/-L tests, same git ls-files -s -- ":(literal)$1" mode-100* match.
  • All four hooks source check-lib.sh and run checks_init before the loop that calls the helper. That covers both locations: beside the installed hook ($here/check-lib.sh) and the repository path ($here/../lib/git-hooks/check-lib.sh). See actionlint-check.sh#L28-L35; the other three hooks do the same. So CHECKS_MODE is set and the function is defined wherever it is called.
  • No name collision. The markdown-format, powershell-format and ruff-format hooks (left for part 2) still define their own staged_gone, which does not clash with the checks_-prefixed name.
  • The generated copies differ from the canonical library only by the existing 2-line header offset. Their function-index entry and placement next to checks_partly_staged match.

Closing issue #15627, acceptance criteria

  • "checks_staged_gone is defined once, in lib/git-hooks/check-lib.sh, and the four hooks call it with no local copy": met. A grep finds no local definition left in the four hooks, and each one calls the shared function.
  • "Behavior is unchanged": met; the body is identical. Existing hook tests run the deleted-from-the-work-tree path and would fail if the helper broke. For example, see actionlint-check.test.sh#L173-L178. The bash-format, biome-format and go-format tests have similar staged-then-deleted cases.
  • "The diff edits only the listed files": met. The 25 files are exactly the issue's list.
  • "within 400 changed lines … and 15 hand-edited files": met. Five files are hand-edited (besides the boilerplate fragments) and the change is small.
  • sync-shared-copies.sh --check / --check-bump origin/main, the test suites, and ci-status: the author says these were left to CI or passed in the lane run. I could not run them, so they are unverified here.

Spend: none; the change has no billing or usage effect.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for c99c8a2

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-15634-c99c8a22106b37257a0be3aaf99dd5dc4711f848, expires on 2026-12-12.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 12, 2026
@melodic-automation-lanes
melodic-automation-lanes Bot removed this pull request from the merge queue due to a manual request 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 5ee5baa Nov 12, 2026
53 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15627-43272987681-1 branch November 12, 2026 20:07
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

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

File Killed Survived Timeout No coverage Invalid Not run
lib/git-hooks/check-lib.sh 0 0 0 0 0 2
plugins/actionlint/git-hooks/actionlint-check.sh 0 1 0 0 0 0
plugins/bash-format/git-hooks/shell-check.sh 0 1 0 0 0 0
plugins/bash-format/lib/git-hooks/check-lib.sh 0 0 0 0 0 1
plugins/biome-format/git-hooks/biome-check.sh 1 0 0 0 0 0
plugins/go-format/git-hooks/goimports-format.sh 0 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/actionlint/git-hooks/actionlint-check.sh:47 SBR unclassified none
plugins/bash-format/git-hooks/shell-check.sh:66 SBR unclassified none
plugins/go-format/git-hooks/goimports-format.sh:83 SBR unclassified 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 5ee5baa59dfbfdd0e8bed0cb14fd3bb418e39234; 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.

Share the formatter git-hooks' staged_gone check through check-lib.sh (part 1 of 2)

0 participants