Skip to content

perf(test): enforce a per-suite wall-clock budget on CI shell suites, warn then fail - #10904

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-10230-40832344551-1
Oct 29, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Refs: #10230

Summary

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

scripts/run-plugin-tests.sh, the runner every test-bash leg calls on pull requests, now times each shell suite on GitHub Actions. Over 120 s it prints SLOW: and a warning annotation and exits 0; over 300 s (or the suite's own ceiling in the new scripts/suite-budget-exceptions.txt) it fails by name. The numbers come from the scripts/suite-seconds.txt shell medians: 120 s is one test-bash leg's planned work, and the nine suites with a median over 150 s (half the ceiling) start as 480 s exceptions so no suite on main fails on day one. The numbers, their basis and the exception file are documented once, in README.md 'Per-suite time budget in CI'.

Remaining work

  • Python suites in the test-python lane are not budgeted. That leg runs its pytest loop inline in .github/workflows/pr-require-checks.yml ('Run this leg's Python suites'), a path this lane cannot change. Timing each pytest invocation against the same threshold, ceiling and exception list (or a Python-

Not verified

  • scripts/run-plugin-tests.test.sh and the other shell suites were not run here: this lane runs only its wrappers, with no bash interpreter for suites. The PR's test-bash legs run them.
  • Done-when 'green on main's current suite times' is reasoned from the scripts/suite-seconds.txt medians (each non-excepted shell suite is at most 124 s against the 300 s ceiling, and each excepted one at most 404 s against 480 s), not observed on a whole-tree CI run. A whole-tree run on the PR or mai
  • Done-when 'ci-status is green on the PR head' is a PR check, left to the PR's CI.
  • Tidy skipped: the change touches the shared path scripts/ and spans two areas (scripts, README.md), over the 1-area tidy cutoff.
  • typos lint skipped by check-affected (typos not installed in this lane); CI's lint runs it.

Fix

  • scripts/run-plugin-tests.sh: new SUITE BUDGET mode, on when GITHUB_ACTIONS=true or PLUGIN_TEST_SUITE_BUDGET=1 (0 turns it off). PLUGIN_TEST_SUITE_WARN (default 120) and PLUGIN_TEST_SUITE_CEILING (default 300) are validated. The summary loop prints SLOW: <suite> took Ns plus a ::warning over
  • scripts/suite-budget-exceptions.txt (new): the one exception list, with nine rows at 480 s. These are the shell suites whose suite-seconds.txt median is over 150 s: block-root-delete-target, align, ui, surface-journey, surface-ui-c, surface, demo-video, babysit engine, cant-fail-scan.
  • scripts/run-plugin-tests.test.sh: exports PLUGIN_TEST_SUITE_BUDGET=0 and an empty exceptions list so CI's GITHUB_ACTIONS does not change the other cases. New cases cover the threshold (warning, exit 0), the ceiling (exit 1, a bare FAIL line, one error annotation), an exception row raising the ceilin
  • README.md: new 'Per-suite time budget in CI' subsection under 'Validate a change' with the threshold, the ceiling, their basis, the exception file and the local switch.

Verification

The runner ran each check from the base copy against 16e146b:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • .lane/checks/bin/check-changelog-fragments: 'All 12 changelog fragment(s) under .changes/ are valid.' (run before and after the review fixes)
  • .lane/checks/bin/check-affected: '11 passed, 4 skipped over 4 changed files' (ruff: no .py changed; typos: not installed; validate-plugins and changed-skills: nothing in scope), run before and after the review fixes
  • .lane/verify/bin/cant-fail-scan --file scripts/run-plugin-tests.test.sh --check: PASS, no gating findings, 1 test file fully read
  • Grep of scripts/suite-seconds.txt for shell rows with a 3-digit median: ten are over 120 s (the README's count) and nine over 150 s, the nine rows in suite-budget-exceptions.txt; Glob confirmed all nine suite paths exist
  • Fresh-context review subagent over the whole diff: no bugs. It confirmed the README counts, the exception rows, the [[ ]] precedence and the set -u safety, and that no other CI caller of the runner reads the real exceptions list against a fixture root. Two findings were fixed: the ceiling failur
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40832344551

Left out: the items under Not verified.

Related

#10230

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

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 16e146b24e032895af144c7400908624a52ac552: 0 finding(s), 0 as inline comments.

No security issues found in this pull request.

critical-findings: 0

I read all four changed files: scripts/run-plugin-tests.sh, scripts/run-plugin-tests.test.sh, the new scripts/suite-budget-exceptions.txt, and README.md. None match a trusted path, and the change touches no trust control. It leaves the trusted-actor check, token scope, kill switch, merge holds and pr-pipeline.yaml alone, and changes no plugin manifest, so there are no manifest <field> lines.

  • Arithmetic injection: The runner uses ((secs > ceiling)) and ((suite_budget)). Every operand is checked before use.
    • PLUGIN_TEST_SUITE_BUDGET must be 0 or 1.
    • PLUGIN_TEST_SUITE_WARN and PLUGIN_TEST_SUITE_CEILING must match ^[1-9][0-9]*$ whenever the budget is on.
    • Exception-row seconds must match the same pattern.
    • secs comes from the runner's own $log.secs timing file.
  • Exceptions parsing: Rows are read with read -r, so there is no word-splitting or glob expansion. Each path must match a discovered suite before it becomes an associative-array key, so stray or stale rows are rejected with exit 2.
  • Annotation text: suite_annotate receives the suite path and integer seconds. Suite paths come from repository discovery and already flowed through suite_annotate before this change.
  • Control strength: The budget can only warn or fail a run. A pull request author who raises a ceiling in the exceptions file loosens a time limit, not a security control. A pull request's own test code already runs in these legs.
  • Environment overrides: PLUGIN_TEST_SUITE_EXCEPTIONS and the other new variables are read from the runner's environment, which a pull request author does not control inside CI.

Spend: no prepaid-credit or billing impact beyond the existing test legs. The change adds timing and fails slow suites, so it adds no runs and no new charge.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 16e146b24e032895af144c7400908624a52ac552: 0 finding(s), 0 as inline comments.

No findings. I read the whole diff (README.md, scripts/run-plugin-tests.sh, its test, and the new scripts/suite-budget-exceptions.txt). I did not run any suite; the checks below come from reading the code.

  • Timing source: $log.secs is written by the worker before $log.rc (scripts/run-plugin-tests.sh:169-170). The summary loop only reaches the new block after confirming $log.rc exists, so the secs="$(<"$log.secs")" read at line 494 is safe.
  • Switch and validation: PLUGIN_TEST_SUITE_BUDGET is unset, 0 or 1. It defaults to on only when GITHUB_ACTIONS=true. The warn and ceiling values are validated only when the budget is on, so a stray bad value outside CI can't cause exit 2.
  • Exceptions list parser: the [[ ! "$secs" =~ … || -n "$extra" && "$extra" != \#* ]] precedence gives the intended result, so a trailing # comment is accepted and a stray token is rejected. secs is global and reused later, but it is reassigned before each use.
  • Stale guard against fixture roots: the new guard fires whenever the file exists, regardless of the budget switch. I checked the other callers of the runner. scripts/affected-tests.test.sh and scripts/plan-test-lanes.test.sh copy the runner into a fixture with an empty serial list and no exceptions file, so the -f test skips the guard. scripts/run-plugin-tests.test.sh points PLUGIN_TEST_SUITE_EXCEPTIONS at an empty list. None of them break.
  • Tests: the cases cover the warn path, the ceiling path (one error annotation and a bare FAIL: line), an exception row, the CI default, the default outside CI, a stale row, a malformed row, and bad switch and ceiling values. The shipped-list check also covers the new exceptions file. The quick suite is asserted only on SLOW: and FAIL: lines. That assertion could flake only if it took more than 1 s under a very loaded runner, which I judged too unlikely to flag.
  • Issue criteria: the PR context has no closing-issue section. The PR cites perf(test): enforce a per-suite wall-clock budget in CI, warn then fail #10230 only as "Refs", so there were no acceptance criteria to check.

The author-claimed items (suite medians staying under the 300 s and 480 s ceilings, and green test-bash legs) are unverified by me. The 120/300/480 s numbers come from scripts/suite-seconds.txt, which I did not recompute.

Cost: this adds no paid resource. It only adds a wall-clock check to existing CI runs and fails a suite that exceeds its ceiling.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 16e146b24e032895af144c7400908624a52ac552.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 0795dc1 Oct 29, 2026
44 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-10230-40832344551-1 branch October 29, 2026 08:44
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 0, survived 0, timeout 0, no coverage 0, invalid 0, not run 7.
Covered-code score n/a; mutation score n/a.

File Killed Survived Timeout No coverage Invalid Not run
scripts/run-plugin-tests.sh 0 0 0 0 0 7

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.

0 participants