Skip to content

perf(harness-ops): keep divergence records out of the sync digest and fold absent paths in the report - #12552

Merged
kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-12542-41540488080-1
Nov 2, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-12542-41540488080-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #12542

Summary

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

sync-run.sh now writes each marketplace's diverging records and full per-path list to <run_dir>/divergences.<mp>.json. The digest carries record_count and records_file instead of records[], which is where ~194 KB of the 197 KB digest sat. The digest's divergences.by_path and the report's by project path: list now name only paths present on the machine; the absent ones become divergences.blocked_paths {paths, records} and one count line pointing at the Stale project records section. Design choice, based on the existing stale-project-records list_file precedent in the same script: audit keeps records[] inline because its scratch directory is removed on exit, and a sync whose file write fails also falls back to inline records, so no run loses the detail. The renderer still renders older digests, folding their absent by_path rows into the count line.

Not verified

  • sync-run.test.sh was not executed: this lane runs no test runner or interpreter, so the suite is left to the PR's CI. The assertions were checked by reading only
  • Digest size and report length were not measured before and after on a real fleet (the 197,741-byte, 166-line baseline host). No live fleet or claude CLI is available here
  • Tidy did not run every pass in full: pass 5's ai-slop deterministic detector (detect.sh) could not run because this lane's Bash allows only the named wrappers. Its rubric was applied by reading the changed lines and found nothing. Passes 1-4 ran: one edit in sync.md (a history phrase made present te
  • Under --audit the digest still carries records[] inline, because the audit scratch directory is removed on exit, so an audit digest on a large fleet stays large. Only sync's digest shrinks
  • Untracked runner dotfiles in the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) are not part of this change and were left untouched

Fix

  • plugins/harness-ops/skills/plugins/scripts/sync-run.sh: divergence_block binds the per-path grouping first, splits it into present by_path rows and a blocked_paths count, then in sync writes {records, by_path} to divergences.<mp>.json and replaces records with record_count and records_file (au
  • plugins/harness-ops/skills/plugins/scripts/render-report.jq: by project path: lists only present paths (no more (not present) rows) and adds one - N path(s) not present: M diverging record(s), counted under Stale project records line, taken from blocked_paths or, for an older digest, from its
  • plugins/harness-ops/skills/plugins/scripts/sync-run.test.sh: sync-mode assertions that the digest drops records and the run-directory file holds them; audit assertions for inline records, record_count 8, blocked_paths, the 4 present by_path rows and the count line; a render test for an older digest;
  • plugins/harness-ops/skills/plugins/context/sync.md: the 'Name where the skew sits' paragraph documents record_count, records_file, the audit fallback, blocked_paths and the new count line
  • plugins/harness-ops/skills/plugins/SKILL.md: Report section says the by-project-path lines name present paths and count absent ones on one line
  • .changes/harness-ops/work-resolve-issue-issue-12542-41540488080-1-700b8cfa.md: new patch changelog fragment for both changes

Verification

The runner ran each check from the base copy against 8d1f5cd:

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

The run reports:

  • .lane/checks/bin/check-changelog-fragments: all 75 fragments valid (run before tidy, after tidy, and after review fixes)
  • .lane/checks/bin/check-changed-skills: CHECK-SKILL plugins PASS, 0 errors, 5 warnings that predate this change in kind (description length, body size, converge.md TOC; body grew 456 -> 457 lines)
  • .lane/checks/bin/check-affected: 12 passed, 6 skipped (typos not installed, tree-code checks reported by the check), rest CI-only
  • fresh-context review subagent over the whole diff: no correctness bugs; it traced every new and edited test assertion against the fixtures (record_count 8, by_path 4 entries, blocked_paths {paths:1, records:3}, moved-self file holding alpha and beta, unchanged goldens, large fleet ~157 KB inline). O
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41540488080

Left out: the items under Not verified.

Related

#12542

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #12552

No security issues found.

I read every hunk in all 6 changed files: the changelog fragment, SKILL.md, context/sync.md, render-report.jq, sync-run.sh and sync-run.test.sh. None of them matches a trusted-path glob.

What the change does:

  • divergence_block in sync-run.sh now writes the per-record detail to $RUN_DIR/divergences.$mp.json instead of the digest. In audit mode, or when that write fails, it keeps the records inline as before.
  • render-report.jq folds paths that are not present into a single count line.

What I checked:

  • New file write. The new output path is built the same way as the existing $RUN_DIR/.divergence-args.$mp.json input on the same function's jq call. It uses the same run directory and the same $mp value, so it adds no new path-injection surface.
  • Untrusted data in commands. The file's contents come from jq over local plugin install records. The new values (--arg f, here-strings into jq_to) go to jq as arguments or stdin, never into shell evaluation or a jq program string.
  • Trust surface. Nothing touches tokens, secrets, workflows, trust controls, merge holds, plugin manifests or standing guardrails.
  • Instruction text. The SKILL.md and sync.md edits describe the new digest fields and report lines. They remove no rule.

PR text. The PR description and the closing issue contain no directives aimed at this review lane.

Spend. None beyond the usual review run.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

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

Code review: #12552 at 8d1f5cda

No blocking or advisory findings. I read every hunk in all 6 changed files. None of them is under a trusted path.

What I checked

  • Changes to divergence_block in sync-run.sh:
    • The per-path grouping is now bound once as $paths. It is split into by_path, which holds present paths only, and blocked_paths {paths, records}.
    • The full list goes into a temporary by_path_all. That key is removed on both branches, so it never reaches the digest.
    • Sync: {records, by_path} is written to $RUN_DIR/divergences.$mp.json, and the digest gets record_count and records_file.
    • Audit, or a failed write: records stays inline and records_file is null. This follows the existing stale-project-records list_file precedent at the same file's line ~2391.
    • Large values off the command line: the large JSON travels through here-strings, not argv, so the per-argument cap the large-fleet test guards against still holds.
    • The new || return: it keeps the old non-zero return when jq fails. The caller still falls back with [[ -n "$div" ]] || div='{}'.
    • Missing-snapshot branch: it still returns early with no record_count. The renderer copes with that.
  • render-report.jq:
    • The new count line comes from blocked_paths. For an older digest, it is rebuilt from that digest's blocked rows in by_path.
    • A digest written before class existed (no class field) still lists every path, because null != "blocked".
    • The block is skipped when there are no present paths and no absent count.
    • Nothing else in the renderer reads divergences.records, and no golden file contains (not present).
  • Other readers of the moved field: nothing in plugins/harness-ops reads divergences.records from a sync digest apart from the tests. The "divergences real" assertions that still read records[] run under --audit, where records stay inline.
  • Tests:
    • The moved-self case runs in sync mode. It asserts that records is absent from the digest, that record_count is 2, where the file sits, and which ids it holds.
    • The real-fleet case asserts four present by_path rows, blocked_paths {paths:1, records:3} and the count line.
    • A legacy-digest render test was added.
    • The large-fleet case was already --audit. Raising it to 1,000 ids keeps the inline records past MAX_ARG_STRLEN now that the absent by_path rows are gone.

Closing issue #12542

  • "Digest size … Keep the detail in the run directory and print a summary." Met for sync. The moved-self assertions would fail if it broke. The PR states that --audit digests stay large.
  • "Report length … by project path: list has one row per path, including paths that are not present." Met. The real-fleet assertions (by_path length 4, the count line, and no (not present) sub-line) would fail if it broke.

Not verified

I had no shell, so I did not run sync-run.test.sh. The PR also says the author did not run it, so the suite's result rests on CI. The author's digest-size and report-length figures for a real fleet are their claim and were not measured.

No paved-path row, .claude/rules match or plugin manifest change applied to this diff. No prior findings or settled threads applied.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 8d1f5cda92d3f2831b3b6fe55f58f890f11e9639. The lanes clear this reason on their own; the next scheduled run judges it again.

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

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 2, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 8d1f5cda92d3f2831b3b6fe55f58f890f11e9639.

Merged via the queue into main with commit c0d3f88 Nov 2, 2026
44 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-12542-41540488080-1 branch November 2, 2026 23:36
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 57%; mutation score 57%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/harness-ops/skills/plugins/scripts/sync-run.sh 4 3 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/harness-ops/skills/plugins/scripts/sync-run.sh:1248 UOI productive input-gap
plugins/harness-ops/skills/plugins/scripts/sync-run.sh:1264 other productive input-gap
plugins/harness-ops/skills/plugins/scripts/sync-run.sh:1266 SBR productive input-gap

The run's summary has the full report.

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.

perf\(harness-ops\): reduce plugins sync's remaining wall clock and digest size - part 2 of 4

1 participant