Skip to content

refactor(harness-config): simplify audit-pass assemble, finding-identity and run-state scripts - #15520

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14497-43092699302-1
Nov 12, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14497

Summary

Opened by the work-resolve-issue lane from work-resolve-issue/issue-14497-43092699302-1, which an earlier run left with commits and no report. A summary-only model pass read the branch's diff and the issue, changed nothing, and wrote:

This diff simplifies the three audit-pass shell scripts listed in issue 14497 and adds the required harness-config patch changelog fragment. The duplicated "--flag needs a value" argument parsing is collapsed into one shared pattern in each command parser. assemble.sh gains small helpers for run-dir and epoch checks. run-state.sh gets shared read_lease and write_lease helpers in place of three copies of the lease body, and its plugin-data and state-key logic is tightened. Long "WHY THIS EXISTS" header comments are condensed. The diff touches only the listed files and the fragment, and it is well under the size limits. It was not cut short. I did not run anything, so I can't confirm that behavior is unchanged or that ci-status is green. Reviewers should check two spots against the "same behavior" criterion. First, finding-identity.sh no longer falls back to printing MISSING-SHA256 in sha256_stdin, and sorted_site_fields no longer validates sites. Both now rely on callers having validated first, so any other caller of those functions would behave differently. Second, the argument-parsing rewrite should keep the same error text and ordering. Nothing in the issue or diff tries to steer a reviewer. The issue's follow-ups section is not needed.

Fix

  • assemble.sh: add require_run_dir and require_epoch helpers, used by cmd_epoch and cmd_assemble
  • assemble.sh: collapse repeated flag parsing in cmd_epoch, cmd_assemble and cmd_render into one case plus a shared value check
  • assemble.sh: use list.extend for terminal-section items, pass env vars inline to python instead of export, and condense the header comment
  • finding-identity.sh: collapse flag parsing in cmd_finding_id, cmd_group_id and cmd_validate_record
  • finding-identity.sh: drop the MISSING-SHA256 fallback in sha256_stdin, relying on require_sha256 having run
  • finding-identity.sh: remove the duplicate site validation from sorted_site_fields, since cmd_finding_id already validates
  • finding-identity.sh: condense header and validation comments
  • run-state.sh: replace write_lease_atomic and three inline lease bodies with read_lease and write_lease helpers using LEASE_* globals
  • run-state.sh: simplify cmd_paths and cmd_lease_acquire (plugin-data default, state-key invocation, guard clauses)
  • run-state.sh: simplify record_is_json_object to a single glob test and condense header and fence comments
  • .changes/harness-config: add a patch fragment reading 'Internal simplification, no behavior change.'

Files the branch changes, from the compare listing; a denied path, which the merge lane refuses, is marked and listed first:

  • .changes/harness-config/work-resolve-issue-issue-14497-43092699302-1-f819b31e.md
  • plugins/harness-config/skills/audit-pass/scripts/assemble.sh
  • plugins/harness-config/skills/audit-pass/scripts/finding-identity.sh
  • plugins/harness-config/skills/audit-pass/scripts/run-state.sh

Verification

The earlier run reported no checks here, and the summary pass ran none.

The runner ran each check from the base copy against 737b95c:

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

The runner's leak scan read everything the branch changes since its merge base with the default branch and found nothing credential-shaped.

Left out: every check the earlier run would have reported; ci-status, pr-verify and the security review lane check the head before it merges.

Related

#14497

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

Security review: PR #15520 (head 737b95c)

No security issues found.

critical-findings: 0

I read all of the diff for all 4 changed files. None of them match a trusted-path glob. This change touches no trust control, token request, kill switch, merge hold, plugin manifest or standing instruction. The header comments that were cut down only explain why the code exists; no rules were removed.

What I checked

  • Argument parsing (assemble.sh, finding-identity.sh): the new form is case → "${2-}" → [[ $# -ge 2 ]] || die → shift 2. An unknown flag still dies before anything else runs. A flag with no value still dies, with the same message. No value is evaluated, so nothing new can be injected.

  • run-state.sh paths: state_key=$(bash "$state_key_lib" ${root:+--root "$root"}). Bash keeps the inner quotes inside ${var:+word}, so $root stays one argument and is not glob-expanded. Same behavior as the old if/else. The check that --run-dir lies under <plugin-data>/runs/ in cmd_lease_acquire is unchanged. Folding the --plugin-data default into one line keeps the same fail-closed die.

  • Lease rewrite (read_lease / write_lease): it writes the same fields as the three copies it replaces. released_at is still written only for the released state, and the write still goes through a temp file and mv -f. The values come from the existing lease file through lease_field, as before, so nothing new reaches the file.

  • record_is_json_object: the single glob '{'*'}' matches the same strings as the two old case checks. The jq/python3/structural checks after it are unchanged.

  • finding-identity.sh:

    • sha256_stdin lost its MISSING-SHA256 fallback. Every subcommand that hashes calls require_sha256 first: cmd_anchor at L239, cmd_finding_id at L287, plus L324 and L349.
    • sorted_site_fields no longer validates its input, but its only caller, cmd_finding_id, still validates every site first, before the process substitution at L304.

    Both are about whether the computed IDs stay correct; neither is a security exposure.

  • assemble.sh: environment variables are now passed inline to python3 instead of exported; the values are the same. list.extend replaces the append loop. Neither changes what gets parsed or written.

These are local audit-skill scripts that write under the plugin data directory. No untrusted pull request or issue text reaches them through this change, and there are no credentials or tokens involved.

Spend

No new spend: nothing here changes what lanes run or what gets billed.

PR context

The PR description has no text trying to steer the review. The closing issue's body was left out by the wrapper.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 737b95c2a3bd705fee49d8d63b03ac0ecedadd7b: read 4 of 4 changed file(s); 1 finding(s), 0 as inline comments.

Code review: PR #15520, simplifying the audit-pass scripts (closes #14497)

I read all 4 changed files in full. I checked each rewrite against the base behavior. I ran nothing, so I can't confirm test results or ci-status myself. The PR's checks (check-changelog-fragments.sh, check-changed-skills.sh) are author-claimed and unverified.

Behavior-equivalence checks (no defect found)

  • Argument parsing (cmd_epoch, cmd_assemble, cmd_render, cmd_finding_id, cmd_group_id, cmd_validate_record): the case statement assigns ${2-} first, then runs [[ $# -ge 2 ]] || die "$1 needs a value". This gives the same message and exit code 2 as before. An unknown flag still dies first. ${2-} is safe under set -u, and none of these scripts uses set -e, so the earlier assignment has no side effect.
  • sha256_stdin fallback removed: every caller runs require_sha256 first: cmd_anchor L239, cmd_finding_id L287, cmd_group_id L324 and cmd_validate_record L349. MISSING-SHA256 could not be reached before this change either.
  • sorted_site_fields validation removed: its only caller is cmd_finding_id (L304). That caller already runs the same three checks with the same messages at L292-298. The removed copy ran inside a process substitution, so its die never stopped the script anyway.
  • write_lease/read_lease: for acquire, heartbeat and release, the lease is written with the same fields in the same order, and released_at still appears only for released. The heartbeat_at and heartbeat_at_iso values carried forward are the same as before.
  • record_is_json_object: [[ "$s" == '{'*'}' ]] matches the old two-case test, including turning down a lone {.
  • ${root:+--root "$root"}, plugin_data="${plugin_data:-${CLAUDE_PLUGIN_DATA:-}}", list.extend(term.get(key) or []), and the inline env in place of export in render_report all behave the same. Nothing after render_report reads AP_FINDINGS or AP_REPORT.
  • require_epoch: it sets the global EPOCH instead of being called inside $( ), so its die still exits the script. The order of checks in cmd_assemble (run-dir, meta, python, epoch) is unchanged.

Closing-issue criteria (#14497)

  • Behavior is unchanged: met as far as I can tell by reading. Finding (advisory, gap in test coverage): the rewritten missing-value path has no test. That is the "<flag> needs a value" message and exit 2, now built from $1 after the assignment, in all six rewritten parsers. Nothing in assemble.test.sh, finding-identity.test.sh or run-state.test.sh passes a value flag as the last argument, so a regression would go unnoticed. Examples: assemble.sh L120, finding-identity.sh L281, finding-identity.sh L343. Swapping the $# -ge 2 guard with shift 2, or dropping it, would break the behavior with every test still passing. One test per script, such as assemble.sh epoch --run-dir expecting exit 2 and --run-dir needs a value, would close the gap. The issue scopes out new tests, so this is advisory and doesn't block.
  • Diff edits only the listed files and fragments: met. It touches the three listed scripts and one fragment.
  • Within 400 changed lines and 15 files: met (about 600 diff lines, mostly removals; well under 400 hand-edited lines added).
  • ci-status green: not verified by this lane.
  • harness-config patch fragment with ### Changed / "Internal simplification, no behavior change.": met.

No plugin manifest changed, so there are no manifest lines. There are no path-scoped rule hits, and no embedded instructions in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 737b95c

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-15520-737b95c2a3bd705fee49d8d63b03ac0ecedadd7b, 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
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 12, 2026
@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 2af6312 Nov 12, 2026
62 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14497-43092699302-1 branch November 12, 2026 04:32
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-pass harness-config plugin code

0 participants