Skip to content

refactor(harness-config): simplify audit, draft-auto-mode-rules, setup and unhobble scripts - #15524

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14504-43145512021-1
Nov 12, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14504-43145512021-1

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14504

Summary

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

Simplified the five listed harness-config scripts without changing behavior. check-structure.sh now shares one set of jq defs (permission counts, key counts, value-or-unset, list-or-unset) in place of expressions repeated across its settings, local and managed branches. fix-plugin-drift.sh has a print_remediation helper in place of two duplicated managed/unmanaged if-blocks, and a shorter lower-scope read. draft-automode-block.sh has jq bullets and flush helpers, and reduces over a filtered input stream. wsl-profile.sh builds its deny rules as one array literal. instruction-files.sh drops a redundant empty-check before a case statement that already handles the empty string. Means chosen on evidence: every output string, exit path and jq call the tests shim (the type == "object" post-edit validation) is untouched. An earlier run's branch was stale and its commit could not be read here, so the work was redone from the default branch.

Not verified

  • The plugin's *.test.sh suites (check-structure, fix-plugin-drift, draft-automode-block, wsl-profile, instruction-files) were not run: this lane allows no interpreter or test runner. Left to the PR's CI.
  • ci-status green on the PR (an issue acceptance item) is a PR CI check; left to the PR's CI.
  • tidy markdown passes (docs-hygiene write-for-humans, ai-slop fix) were not run on the changelog fragment: its body is the exact text the issue requires, so a rewrite would break that criterion. Tidy recorded as skipped for that reason.
  • Build/verify step: these are bash scripts with nothing to build, and tests could not run here (see above); verify recorded as skipped.

Fix

  • plugins/harness-config/skills/audit/scripts/check-structure.sh: shared JQ_DEFS (permission_counts, key_count, value_or_unset, list_or_unset) used by the settings, local, mcp and managed fact blocks; three-line printf runs merged into one printf each; keys count inlined
  • plugins/harness-config/skills/audit/scripts/fix-plugin-drift.sh: print_remediation helper replaces two duplicated managed/unmanaged remediation blocks; lower_ok set once and cleared on failure instead of reset in each branch
  • plugins/harness-config/skills/draft-auto-mode-rules/scripts/draft-automode-block.sh: jq bullets and flush helpers replace three copies of the close-entry expression and two copies of the bullet-section expression; reduce over a filtered inputs stream; never-applied // defaults in render dropped
  • plugins/harness-config/skills/setup/scripts/wsl-profile.sh: deny rules built as one array literal using $HOME directly; the two Edit rules appended in one +=
  • plugins/harness-config/skills/unhobble/scripts/instruction-files.sh: removed a redundant empty-value early return in index_flag_hidden (the case's *) branch already covers an empty string)
  • .changes/harness-config/work-resolve-issue-issue-14504-43145512021-1-56f96d58.md: patch fragment, ### Changed: Internal simplification, no behavior change.

Verification

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

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

The run reports:

  • check-changelog-fragments: all 17 fragments under .changes/ valid
  • check-changed-skills: 4 skills checked, 0 failed (warnings are about SKILL.md files this change does not touch)
  • check-affected: first run failed shellcheck SC2016 on check-structure.sh after the jq programs moved into a wrapper function; fixed by dropping the wrapper and keeping direct tr | jq pipelines; final run 13 passed, 6 skipped, including shellcheck over all five scripts
  • diff review: re-read the full zero-context diff and caught three output strings missing the space after the colon ("MCP servers:", "Env keys:" twice); restored them before the final checks
  • fresh-context review subagent over the whole diff: no behavior change found in any of the five files (jq precedence, // error handling, set -u/pipefail, printf bytes, test jq shims all checked)
  • tidy (code-tidying:tidy-diff) over the changed lines: no further edits; no zero-information comment or generated-code residue found
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43145512021

Left out: the items under Not verified.

Related

#14504

Merge-Risk: max=MEDIUM demote=false head=5153e874cbcbbb607f92f934eee0e0fd9b372e2e rubric=8.4.8 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 5153e874cbcbbb607f92f934eee0e0fd9b372e2e. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15524 (harness-config script simplification)

I found no security issues. I read every hunk of all 6 changed files. None of them match a trusted path, none is a plugin manifest, and none touches a trust control, token scope, kill switch or merge hold.

What I checked, file by file:

  • audit/scripts/check-structure.sh: JQ_DEFS is a constant single-quoted string, joined in front of each jq program. No outside input reaches the shell or the jq program text, so this adds no injection path. The local and managed branches still print only what they printed before. The managed branch prints counts only. The local branch prints counts plus the same model and effort values it already printed; env values and permission entries are still not printed. The rule that file contents are never held in a shell variable, so they cannot leak through set -x tracing, still holds. The removed keys variable held only a key count, and the "Top-level keys" line still prints just that count (L136). The open() check for unreadable files still runs before any file is read.
  • audit/scripts/fix-plugin-drift.sh: lower_ok=1; jq … || lower_ok=0 still fails closed. If jq fails or the redirect fails, lower_ok is set to 0 and the existing ERROR … settings unchanged exit still runs. print_remediation prints the same fixed text as the two blocks it replaces.
  • draft-auto-mode-rules/scripts/draft-automode-block.sh: The // defaults removed from render never applied. Every entry is built with string label/why and array covered/not. The four-section output allowlist further down is unchanged.
  • setup/scripts/wsl-profile.sh: The deny rules are the security-relevant part here. All five Read(...) denies (ssh keys, the Azure MSAL token cache, gh hosts.yml, gnupg, usersecrets) and both Edit(...) denies for each Windows home are still produced. The removed home variable was a copy of $HOME, so the paths are unchanged, and the absolute-path check on HOME still runs first.
  • unhobble/scripts/instruction-files.sh: When v is empty, ${v:0:1} is empty too, so the *) branch runs and the function returns 0 with no output. That is exactly what the removed early return did.
  • .changes/…md: Changelog fragment only.

No standing instruction is deleted, narrowed or softened. I found no embedded instructions in the PR context. This change uses no paid resources and adds no lane runs.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of all 6 changed files. For each change I checked whether behavior stays the same, using the head files and the unchanged code they call.

  • check-structure.sh: Each new JQ_DEFS helper produces the same output as the expression it replaces:

    • permission_counts emits the same three lines in the same order.
    • key_count(f) parses as (f // {}) | keys | length.
    • value_or_unset and list_or_unset keep the unset / (empty list) branches.

    Moving the keys | length substitution inline is safe because the script runs set -uo pipefail without -e (L10), so a failing substitution no longer exiting changes nothing. The output strings, including the spaces after each colon, match the base.

  • fix-plugin-drift.sh: lower_ok=1 … || lower_ok=0 sets the same flag as the old lower_ok=0 … && lower_ok=1. print_remediation is defined before both callers and prints the same managed and unmanaged lines.

  • draft-automode-block.sh: The dropped // defaults never applied. Every entry is built at L123 with a string label, a string why and array covered/not, and render is only called on those entries. flush and the reduce over the filtered inputs stream give the same result as the old [inputs] | map(select) | reduce with a closing if.

  • wsl-profile.sh: Using $HOME directly in place of the home copy gives the same strings, since HOME is checked just above. Nothing else in the file read home. The array literal and the two-element += keep the rule order.

  • instruction-files.sh: When v is empty, ${v:0:1} falls to the *) branch, and the function still prints nothing and returns 0 (L138-L146).

Closing issue #14504 acceptance criteria

  • Behavior unchanged: met, per the reading above. The plugin's existing *.test.sh suites for these scripts are what would catch a regression. The PR body says they were not run in the authoring lane, so the evidence here is author-claimed and left to CI. I ran nothing myself.
  • Diff touches only the listed files plus a changelog fragment: met.
  • Within 400 lines and 15 files: met.
  • ci-status green: CI's job, not judged here.
  • Fragment bump: patch with ### Changed / "Internal simplification, no behavior change.": met.

No plugin manifest changed. The PR context and prior-findings files contained no embedded instructions. This is the lane's first review of this PR (not blocking-only).

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 5153e87

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-15524-5153e874cbcbbb607f92f934eee0e0fd9b372e2e, expires on 2026-12-12.

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 12, 2026
Merged via the queue into main with commit 152664d Nov 12, 2026
62 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14504-43145512021-1 branch November 12, 2026 05:14
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/harness-config/skills/audit/scripts/check-structure.sh 2 0 0 0 0 0
plugins/harness-config/skills/audit/scripts/fix-plugin-drift.sh 1 1 0 0 0 0
plugins/harness-config/skills/draft-auto-mode-rules/scripts/draft-automode-block.sh 2 0 0 0 0 0
plugins/harness-config/skills/setup/scripts/wsl-profile.sh 0 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/harness-config/skills/audit/scripts/fix-plugin-drift.sh:476 SBR productive input-gap
plugins/harness-config/skills/setup/scripts/wsl-profile.sh:63 SBR productive no-assertion

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 152664d55d33f9a6a362cd2511b6c7f98dcb6975; 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, draft-auto-mode-rules, setup and 1 more harness-config plugin code

1 participant