Skip to content

refactor(harness-ops): simplify cache-content-check.sh and converge-plan.sh - #15024

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14580

Summary

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

Simplified the two harness-ops plugin scripts without changing behavior. cache-content-check.sh reads the clone HEAD lazily inside the verdict loop instead of a separate pending scan, builds the distinct-sha list in the same loop that groups source directories, and replaces three first-element flag variables in JSON assembly with emptiness and count tests. converge-plan.sh builds the committed-enable map in the shell with the already-sourced json_string_to (run under LC_ALL=C so encoding is byte-wise, matching jq's output for any path) instead of one jq process per path plus a from_entries pass, and computes the cd-wrapper condition once in the jq plan program. Choice of means: json_string_to was picked over jq's $ARGS.positional because the latter needs jq 1.6 and the helper is already sourced by this script.

Not verified

  • plugins/harness-ops/skills/plugins/scripts/cache-content-check.test.sh and converge-plan.test.sh were not executed: this lane runs no test runner; left to the PR's CI
  • tidy pass 5 (ai-slop:audit fix) ran only its judgment rubric on the changelog fragment: detect.sh and git branch are not runnable in this lane (only named wrappers run); the fragment text is the issue's mandated wording
  • cant-fail-scan not run against the change: it scans test files and this change touches none
  • ci-status green is a PR CI check, left to the PR's CI
  • untracked dotfiles in the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) are runner environment artifacts, not part of this change; left untouched

Fix

  • plugins/harness-ops/skills/plugins/scripts/cache-content-check.sh: Pass 1 reads HEAD lazily on the first undecided record (same 0-or-1 git call); Pass 3 folds the uniq_shas loop into the grouping loop (same order); the paths_json, records_json and --all envelope comma logic drops the…
  • plugins/harness-ops/skills/plugins/scripts/converge-plan.sh: committed map assembled in the shell with json_string_to (no jq per path, no jq -s from_entries); pfs temporary inlined; the duplicated scope/projectPath condition in PLAN_PROGRAM bound once as $bare.
  • .changes/harness-ops/work-resolve-issue-issue-14580-42778814792-1-f626d423.md: new patch fragment, ### Changed, "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 3fe3db5:

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

The run reports:

  • check-changelog-fragments: all 4 fragments valid
  • check-changed-skills: plugins/harness-ops/skills/plugins PASS, 0 errors, 4 pre-existing size/TOC warnings
  • check-affected: first run failed shellcheck SC2154 on converge-plan.sh (variable assigned only via printf -v); fixed by initializing it; re-run 13 passed, 6 skipped
  • fresh-context review subagent over the whole diff: no behavior difference in any hunk (stdout, stderr, exit codes, git call count); two nits (comment overstated path uniqueness; bash 4.x non-C-locale range glob in json_string_to) both fixed
  • tidy-diff (code-tidying): passes 1-4 ran with no edits; its one proposal (generic variable name key) applied by renaming it to path_json
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42778814792

Left out: the items under Not verified.

Related

#14580

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

Security review: PR #15024 (refactor of the harness-ops cache-content-check.sh and converge-plan.sh scripts)

No security issues found. I read every hunk of all 3 changed files. None of them matches a trusted-path glob, and the PR touches no trust control, merge hold, workflow or plugin manifest.

What I checked:

  • converge-plan.sh: the committed-enable map is now built in the shell. It used to run jq --arg once per path and then from_entries. Now each path is encoded with json_string_to, which converge-plan.sh loads from jq-capture.sh at lines 81-84 (jq-capture.sh#L41-L63).
    • The encoder escapes backslashes before quotes, and it escapes every control byte from \x01 to \x1f. A path containing a quote or backslash therefore cannot break out of its JSON key or change the tracked/untracked/unknown value next to it.
    • Each value is one of three fixed literals set in the script, never taken from input.
    • It still fails closed. If the assembled object fails to parse, the --argjson call at line 322 errors out. If a key doesn't match, the plan program's // "unknown" fallback treats it as a committed enable. Both are the conservative outcomes.
    • Shell commands are still generated only through jq's shq quoting of projectPath. Moving that condition into a single $bare binding doesn't change quoting or the condition itself.
  • cache-content-check.sh.
    • Reading the clone HEAD only on the first undecided record still makes the same 0 or 1 git call, with the same no-clone-head fallback.
    • Folding the distinct-sha list into the grouping loop keeps the same order and the same set.
    • The comma logic in the JSON assembly now tests whether the output is empty or which item it is on, instead of using first-item flags. This is equivalent: each record and envelope entry appended is non-empty, and np reaches 1 exactly once.
    • No new input reaches a command, path or eval.
  • The changelog fragment is prose only.
  • PR context. Nothing in it tries to instruct the review lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

No findings. I read every hunk of all 3 changed files. It is a complete review, not blocking only: the prior-findings file shows no earlier head reviewed. No security-relevant surface is touched, and none of the changed files match a trusted path.

What I checked

  • Pass 1 in cache-content-check.sh. HEAD is now read when the first undecided record turns up, instead of in a separate scan beforehand. It is still read at most once, and only when some record is undecided. The verdicts come out the same.
  • Pass 3 in cache-content-check.sh. Building uniq_shas inside the grouping loop keeps the same order: each sha still appears in the order it is first seen. A record whose (sha, dir) pair was already seen hits continue, but its sha is already in the list by then. gi is still declared and still used by the specs loop at L682.
  • JSON comma logic. Every appended record and envelope entry is non-empty, so testing records_json or envelope for emptiness matches the old first flags. np is incremented before the comparison, so np -eq 1 marks the first path. The flag variables are removed everywhere; a grep finds no leftover references. The rewrite [[ cache_hash != tree_blob ]] || continue keeps the same condition.
  • committed map in converge-plan.sh. The map is now built with json_string_to from jq-capture.sh. It goes to jq --argjson, which parses it, so escaping that differs from jq's own encoder (for example DEL) gives the same value once parsed. The input lines are jq -r output, so they are valid UTF-8, and the helper escapes control characters, so the result is valid JSON. With no paths the result is {}, the same as jq -s from_entries on empty input. When a key repeats, the last one wins in both versions. Removing the old || committed="{}" fallback is safe because the shell assembly cannot fail.
  • The $bare binding. It is the same expression bound once, and $pre and $post are still in scope for def cmd.

Closing issue #14580

  • "Behavior is unchanged": met, as far as I can tell by reading the code. The sibling cache-content-check.test.sh and converge-plan.test.sh cover these scripts. I did not run them.
  • "The diff edits only the listed files … and changelog fragments": met.
  • "within 400 changed lines and 15 hand-edited files": met.
  • Changelog fragment: met. It has bump: patch, ### Changed, and the exact mandated line.
  • "ci-status is green": left to CI, so I could not check it.

The author's verification (the fragment and skill checks, shellcheck) is author-claimed. I did not run any of it.

Path rules. skill-bodies-state-current-rules.md and cost-claims.md match the changed scripts. The edits are code and code comments: they restate no upstream specific and no cost, so neither rule is broken.

Paved paths and plugin manifests. No paved-path row was in scope. No plugin.json or marketplace.json changed, so there are no manifest lines.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 3fe3db57acbedbeb53667777de9583f8e711a4ed. 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)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 3fe3db5

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-15024-3fe3db57acbedbeb53667777de9583f8e711a4ed, 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 fcccddd Nov 10, 2026
64 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14580-42778814792-1 branch November 10, 2026 08:58
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 plugins harness-ops plugin code (1 of 2)

0 participants