Skip to content

refactor(docs-hygiene): simplify audit-encapsulation detect.sh - #15149

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14455-42880152722-1
Nov 10, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14455

Summary

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

Simplified plugins/docs-hygiene/skills/audit-encapsulation/scripts/detect.sh without changing its behavior. The repeated file:line:match parsing in five loops is now one split_hit helper. Process substitution replaces three scratch temp files and their cleanup. The duplicated --apply-filters self-citation and worktree logic is now one is_mechanically_legal predicate. The one-line is_scripts_carveout wrapper is inlined, and the allowlist counter no longer counts up and then back down. Output rows and their order, the Summary line, exit codes and flags are unchanged. plugins/docs-hygiene/skills/audit-derivability/scripts/uncommitted-md.sh was reviewed and left unchanged: it is already minimal, and the one candidate edit (a here-string in place of printf | awk) was reverted after review. On bash older than 5.1 a here-string needs a writable temp file, so a read-only sandbox would print nothing where it now prints the path list.

Not verified

  • detect.test.sh and uncommitted-md.test.sh not run: this lane can run no interpreter or test runner; left to the PR's CI
  • ci-status green: a PR CI check, left to the PR's CI
  • uncommitted-md.sh not shortened: it is already minimal (one awk pipeline), and the only candidate edit changed behavior on bash before 5.1 in a read-only temp dir, so it was reverted
  • tidy passes 4 and 5 (markdown) skipped: the only markdown is the changelog fragment, whose text the issue fixes verbatim
  • cant-fail-scan not applicable: it scans test files, and no test file changed

Fix

  • plugins/docs-hygiene/skills/audit-encapsulation/scripts/detect.sh: added split_hit and is_mechanically_legal helpers; replaced RAW_HITS, CROSS_RAW and DOTDOT_RAW temp files with process substitution; inlined is_scripts_carveout; merged the two scope-dir skip conditions; checked the allowlist before…
  • .changes/docs-hygiene/work-resolve-issue-issue-14455-42880152722-1-e054570a.md: patch fragment, ### Changed, 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 74d11dc:

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

The run reports:

  • check-changelog-fragments: all 4 fragments under .changes/ valid
  • check-changed-skills: audit-encapsulation PASS, 0 errors (4 warnings that predate this change, in SKILL.md, which this change does not touch)
  • check-affected: 13 passed, 6 skipped over 2 changed files (shell lint included)
  • fresh-context review subagent: no behavior difference found in detect.sh for any realistic input. It checked errexit inside conditionals, BASH_REMATCH reuse, variable scoping, Summary counters, row order, process substitution and the exit expression. It flagged the uncommitted-md.sh here-string…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42880152722

Left out: the items under Not verified.

Related

#14455

Merge-Risk: max=MEDIUM demote=false head=74d11dc82d87c7c56b880e6c0c8189d92bbc5350 rubric=8.3.5 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 74d11dc82d87c7c56b880e6c0c8189d92bbc5350: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15149 at 74d11dc

I found no security issues.

What I reviewed: every hunk of both changed files.

  • plugins/docs-hygiene/skills/audit-encapsulation/scripts/detect.sh is refactored. A new split_hit helper parses each hit. A new is_mechanically_legal predicate replaces the inline self-citation and worktree filter. Process substitution replaces three scratch temp files, the one-line is_scripts_carveout wrapper is inlined, and the exit is now exit "$((candidates > 0))".
  • .changes/docs-hygiene/...e054570a.md is a new patch changelog fragment.

Why there is no finding:

  • The script is a read-only scanner of repository files for documentation encapsulation. It never handles a token, secret or credential, and it does not touch the network or any trusted-actor, token, kill-switch or merge-hold control.

  • Neither changed file matches a TRUSTED PATHS: glob. Nothing in the diff changes a manifest (plugin.json or marketplace.json), so there are no manifest <field> lines.

  • I compared the new filter with the old one branch by branch:

    They match, so files are still filtered exactly as before.

  • Moving the allowlist check ahead of the counter gives the same raw count as before. Process substitution drops three mktemp files and their trap cleanup. That leaves less temp-file surface, not more, and scan_scope already always returned 0, so no error is newly hidden.

  • No standing instruction is deleted, narrowed or softened. The only removed function is a wrapper whose regex test is inlined at the same call site.

Embedded text: the PR context file holds no directive aimed at this lane.

Spend: none beyond this review run.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15149, simplify audit-encapsulation/scripts/detect.sh

No findings. I read every hunk of both changed files and the whole head copy of detect.sh.

Behavior-equivalence check

I compared each change against the base code. I ran nothing: this lane has no shell.

  • split_hit: it sets the same globals (file, line_no, text) that the five inline copies set. rest is now local, which is safe: the only other rest, in is_cross_plugin_surface, is already declared local.
  • Process substitution in place of the three scratch files: scan_scope only runs grep … || true and sets no globals, so running it in a subshell changes nothing. Its exit status was always 0, so set -e handling is the same. Each loop still runs in the main shell, so HITS_FILE appends and the counters behave as before. sed in the marketplace-id loop reads a file, not stdin.
  • is_mechanically_legal matches the old --apply-filters block branch for branch:
    • A file under .claude/skills/<x>/ or plugins/<p>/skills/<x>/ never reaches the worktree check, as before.
    • The absolute self-root match short-circuits as before.
    • A relative shape goes through resolves_into_self with the same self_root.
    • Anything else falls through to "not legal".
    • Called inside an if condition, errexit is suspended, as it was for the old inline tests.
  • Allowlist check moved ahead of raw++: it produces the same raw count as the old increment-then-decrement.
  • Summary line and exit code: mech-filtered is printed from raw - candidates as before. exit "$((candidates > 0))" gives 0 or 1 exactly as the old if did.
  • is_scripts_carveout: inlining it is safe. A repository grep finds no other caller and no test that sources it.
  • Swapped scope-dir skip conditions: the two conditions exclude each other, so the order has no effect.

Closing issue #14455 acceptance criteria

  • Behavior is unchanged: met as far as I can read; the analysis is above. detect.test.sh already covers this script's output and exit codes. Per the PR body it was not run by the authoring lane; that is author-stated and left to CI.
  • The diff edits only the listed files … and changelog fragments: met. It touches detect.sh and one fragment.
  • Within 400 changed lines and 15 files: met.
  • ci-status is green: I can't check this from here; it is left to the PR's CI.
  • Fragment with ### Changed and "Internal simplification, no behavior change.": met. It is bump: patch for docs-hygiene.
  • uncommitted-md.sh was left unchanged. The PR body gives the reason: the one candidate edit changed behavior on bash before 5.1. That stays inside the issue's "same results" constraint.

Other checks

  • Path-scoped rules skill-bodies-state-current-rules.md and cost-claims.md match plugins/*/skills/**. Neither applies to this shell-only refactor: it adds no volatile upstream specific and no cost figure.
  • No plugin manifest changed, so no manifest lines.
  • The PR context contains no embedded instructions aimed at this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 74d11dc

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-15149-74d11dc82d87c7c56b880e6c0c8189d92bbc5350, expires on 2026-12-10.

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 10, 2026
Merged via the queue into main with commit a5fadca Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14455-42880152722-1 branch November 10, 2026 19:57
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 audit-derivability and audit-encapsulation docs-hygiene plugin code

0 participants