Skip to content

refactor(hooks): simplify the hook-test-sink.sh shared lib - #14614

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

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14330-42613341998-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #14330

Summary

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

Simplified lib/hook-test-sink.sh without changing what it does (115 to 107 lines). The header paragraphs that repeated each function's own comment are folded into those comments. In the jq filter, the key binding moved ahead of the select, and the redundant trailing , empty inside first() is gone. Changes considered and rejected: dropping // \[\], // {} and // empty (jq's // suppresses errors on its left side, so some odd schemas would print different messages), and replacing rc=$? with if ! reason=$(...) (a bare call under set -e would then exit 1 with a message instead of with jq's status). The three plugin copies were updated to stay byte-identical, as the cross-plugin source registry requires.

Not verified

  • lib/hook-test-sink.test.sh, lib/hook-utils.test.sh and the plugin hook test suites were not run directly here (no test runner allowed in this lane beyond check-affected); left to the PR's CI
  • tidy skipped: the change spans 4 areas (lib, plugins/autonomy, plugins/context-guard, plugins/desktop-notification) against a cutoff of 1, and it touches the shared path lib/
  • typos check skipped by check-affected because typos is not installed; left to CI
  • ci-status green is a PR check, left to the PR's CI
  • untracked sandbox dotfiles (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) appeared at the checkout root; this run did not create them and they are not part of the change

Fix

  • lib/hook-test-sink.sh: header paragraphs on wait_for_sink, check_envelope and $WORK folded into the function comments; jq filter binds .key once before select and drops a no-op , empty inside first(); comments reworded for accuracy
  • plugins/autonomy/hooks/hook-test-sink.sh: byte-identical copy of the canonical file
  • plugins/context-guard/hooks/hook-test-sink.sh: byte-identical copy of the canonical file
  • plugins/desktop-notification/hooks/hook-test-sink.sh: byte-identical copy of the canonical file
  • .changes/autonomy/work-resolve-issue-issue-14330-5c1e9a07.md: patch fragment, internal simplification
  • .changes/context-guard/work-resolve-issue-issue-14330-a3d4f218.md: patch fragment, internal simplification
  • .changes/desktop-notification/work-resolve-issue-issue-14330-7b92e6c5.md: patch fragment, internal simplification

Verification

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

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

The run reports:

  • check-changelog-fragments: all 9 fragments under .changes/ valid (run before and after the review fixes)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 13 passed, 6 skipped (ruff: no .py; typos: not installed; three validate-plugins steps that run code from the checked tree; changed-skills) over 7 changed files
  • sync-shared-copies --check: all 767 registered copies match (hook-test-sink.sh is not in that registry; its copies are kept identical by hand per scripts/cross-plugin-source-registry.txt)
  • fresh-context review subagent over the diff: found one strict behavior change (the if ! reason=$(...) form under a caller's set -e) and three comment inaccuracies; all four fixed (reverted to the rc form, comments reworded); it confirmed the jq select rewrite and the dropped , empty are…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42613341998

Left out: the items under Not verified.

Related

#14330

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14614, simplify lib/hook-test-sink.sh

No findings. I read the whole diff: the canonical lib/hook-test-sink.sh, its three plugin copies, and the first changelog fragment. The other two fragments are identical to the first, so I skipped them.

Behavior equivalence (checked by reading the code; I did not run it):

  • jq rewrite. select(.key as $k | $e | has($k)) | .key as $k | ... became .key as $k | select($e | has($k)) | ..., and the two are equivalent. An as binding passes its input through, so select still receives the to_entries element and .value as $p still reads that entry's value.
  • Dropped , empty. Removing the trailing , empty inside first(...) changes nothing, because first(a, b, empty) yields the same as first(a, b). The outer // empty still covers the no-error case.
  • Comment wording. The edited comment now reads "absent or empty", which matches the [[ -s "$schema" ]] test (file exists and is non-empty). The header paragraphs were folded into the per-function comments, and nothing was lost: the $WORK requirement, the bounded wait, and the schema-sourced field list are each still documented on their function.
  • Copies. The four .sh files carry the same blob change (2a9037e5..28cbc328), and I read each hunk. That matches the byte-identical copy rule in scripts/cross-plugin-source-registry.txt (lib/hook-test-sink.sh -> plugins/*/hooks/hook-test-sink.sh).
  • Mode change. All four .sh files go from 100644 to 100755. The PR description doesn't mention this. It comes from the repo's own exec-bit check: any file starting with #! must be 100755, and scripts/check-affected.sh sets the bit itself (L246, L450-L460). The file is only ever sourced, so the bit has no effect at runtime.

Closing issue #14330 acceptance criteria:

  • Behavior unchanged: met, by the reading above. No function, flag or export was renamed. lib/hook-test-sink.test.sh already asserts the exported function set and the make_sink guard, and checks check_envelope against the schema, so a regression in this code would fail those tests.
  • Only the listed file, its copies and changelog fragments edited: met. The plugin copies are required by the copy registry, and the three patch fragments cover the three plugins that ship a copy.
  • Within 400 lines / 15 hand-edited files: met.
  • ci-status green: still pending. It's a PR check this lane can't see. The author says the test suites were not run locally (unverified).

The PR description's verification results are the author's own claims; I did not check them.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14614 (refactor(hooks): simplify hook-test-sink.sh)

No security issues found.

What I read. I read every hunk of lib/hook-test-sink.sh and its three plugin copies (plugins/{autonomy,context-guard,desktop-notification}/hooks/hook-test-sink.sh). All four have the same index line (2a9037e5..28cbc328) and the same hunks. I also read the first changelog fragment, .changes/autonomy/...-5c1e9a07.md; the other two fragments are its listed identical copies.

What changed.

  • Comments: header paragraphs about wait_for_sink, check_envelope and $WORK were moved into the comments on each function. Comments are not instructions to a model, so this removes no guardrail. The make_sink check that rejects a $WORK that is not a directory is unchanged code.
  • jq filter in check_envelope: select(.key as $k | $e | has($k)) | .key as $k became .key as $k | select($e | has($k)). The two give the same output. Dropping the trailing , empty inside first(...) changes nothing, because empty produces no output. The schema lookup, the check that fails on an empty .required, and the rc=$? handling are unchanged, so the envelope check still fails closed. This is a test-only helper; no trust control reads its result.
  • File mode: all four sink files go from 100644 to 100755. This has no security impact:
    • No plugin manifest or hooks.json refers to hook-test-sink; a search of *.json under plugins/ found nothing.
    • The file has no shebang, and its header says "Sourced, never executed". Sourcing it only defines functions.
    • The PR description doesn't mention the mode change and claims no behavior change, so the code-review lane may want to look at it. It is not a security finding.

Other checks.

  • No trusted paths, trust controls, merge holds, plugin manifests, workflows or token scopes are touched.
  • No instruction-surface rules were deleted.
  • The PR context has no embedded text telling the review to pass, skip or post elsewhere.
  • Prior findings: none; this is not a blocking-only review.

critical-findings: 0

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 494f736 Nov 9, 2026
51 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-14330-42613341998-1 branch November 9, 2026 13:28
@github-actions

github-actions Bot commented Nov 9, 2026

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/hook-test-sink.sh 0 0 0 0 0 3
plugins/autonomy/hooks/hook-test-sink.sh 0 2 0 0 0 0
plugins/context-guard/hooks/hook-test-sink.sh 0 1 0 0 0 0
plugins/desktop-notification/hooks/hook-test-sink.sh 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/autonomy/hooks/hook-test-sink.sh:86 UOI productive input-gap
plugins/autonomy/hooks/hook-test-sink.sh:95 SBR productive input-gap
plugins/context-guard/hooks/hook-test-sink.sh:86 UOI productive input-gap

The run's summary has the full report.

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 hook-test-sink.sh shared lib source

1 participant