Skip to content

refactor(harness-ops): simplify sync-run.sh, part 1 of 2 - #15034

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14585

Summary

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

Simplified the functions and top-level code that start in lines 1-1762 of sync-run.sh (range 1 of 2 of the 3525-line file as measured at start), with no behavior change. A need_value helper replaces eight copies of the flag-missing-value check in the argument loop, and each error message stays word for word. cli_json and cli_update_result now share an object_lines_to helper and a RESULT_LINE_JQ program instead of two copies of the same loop and jq selector, so each update call still runs one jq. catalog_regression_rows and divergence_block now reuse the existing TRIPLE_DEF jq def in place of two private copies (triple and version_triple) that differed only in capture-group names. Runs of one-per-line local declarations in about ten functions are merged. Net change: 125 lines removed, 52 added.

Not verified

  • sync-run.test.sh and the other harness-ops script test suites were not run: this lane runs only its named wrappers, so the suites are left to the PR's CI
  • shellcheck and shfmt were not run directly on sync-run.sh; check-affected passed, but it does not say which shell linters it covered, so this is left to the PR's CI
  • ai-slop detect.sh was not run on the changelog fragment because the lane does not allow that script; the fragment's one line was read against the rubric by hand and showed no tells, and no findings file was written
  • ci-status green is a PR CI check, left to the PR's CI

Fix

  • plugins/harness-ops/skills/plugins/scripts/sync-run.sh: added need_value for the arg loop's value checks; added object_lines_to and RESULT_LINE_JQ, shared by cli_json and cli_update_result; catalog_regression_rows and divergence_block reuse TRIPLE_DEF (duplicate jq triple and version_triple defs…
  • .changes/harness-ops/work-resolve-issue-issue-14585-42778894935-1-4b336b15.md: new patch fragment from new-changelog-fragment, body ### Changed with the line "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 539fcc0:

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

The run reports:

  • check-changelog-fragments: all 5 fragments valid (run before and after tidy)
  • check-changed-skills: CHECK-SKILL plugins PASS, 0 errors, 4 warnings that predate this change (description length, body length, token size, converge.md TOC)
  • check-affected: 13 passed, 6 skipped over 2 changed files (run before and after tidy)
  • fresh-context review subagent over the whole diff: no behavior change found; it confirmed the error messages and exit 2 are unchanged, the merged locals keep their old init state, the jq program text is equivalent, TRIPLE_DEF is assigned before any runtime call, and triple matches version_triple…
  • code-tidying:tidy-diff over the 29 changed hunks: simplify, comment and residue passes found nothing further; write-for-humans and an ai-slop rubric read of the fragment found nothing; no file changed
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42778894935

Left out: the items under Not verified.

Related

#14585

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

Security review: no security issues found. I read the whole change in both listed files.

The PR is a behavior-preserving refactor of the local operator script plugins/harness-ops/skills/plugins/scripts/sync-run.sh, plus a patch changelog fragment. No changed file is on a trusted path, and the PR touches no plugin manifest, workflow or trust control.

What I checked:

  • New need_value helper. It keeps the old exit 2 behavior for a flag given without a value. Every call passes $# from the top-level argument loop, so the arg-count check is unchanged. Each error message is a fixed string literal, and no user input is put into a shell string.
  • New object_lines_to helper. It writes its output only through printf -v into a variable name the caller hard-codes (__lines or __ur_lines), never a name from input.
  • RESULT_LINE_JQ and TRIPLE_DEF. Both are fixed jq programs that the script assigns at top level. TRIPLE_DEF is defined at sync-run.sh#L1281, and RESULT_LINE_JQ sits beside cli_json. They are joined with literal jq text and passed as a single quoted argument, so no data reaches the jq program text. The duplicate triple and version_triple definitions that were removed did the same thing, differing only in capture-group names.
  • Merged local declarations. Bash assigns left to right within one statement, so assignments that use an earlier variable on the same line (in divergence_block and finalize_other_paths) see the value they did before.
  • Instruction-surface lens. The PR removes no standing instruction, guardrail, hook rule or allowlist.

Embedded text in the PR context: none found. The closing issue's body was left out by the wrapper.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15034, refactor(harness-ops): simplify sync-run.sh, part 1 of 2. No findings.

I read every hunk of both changed files and checked the refactor against the unchanged code it now depends on.

  • need_value (sync-run.sh#L357-L363): the helper gets $# from the caller's scope. (( $1 >= 2 )) is the same test as the old [[ $# -ge 2 ]]. exit 2 still ends the whole script, because no subshell runs it. All eight error messages match the old text word for word.
  • object_lines_to and RESULT_LINE_JQ: the line filter is the same loop as before. RESULT_LINE_JQ is a top-level global set before any caller runs. cli_json is called at L789 and later; cli_update_result is called at L2017 and L2080. In cli_update_result, joining "$RESULT_LINE_JQ"'…| (.updateOutcome …' gives the same pipeline as the old inline program, and each update call still runs one jq.
  • TRIPLE_DEF reuse: TRIPLE_DEF at L1281 is the same as the removed triple def, and it differs from version_triple only in capture-group names, which never reach the output. divergence_block already had $TRIPLE_DEF in its program at L1148 on the base branch. No local def triple shadows it. catalog_regression_rows and divergence_block are only called at L3030-L3031, after the global is set, so set -u is not tripped.
  • Merged local declarations: every variable starts out in the same state as before (set or unset). No merged statement uses a variable from earlier in the same statement.

Closing issue #14585, acceptance criteria:

  • Behavior unchanged: met, based on reading the code above. A wrong result here would fail the existing sync-run.test.sh and fixtures, but I did not run them; the PR leaves them to CI.
  • The diff edits only sync-run.sh and one changelog fragment: met.
  • Within 400 changed lines: met (about 52 added, 125 removed).
  • The fragment is bump: patch with ### Changed and the required line: met.
  • Every edited function starts in range 1 (lines 1-1762 of the base file): met.
  • ci-status green: CI's job. I cannot check it from this lane.

The author's verification (check-changelog-fragments, check-changed-skills, check-affected, and their subagent review) is the author's claim, and I did not confirm it. I ran no tests or linters.

The PR body and the issue contain no embedded instructions aimed at this lane. No prior findings or settled threads applied.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 539fcc0

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-15034-539fcc08d24387ce5cd475310eae176bdbab21d8, 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 79fbb4c Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14585-42778894935-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 sync-run.sh harness-ops plugin code (part 1 of 2)

0 participants