Skip to content

refactor(instruction-placement): simplify index-check.sh - #15215

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14589-42929589958-1
Nov 11, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14589

Summary

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

Simplified plugins/instruction-placement/git-hooks/index-check.sh without changing behavior. The AGENTS.md-else-CLAUDE.md target lookup is now three lines in the same fallback style the script already uses for the renderer and check-lib lookups, in place of a for loop plus an empty-check. The relevance test is now one [[ == ]] condition in place of a case with an empty default arm; both forms match * across / and match "$target" literally. Other parts were left as they are: moving the relevance check ahead of the pre-commit index materialization would change the exit status when mkdir or checkout-index fails, and so it is not a pure refactor.

Not verified

  • check-affected's output does not name which 13 checks passed, so this run cannot confirm that plugins/instruction-placement/git-hooks/index-check.test.sh ran; that suite is left to the PR's CI
  • No existing test covers the CLAUDE.md fallback (index-check.sh:49, or a commit touching only CLAUDE.md). The issue rules out new tests, so the fallback's equivalence rests on the review, not on a test
  • tidy: the ai-slop pass did not run the deterministic detect.sh, because this lane allows only its named wrappers in Bash; the one-line fragment got the rubric read by hand instead. The write-for-humans prose-linter step was not run for the same reason
  • ci-status green on the PR is left to the PR's CI

Fix

  • plugins/instruction-placement/git-hooks/index-check.sh: target selection collapsed from a for loop to two fallback tests; the relevance case statement became a single [[ ]] condition (net -8 lines)
  • .changes/instruction-placement/work-resolve-issue-issue-14589-42929589958-1-1d81b378.md: new patch fragment, ### Changed with "Internal simplification, no behavior change."

Verification

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

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

The run reports:

  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changelog-fragments: all 14 fragments valid (run before and after tidy)
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-changed-skills: no changed skills, nothing to gate (run before and after tidy)
  • /home/runner/work/claude-code-plugins/claude-code-plugins/.lane/checks/bin/check-affected: 13 passed, 6 skipped over 2 changed files (run before and after tidy)
  • fresh-context review subagent over the before/after hunks: no behavior difference found (same target for every combination of AGENTS.md and CLAUDE.md present or absent, same pattern semantics, candidate read nowhere else)
  • code-tidying:tidy-diff over the changed lines: passes 1-3 found nothing to change in the code hunks; the docs-hygiene and ai-slop rubric passes on the fragment found nothing to change
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42929589958

Left out: the items under Not verified.

Related

#14589

Follow-ups

  • Pre-existing (advisory): **Advisory, not blocking: no test covers the CLAUDE.md fallback.** The issue's "behavior is unchanged" criterion is met. I traced all four AGENTS.md / CLAUDE.md present-or-absent cases and each picks (thread)

Merge-Risk: max=LOW demote=false head=ba219978f42809e68e612ec58e350fca523b5955 rubric=8.4.0 rater=claude-opus-5-5 checker=claude-opus-5-5

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

Copy link
Copy Markdown
Contributor

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

Security review: PR #15215

I found no security issues. I read every hunk of both changed files. Neither file matches a trusted path, and neither touches a trust control, a merge hold, a token or a plugin manifest.

plugins/instruction-placement/git-hooks/index-check.sh: I checked that the refactor behaves the same as the base, since a changed check could quietly skip validation.

  • Choosing the target file. The base loop picks AGENTS.md if it exists, then CLAUDE.md, and exits 0 if neither exists. The new three lines (target=AGENTS.md, then a fallback to CLAUDE.md, then exit 0) give the same result for all four cases: both files, only one, or neither.
  • Deciding which changed files matter. The base case patterns become [[ "$f" == "$target" || "$f" == .claude/rules/*.md || "$f" == */.claude/rules/*.md ]]. The right-hand sides without quotes are glob patterns, so * still matches across / as it does in case. The quoted "$target" is still compared as literal text. A changed file name therefore cannot be read as a glob or as an injection, and the hook's skip conditions are unchanged.
  • Nothing new reaches the shell. No new external input, command or path handling is introduced.

.changes/instruction-placement/...md: a changelog fragment containing only text.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on ba219978f42809e68e612ec58e350fca523b5955; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed ba219978f42809e68e612ec58e350fca523b5955: read 2 of 2 changed file(s); 1 finding(s), 1 as inline comments.

Code review: PR #15215 (refactor(instruction-placement): simplify index-check.sh)

I read every hunk of both changed files and the whole head copy of index-check.sh.

Equivalence check (done by me, not by running anything):

  • Target lookup (index-check.sh:48-50): the old loop took the first of AGENTS.md, then CLAUDE.md, that existed, and exited 0 if neither did. The new code does the same:

    • AGENTS.md present: target is AGENTS.md.
    • Only CLAUDE.md present: target is CLAUDE.md.
    • Neither present: exit 0.

    candidate is read nowhere else, so dropping it is safe.

  • Relevance test (index-check.sh:54): a case pattern and the right side of [[ == ]] follow the same glob rules. * matches across / in both, and the quoted "$target" is a literal match in both. The removed empty *) arm did nothing. The script runs under bash after check-lib.sh is sourced, so [[ ]] is allowed at this point. It is already used on lines 32-33.

  • Changelog fragment: bump: patch, a ### Changed heading and the exact line "Internal simplification, no behavior change.", as the closing issue requires.

Closing issue #14589 acceptance criteria:

  • Behavior unchanged: met, as the review above shows. The CLAUDE.md fallback has no test that could fail; see the inline comment (advisory).
  • The diff edits only the listed file plus a fragment: met.
  • Within 400 lines and 15 files: met (2 files, net −8 lines).
  • ci-status green: left to the PR's CI. I couldn't check it, and the author's verification claims are unverified.
  • Fragment for instruction-placement: met.

No plugin manifest changed. Nothing in the PR text is an instruction to this lane. This is the first review of this PR, so it is not blocking only.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on ba21997.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for ba21997

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-15215-ba219978f42809e68e612ec58e350fca523b5955, expires on 2026-12-11.

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 11, 2026
Merged via the queue into main with commit b54ff1b Nov 11, 2026
84 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14589-42929589958-1 branch November 11, 2026 00:47
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit b54ff1bf016d40d4dcbcd70ba528ed92ebc5897e; 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 index-check.sh instruction-placement plugin code

0 participants