Skip to content

refactor(performance): simplify ab.sh, differential.py and discriminate.py - #14988

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14663

Summary

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

Simplified the three performance harness scripts with no behavior change. ab.sh drops the copy of usage() kept in its header comment, which had already drifted in its Exit wording, and points to --help instead. differential.py extracts a repeated slice into one variable, drops an or \[{}\] that could never apply (itertools.product with no dimensions already yields one empty combination, and empty dimensions are refused earlier) and a falsy check that path_spellings already guarantees, and writes stdin or "". discriminate.py builds the exit-127 arm list once and tests it instead of checking the return codes twice, and collapses the backup-directory if/else into one expression. Moving or deduping code across files (such as the resolve() helper both Python files share) was left to the sub-epic's restructuring pass, as the issue scopes it out.

Not verified

  • The performance test suites (ab.test.sh, differential.test.sh, discriminate.test.sh) and a ruff/shellcheck run were not executed directly here, because this lane runs no interpreter. Left to the PR's CI; check-affected's 14 passes may or may not include them.
  • ci-status green on the PR: a PR CI check, left to the PR's CI.
  • tidy-diff skipped its markdown passes 4 and 5 (write-for-humans, ai-slop fix): the only markdown is the changelog fragment, whose prose line the issue requires word for word.

Fix

  • plugins/performance/scripts/ab.sh: removed the header comment's copy of the usage text (identical to usage() apart from older Exit wording) and replaced it with a pointer to usage()/--help; no code changed.
  • plugins/performance/scripts/differential.py: resolve_token stores name[4:] in one variable; run_one passes stdin or ""; dropped the dead or \[{}\] fallback on the matrix combinations; dropped the redundant empty-string guard in the self-disclosure scan.
  • plugins/performance/scripts/discriminate.py: the exit-127 verdict builds the arm list once and tests it; the backup directory is chosen in one conditional expression.
  • .changes/performance/work-resolve-issue-issue-14663-42758111672-1-37b25b5a.md: new patch fragment from new-changelog-fragment, body ### Changed / - Internal simplification, no behavior change.

Verification

The runner ran each check from the base copy against 15ad690:

  • 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 under plugins/*/skills/, nothing to gate (run before and after tidy).
  • check-affected: 14 passed, 5 skipped (typos not installed; validate-plugins sub-checks that run code from the checked tree; changed-skills), over 4 changed files (run before and after tidy).
  • grep of plugins/performance for ab.sh, differential.py and discriminate.py: the test suites and eval samples call the scripts and their --help but never read the header comment or the source lines that changed.
  • fresh-context review subagent over git-read diff HEAD: no behavior change in any hunk, checked against falsy config values, an empty matrix, exit-127 ordering and --help text; no ruff-format or shellcheck problems found.
  • tidy-diff over the 10 changed hunks: took all 10 rows; no simplify, comment or residue edit applied (the one comment in the changed lines, ab.sh:22, points to usage() and was kept).
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42758111672

Left out: the items under Not verified.

Related

#14663

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

Code review: no findings

This PR simplifies three performance plugin scripts and adds a changelog fragment. I read every hunk of all 4 changed files and checked each simplification against the code around it at head.

  • plugins/performance/scripts/ab.sh: only a comment changed. The header's copy of the usage text is replaced with a pointer to usage() / --help. usage() at ab.sh#L30-L53 still carries every option, the env var and the exit codes. Nothing in plugins/performance reads the header comment.
  • plugins/performance/scripts/differential.py:
    • The key = name[4:] extraction is equivalent.
    • stdin or "" matches the old expression for str | None, since an empty string also maps to "".
    • Dropping or [{}] is safe. Every matrix dimension is checked to be a non-empty list at differential.py#L247-L251. When there are no dimensions, itertools.product() yields one empty tuple, so combinations is still [{}].
    • Dropping the spelling and guard is safe because path_spellings already filters out empty strings at differential.py#L195.
  • plugins/performance/scripts/discriminate.py: the one-expression backup_dir keeps the same truthiness test and the same resolve(str(...)) call. The exit-127 arms list is non-empty exactly when the old 127 in (...) check was true, and it holds the same names in the same order, so the verdict text is unchanged.
  • Changelog fragment: bump: patch, with the body ### Changed / - Internal simplification, no behavior change., as issue Simplify the scripts performance plugin code (1 of 2) #14663 requires.

Closing issue #14663, acceptance criteria:

  • Behavior unchanged: met, by reading the code above.
  • Diff edits only the listed files plus a fragment: met.
  • Within 400 lines and 15 files: met.
  • Performance plugin has a patch fragment with the required body: met.
  • ci-status green: CI has to confirm this.

The test suites (ab.test.sh, differential.test.sh, discriminate.test.sh), ruff and shellcheck have not been run. The PR body says so too, and I couldn't run them either. The PR's verification claims are the author's and I did not confirm them myself.

The PR context contains no embedded instructions aimed at the review lane. No plugin manifest changed. Nothing in this change spends money or prepaid credits.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #14988 (head 15ad690)

No security issues found.

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

  • .changes/performance/…37b25b5a.md: a new patch changelog fragment. It is text only.
  • plugins/performance/scripts/ab.sh: only the header comment's copy of the usage text is removed, replaced by a pointer to usage() / --help. No code changes and no guardrail is removed.
  • plugins/performance/scripts/differential.py:
    • resolve_token now stores name[4:] in a local variable. Lookups behave the same.
    • input=stdin or "" gives the same result as before for a str | None input.
    • The dead or [{}] fallback is dropped.
    • The empty-string guard in the self-disclosure scan is dropped. That only affects whether the harness reports a disclosure correctly. It is not a security boundary.
    • subprocess.run still takes an argv list, not a shell string, so no new injection surface.
  • plugins/performance/scripts/discriminate.py:
    • The backup directory is now picked in one conditional expression. It uses the same truthiness test on config["backup_dir"] and the same resolve() call, so the path logic is unchanged.
    • The exit-127 arm list is now built once, with the same result.

None of these changes reaches a leak, compromise or charge path. Nothing in the PR context reads as an instruction aimed at this lane.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 15ad690

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-14988-15ad6907ccfe8ad2e1005dddb6286f6a673926d1, 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
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
@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 b4711c6 Nov 10, 2026
89 of 90 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14663-42758111672-1 branch November 10, 2026 06:00
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit b4711c6b168dca166fecf94e2589b4b2018cb84f; 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 scripts performance plugin code (1 of 2)

0 participants