Skip to content

refactor(harness-config): simplify the audit-permission-state scripts (1 of 2) - #15409

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14499

Summary

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

Simplified the five audit-permission-state scripts without changing outputs, exit codes, flags or printed text. Repeated branches became one helper: audit.sh's two block-lint calls became run_block_lint, the oracle and plain entry-diff runs became one call with an argument array, and automode-block-lint.sh's four early-exit blocks became end_lane. Duplicate conditions were folded (the two blanket-verdict branches in automode-entry-diff.sh, the unread-status triple in permission-merge.sh, the composite-key split in managed-conformance.sh). The Python label split became one re.split. Choice of means: I kept every change inside each file and moved or deduped no code across files, since the issue leaves that to the restructuring pass.

Not verified

  • The script test suites (audit.test.sh, automode-block-lint.test.sh, automode-entry-diff.test.sh, managed-conformance.test.sh, permission-merge.test.sh and siblings) did not run: this lane's Bash runs only the named wrappers, so they are left to the PR's CI
  • shellcheck and bash -n over the edited scripts did not run, for the same reason; left to the PR's CI
  • ci-status green is a PR check, left to the PR's CI
  • tidy: the markdown passes (docs-hygiene:write-for-humans and ai-slop:audit fix) were skipped on the changelog fragment. Its text is mandated verbatim by the issue, and the ai-slop detector and digest-guard scripts are outside the lane's Bash allowlist. A manual read found no tell
  • Changes are left uncommitted in the working tree, as the runner instructions require; the runner builds the patch

Fix

  • plugins/harness-config/skills/audit-permission-state/scripts/audit.sh: run_block_lint helper replaces two duplicated critique/plain blocks; the entry diff nests under the merge branch and runs once with an argument array instead of two near-identical pipelines; the unused merged="" initializer and…
  • plugins/harness-config/skills/audit-permission-state/scripts/automode-block-lint.sh: end_lane helper replaces four note+summary+exit blocks; label_of uses re.split on the first ':' or '['; the customized-section test and the final summary print are each collapsed to one expression
  • plugins/harness-config/skills/audit-permission-state/scripts/automode-entry-diff.sh: the bare Bash/PowerShell and blanket-ERE branches, which both give class=blanket, are one condition; a redundant empty-line guard on input that grep -v '^$' already filters is removed
  • plugins/harness-config/skills/audit-permission-state/scripts/managed-conformance.sh: the rule key is computed once for both branches; the beaten rule's text is tracked directly instead of being split back out of a SUBSEP key
  • plugins/harness-config/skills/audit-permission-state/scripts/permission-merge.sh: the unread-status check is computed once per surface record; the whole-tool NOTE loop tests the kind once
  • .changes/harness-config/work-resolve-issue-issue-14499-43069861042-1-0d7518c7.md: new patch fragment with ### Changed and the line 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 6 fragments valid (before and after tidy)
  • check-changed-skills: audit-permission-state PASS, 0 errors, 4 warnings that predate this change (description length, body size, a fresh-eyes directive at SKILL.md:322)
  • check-affected: 13 passed, 6 skipped over 6 changed files (before and after tidy)
  • review: a fresh-context subagent compared the diff with the HEAD versions and found no behavior change. It checked set -u/pipefail and $? capture, array expansion under bash 3.2, end_lane exit with the EXIT trap, re.split against the old find() cut, awk SUBSEP keys and the bare_order loop, and that…
  • tidy-diff: 23 hunk rows taken, none dropped; the simplify, comment and residue passes found nothing more to edit
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43069861042

Left out: the items under Not verified.

Related

#14499

Merge-Risk: max=MEDIUM demote=false head=d9717612c696b0cebf59341381827309e53ecb44 rubric=8.4.2 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-review reviewed d9717612c696b0cebf59341381827309e53ecb44: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #15409, a behavior-preserving cleanup of the audit-permission-state scripts

No findings. I read every hunk in all 6 changed files. For each change I also read the head code around it to check that behavior stays the same, as closing issue #14499 requires.

How each change holds behavior steady:

  • audit.sh
    • run_block_lint returns the status of the last command it runs, so || rc=$? still captures the lint's exit code at both call sites.
    • The entry diff now sits inside the want_entry branch, and merged is only read inside that branch. Removing the merged="" initializer is therefore safe under set -u. If the merge fails, the command substitution still assigns any partial output, which is what the old code did too.
    • entry_args always holds at least --diff-only, so expanding it under set -u is safe on bash 3.2.
    • The inline { grep … || true; } gives the same result as the removed entry_filter function. Nothing else in the file used entry_filter.
  • automode-block-lint.sh
    • end_lane calls exit 0 from the main shell, not a subshell. Its calls before the trap … EXIT at line 123 behave as before, and the calls after it still run the trap.
    • capture … || turns off errexit just as if ! capture did.
    • import re is already present at line 146. re.split(r"[:\[]", …, maxsplit=1)[0] cuts at whichever of : or [ comes first, which matches the old find() logic, including when neither character appears.
    • The status in the final summary is still partial exactly when unusable_sections is non-empty. The note still prints before the summary line.
    • The any(...) or any(...) check has no side effects, so short-circuiting it is harmless.
  • automode-entry-diff.sh
    • The two branches that were merged were next to each other and gave the same verdict (dropped class=blanket).
    • Removing the empty-line guard is safe because the loop's input is already filtered by grep -v '^$' at line 434.
  • managed-conformance.sh
    • key is computed for every rule record now, but nothing outside that block reads it.
    • beaten_text is either text or tk (the latter only when tk != text). So beaten_text != text is equivalent to the old bk[2] == tk && tk != text, and lower[beaten SUBSEP beaten_text] is the same lookup as the old lower[beaten_key].
  • permission-merge.sh
    • is_unread stands in for the same three-way status test at both places it was used.
    • bare_order only ever gets deny … or ask … entries (lines 160 and 167), so the reshaped NOTE loop prints the same lines as before.

Closing issue #14499, checked against its acceptance criteria:

  • No behavior change: met, based on the reading above.
  • Only the listed files and changelog fragments are edited: met.
  • Size limits: met, the PR is well under 400 lines and 15 files.
  • Changelog fragment: met. bump: patch, ### Changed, and the required wording are all present.
  • ci-status green: I couldn't check this from inside this lane. It's left to the PR's CI.

Not verified by me: the author says the script test suites, shellcheck and bash -n were not run, so they are left to CI. The checks the author does report (check-changelog-fragments, check-changed-skills, check-affected) are the author's claims, and I didn't confirm them.

No plugin manifest changed. No paved-path, settled-thread or prior-finding items apply, since this lane has not reviewed an earlier head of this PR.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15409 (head d971761)

No security issues found. I read every hunk in all 6 changed files.

This pull request refactors the read-only audit-permission-state scripts in the harness-config plugin and adds a changelog fragment. It touches no trusted path, trust control, merge hold, workflow, token request or plugin manifest. It removes no standing instruction.

The audit's verdicts are a safety signal: they report blanket grants, managed rules that a lower scope outranks, and unread scopes. So I checked that each change still produces the same verdicts. I found no change in what gets reported:

  • audit.sh
    • run_block_lint passes back the lint script's exit status, so || rc=$? still captures it.
    • The entry diff now runs inside the want_entry branch, after merged is assigned, so set -u is safe without the old merged="" line.
    • entry_args always holds --diff-only, so expanding it is safe on bash 3.2.
    • The inline grep filter still ends in || true, just as entry_filter did.
  • automode-block-lint.sh
    • end_lane prints the same note and summary and still exits 0.
    • re is imported at line 146 of the head file.
    • re.split(r"[:\[]", …, maxsplit=1)[0] cuts at the first : or [, as the old find() logic did.
    • The partial/read status still depends on unusable_sections.
  • automode-entry-diff.sh
    • Folding the bare Bash/PowerShell check and the blanket regex into one branch keeps class=blanket for both.
    • The removed empty-line guard was redundant: that loop's input already goes through grep -v '^$' (line 434).
  • managed-conformance.sh: whole = (beaten_text != text) matches the old bk[2]==tk && tk!=text in both branches. The scope lookup key beaten SUBSEP beaten_text equals the old beaten_key.
  • permission-merge.sh: bare_order only ever holds deny and ask entries (lines 160 and 167), so the new nested condition prints the same notes. is_unread is the same three-way status test.

No pull request or issue text tried to give the lane instructions. Prior findings: none. This head had no earlier review from this lane, so this was a full review, not blocking-only.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for d971761

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-15409-d9717612c696b0cebf59341381827309e53ecb44, 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 e6c450c Nov 11, 2026
75 of 76 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14499-43069861042-1 branch November 11, 2026 19:17
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit e6c450c6e500edae454d3fc787f9586dbd8cc85f; 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 audit-permission-state harness-config plugin code (1 of 2)

0 participants