Skip to content

refactor(code-metrics): simplify the audit-coverage scripts - #15108

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14428

Summary

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

Simplified join.py, crap.py and audit-coverage.sh in place without changing behavior. In join.py: resolve() drops a redundant unique is not None or test; merge_artifacts() looks up the per-format basename map once per artifact rather than once per path; _fold_function() reads the incoming name and start line once and drops a guard that name is not None already covers; the start-line fallback in _match_function() checks for None once before its loop; _cyclomatic_rows() becomes a comprehension; and join() dedupes formats with dict.fromkeys. audit-coverage.sh reads the head of the artifact once for its lcov probe (one grep -qE '^(SF|TN):' in place of two greps), and crap.py drops add_help=True, which argparse already defaults to. Exported names (resolve, MISSING_SHOWN, crap, render), CLI flags, messages, the 17-line usage header and the output are all unchanged. Moving or deduping code across files was out of scope and was not done.

Not verified

  • Did not run test_join.py, test_crap.py, test_go_cover.py, test_report.py or audit-coverage.test.sh directly, because this lane runs no interpreter or test runner; they are left to the PR's CI
  • ai-slop detect.sh was not runnable here (the lane allows only the named wrappers). The fragment was read by hand instead: its single line is the wording the issue requires and shows no tells, so nothing was rewritten and no findings file was written
  • ci-status green on the PR is left to the PR's CI
  • Untracked dotfiles in the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) were not created by this run and are not part of the change

Fix

  • plugins/code-metrics/skills/audit-coverage/scripts/join.py: simplified resolve(), merge_artifacts(), _fold_function(), _match_function(), _cyclomatic_rows() and the formats dedupe in join(); no behavior change
  • plugins/code-metrics/skills/audit-coverage/scripts/crap.py: dropped the default-valued add_help=True argument
  • plugins/code-metrics/skills/audit-coverage/scripts/audit-coverage.sh: lcov format probe reads the artifact head once with one ERE grep in place of two greps
  • .changes/code-metrics/work-resolve-issue-issue-14428-42829999534-1-370d0951.md: new patch fragment, ### Changed with "Internal simplification, no behavior change."

Verification

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

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

The run reports:

  • check-changelog-fragments: all 19 fragments valid (run before and after tidy)
  • check-changed-skills: audit-coverage PASS, 0 errors, 2 warnings that predate this change (description length, body length)
  • check-affected: 14 passed, 5 skipped (typos not installed; checks that run code from the checked tree), over 4 changed files (run before and after tidy)
  • fresh-context review subagent: read all three files and judged each of the 8 hunks equivalent for every input the CLI can produce. Its one caveat: a non-hashable format value passed straight to join() from Python would now raise, which the CLI cannot reach because _read_artifact always sets a str…
  • tidy-diff (code-tidying): ran passes 1-3 over the code hunks and passes 4-5 over the fragment; no further edits
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42829999534

Left out: the items under Not verified.

Related

#14428

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

Security review: PR #15108, refactor(code-metrics): simplify the audit-coverage scripts

No security issues found.

I read every hunk of all 4 changed files in .claude-lane/pr.diff. None of them matches a trusted-path glob. None is a trust control, a merge hold, a plugin manifest or a standing-instruction file, so the instruction-surface and manifest lenses don't apply.

  • .changes/code-metrics/…-370d0951.md: a new changelog fragment (bump: patch, "Internal simplification, no behavior change."). It is text only and nothing runs it.
  • audit-coverage.sh: the lcov format check changes from two grep -q calls to one grep -qE '^(SF|TN):' over head -n 200 "$artifact". $artifact is still quoted, the pattern is a fixed string, and no new input reaches a shell. No injection surface is added.
  • crap.py: drops add_help=True from the argparse call. That is already the default, so nothing changes.
  • join.py: local data-processing refactors in resolve(), merge_artifacts(), _fold_function(), _match_function() and _cyclomatic_rows(), plus the formats de-duplication in join(). All of them process coverage-artifact data in memory. They add no file, network, subprocess or credential handling, and they don't touch paths, authorization or secrets.

The PR description contains no embedded instructions aimed at the review lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15108, simplify the audit-coverage scripts

No findings. I read every hunk of all 4 changed files. Each one behaves the same as the base code for every input the CLI can produce, so the "behavior unchanged" criterion of #14428 holds.

Hunk by hunk:

  • audit-coverage.sh detect_format: one grep -qE '^(SF|TN):' over the same head -n 200 matches the same inputs as the two greps joined with ||.
  • crap.py: add_help=True is argparse's default, so removing it changes nothing.
  • join.py resolve(): _unique_longest({}) returns None (join.py#L176-L182). So unique is not None or matches reduces to matches, and both fall-throughs are unchanged.
  • join.py merge_artifacts(): hoisting setdefault now creates an empty per-format map even for an artifact with no files. The only reader is ambiguous_by_format.get(fmt) inside the per-section loop, which never runs for that artifact. resolve also treats an empty set and None the same way (ambiguous or ()). No observable difference.
  • join.py _fold_function(): if name is not None, then existing["name"] == name already rules out existing["name"] is None, so the dropped guard was redundant. The same_span and positioned tests are unchanged.
  • join.py _match_function(), _cyclomatic_rows() and the formats dedupe via dict.fromkeys: equivalent and order-preserving. Format values come from _read_artifact as strings, so they are always hashable.

Closing issue #14428 criteria:

  • Behavior unchanged: met, as above. The equivalence comes from reading the code. I did not run any tests; the author says the tests were left to CI.
  • The diff edits only the 3 listed files and one changelog fragment: met.
  • Within 400 changed lines and 15 files: met (about 60 lines, 4 files).
  • ci-status green: not something this lane can judge; it is left to CI.
  • Fragment: met. .changes/code-metrics/…370d0951.md has bump: patch, ### Changed and the exact required line.

No plugin manifest changed. No changed file matches a trusted-path glob. I found nothing in the PR context that tries to direct the review.

Spend: none beyond this review run.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head c2d449ccc08f1dbef2b5bc982d0516c91038668b. 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 c2d449ccc08f1dbef2b5bc982d0516c91038668b, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for c2d449c

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-15108-c2d449ccc08f1dbef2b5bc982d0516c91038668b, 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 0d248ea Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14428-42829999534-1 branch November 10, 2026 15:28
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 0d248ea2d075dfc59e8bb55cff725115319dfbdc; 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-coverage code-metrics plugin code

0 participants