Skip to content

refactor(performance): simplify findings.py and harness-lib.sh - #15044

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14665

Summary

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

Behavior-preserving simplification of the performance plugin's findings.py and harness-lib.sh (part 2 of 2 of the /simplify epic). In findings.py, repeated inline checks and duplicated blocks are now small helpers inside the same file: filled, is_number, need_in, tagged, slowest_first, load_transcript_reader, print_transcript_report and print_gh_report. Every output string, exit code, error order, CLI flag and existing function name is unchanged. In harness-lib.sh, the nested ledger-directory fallback is one parameter expansion, and a redundant empty-path check after a successful type -P is gone. Nothing moved between files, so the out-of-scope restructuring pass is left alone.

Not verified

  • plugins/performance/scripts/findings.test.sh and harness-lib.test.sh were not executed: this lane runs no interpreter or test runner; left to the PR's CI
  • ci-status green is a PR CI check; left to the PR's CI
  • tidy recorded skipped: passes 1-4 ran with no edits, and pass 5 (ai-slop fix) applied only the rubric read, because its deterministic detector detect.sh is not a wrapper this lane's Bash may run
  • cant-fail-scan not applicable: it scans test files and this change touches none
  • Untracked runner dotfiles in the checkout (.bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc, .bash_profile) are environment artifacts, not part of this change, and were excluded from the tidy measurement

Fix

  • plugins/performance/scripts/findings.py: added filled/is_number/need_in validation helpers that rebuild the same 'X required' / 'X must be one of ...' messages in the same order; folded the horizon-now confidence branch into one need(); shared the redaction tag between shown_command and hook_label…
  • plugins/performance/scripts/harness-lib.sh: harness_ledger_path picks the ledger base with ${XDG_CACHE_HOME:-${HOME:+$HOME/.cache}} (same die message when neither is set); harness_require_python drops a [[ -n ]] check that a successful type -P never needs
  • .changes/performance/work-resolve-issue-issue-14665-42781379721-1-d2a4e626.md: patch fragment created with new-changelog-fragment, body '### Changed' and 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 9 fragments valid (run before and after tidy)
  • check-changed-skills: no changed skills, nothing to gate (run before and after tidy)
  • check-affected: 14 passed, 5 skipped (typos not installed; three validate-plugins sub-checks that run code from the checked tree; changed-skills), over 3 changed files (run before and after tidy)
  • fresh-context review subagent over the whole diff against HEAD: no confirmed problems; verified each hunk equivalent (message text and order, truthiness of filled/is_number in need(), set -u safety of ${HOME:+...}, no removed names, ruff.toml selects only E4/E7/E9/F)
  • diff size: 3 files, 94 added / 125 removed lines in findings.py and harness-lib.sh plus a 7-line fragment, within the issue's 400-line / 15-file cap
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42781379721

Left out: the items under Not verified.

Related

#14665

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

Security review: no security issues found

I read every hunk of all 3 changed files. None of them match a trusted-path glob, and none touches a trust control, a merge hold, a plugin manifest or a standing instruction.

plugins/performance/scripts/findings.py

  • Validation helpers: filled, is_number and need_in accept exactly what the inline checks they replace accepted. Each need() gets the same truthiness, and every message comes out in the same order. Folding the horizon-now confidence branch into one need(confidence == "HIGH", ...) gives the same outcome and message in both cases.
  • Redaction: the new tagged(command, clean) holds the cut-and-hash step that shown_command and hook_label used to repeat. Both callers still pass the redacted text, and hook_label still applies URL_PATH and HOOK_INPUT_MAX before redacting. The tag still hashes the redacted text, never the raw command, so no secret leaks through the tag or the shown text.
  • Shared loader: load_transcript_reader keeps the same sys.path insertion of the plugin's own ../lib and the same dont_write_bytecode setting. The import source is unchanged.
  • Other refactors: print_transcript_report, print_gh_report, slowest_first, the cmd_status_timing early continue and the is_test hoist only rearrange code. No new input reaches a command, a path or a network call.

plugins/performance/scripts/harness-lib.sh

  • base="${XDG_CACHE_HOME:-${HOME:+$HOME/.cache}}" resolves to the same ledger base as the old nested branch. It is XDG_CACHE_HOME if set, else $HOME/.cache if HOME is set, else empty, which leads to the same harness_die. It is safe under set -u, and it still fails closed when neither variable is set.
  • Removing [[ -n "$resolved" ]] after type -P ... || continue is harmless. type -P fails when the command is not found, and an empty path would fail the -c 'import sys' probe anyway, so no unchecked interpreter gets chosen.

.changes/performance/...md is a changelog fragment with no executable content.

The PR context file contains no embedded instructions aimed at this lane. There are no prior findings, so this was a full review (not blocking only). Spend: none beyond this review run.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15044 (refactor(performance): simplify findings.py and harness-lib.sh)

I read every hunk in all 3 changed files and found no correctness or maintainability problems. None of the changed files is on a trusted path.

Behavior equivalence, checked hunk by hunk by reading the code. I ran nothing.

  • finding_errors:
    • filled() and is_number() give the same true/false results as the inline checks they replace.
    • need_in() builds exactly the old "<what> must be one of …" text, including the expected_size source_kind prefix.
    • Checks still run in the same order, so the error list comes out the same.
    • The horizon-now confidence check is now one conditional expression. It passes the same messages: needs confidence HIGH when the value is missing, and cannot rest on a … row otherwise.
  • tagged(): shown_command and hook_label both still compare the cut text against the original, uncut command, and the hash input (clean) is unchanged.
  • Other findings.py helpers:
    • slowest_first uses the same sort key and reverse=True at both call sites.
    • load_transcript_reader keeps the sys.path insert and the dont_write_bytecode setting.
    • print_transcript_report and print_gh_report keep the same JSON output (sort_keys=True for the transcript reports, indent=2 only for the gh reports), the same stderr text and the same exit codes.
    • The message/content rewrite in transcript_counts gives the same result for an empty dict and for non-dict values.
    • The len(cols) <= 5 early continue in cmd_status_timing and the hoisted is_test in workflow_timing don't change behavior.
  • harness-lib.sh:
    • ${XDG_CACHE_HOME:-${HOME:+$HOME/.cache}} resolves to the same base as before.
    • The :+ form is safe under set -u when HOME is unset.
    • The harness_die message is the same text.
    • The dropped [[ -n "$resolved" ]] check can't fail after a successful type -P.

Closing issue #14665, acceptance criteria:

  • Behavior unchanged; no renamed, moved or deleted files; exported names kept: met, from reading the code. Every existing function name is still there; the new names are only additions. The PR says findings.test.sh and harness-lib.test.sh were not run (author-claimed, unverified); they are the tests that would catch a regression.
  • Edits only the listed files plus fragments: met.
  • Within 400 lines / 15 files: met (3 files, about 94 lines added and 125 removed).
  • ci-status green: I can't check this from here; it's left to the PR's CI.
  • Patch fragment with ### Changed and "Internal simplification, no behavior change.": met (bump: patch).

Path-scoped rules: .claude/rules/ruff-pin.md matches findings.py. It covers how lint is run, and nothing in this diff breaks it.

Paved paths: no paved-path row in the standards index, so nothing to report.

Plugin manifests: none changed.

Embedded instructions: the PR context contains none aimed at this lane.

Spend: none beyond normal CI.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for bc65133

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-15044-bc651338d1bc889e54568feeb1cfcaf315ef69a7, 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 199a1d3 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14665-42781379721-1 branch November 10, 2026 09:30
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 scripts performance plugin code (2 of 2)

0 participants