Skip to content

test: speed up Docker scheduler coverage#99988

Merged
steipete merged 1 commit into
mainfrom
test/docker-all-scheduler-tests-fast
Jul 4, 2026
Merged

test: speed up Docker scheduler coverage#99988
steipete merged 1 commit into
mainfrom
test/docker-all-scheduler-tests-fast

Conversation

@steipete

@steipete steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

test/scripts/docker-all-scheduler.test.ts spent more than ten seconds of each run waiting through the production shutdown grace in one parent-signal proof. That made this 27-case file the second-slowest measured tooling test despite the behavior itself being deterministic.

Why This Change Was Made

Scale Date.now only inside the disposable spawned proof process before it imports the real scheduler module. The production 10-second grace and implementation remain unchanged; the test still drives the real SIGTERM, grace polling, SIGKILL escalation, descendant cleanup, second-command suppression, and exit-143 path.

All 27 cases were audited. Each protects a distinct CLI, scheduler admission, artifact, log-bound, timer-clamp, process-tree, or operator-policy contract, so none were removed.

User Impact

No runtime behavior changes. The focused test is 55.6% faster locally and 73.2% faster on Linux, with lower local peak RSS and identical behavioral coverage.

Evidence

Related: #57266

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 10:27 AM ET / 14:27 UTC.

Summary
The PR speeds up the Docker scheduler parent-signal coverage by scaling Date.now inside the spawned proof runner before dynamically importing scripts/test-docker-all.mjs, with small indentation cleanup.

PR surface: Tests +5. Total +5 across 1 file.

Reproducibility: not applicable. as a test-performance cleanup rather than a product bug. Current source shows the parent-signal proof exercises the real 10s shutdown grace, and the PR body provides before/after timing evidence.

Review metrics: 1 noteworthy metric.

  • Scheduler cases preserved: 27 cases before/after. The speedup targets one slow proof without deleting distinct scheduler coverage.

Stored data model
Persistent data-model change detected: serialized state: test/scripts/docker-all-scheduler.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Wait for the required PR CI checks to finish before merge.

Risk before merge

  • [P1] The live PR CI run was still in progress during review, so merge should wait for the required checks even though no code-level blocker was found.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow test-only speedup after required CI finishes green, while keeping the production 10s scheduler shutdown grace and the existing 27-case coverage intact.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No automated repair is needed; the remaining action is maintainer merge judgment and CI completion for a protected maintainer-labeled PR.

Security
Cleared: The diff is test-only, touches no dependency, workflow, secret, package, or production execution surface, and confines the clock override to a temporary spawned runner.

Review details

Best possible solution:

Land the narrow test-only speedup after required CI finishes green, while keeping the production 10s scheduler shutdown grace and the existing 27-case coverage intact.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a test-performance cleanup rather than a product bug. Current source shows the parent-signal proof exercises the real 10s shutdown grace, and the PR body provides before/after timing evidence.

Is this the best way to solve the issue?

Yes. The patch accelerates only the disposable spawned proof process before importing the real scheduler module, which is narrower than changing production grace constants or dropping coverage.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 11eeba972f46.

Label changes

Label changes:

  • add P3: This is a low-risk test-performance cleanup with no runtime behavior change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-change focused local/Linux timing results, pnpm test:changed, format, diff-check, and real-behavior-proof status evidence for this test-only performance change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is a low-risk test-performance cleanup with no runtime behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-change focused local/Linux timing results, pnpm test:changed, format, diff-check, and real-behavior-proof status evidence for this test-only performance change.
Evidence reviewed

PR surface:

Tests +5. Total +5 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 10 5 +5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 10 5 +5

What I checked:

  • PR diff: The patch changes only test/scripts/docker-all-scheduler.test.ts, adding a spawned-runner Date.now scale before dynamic import and leaving production files untouched. (test/scripts/docker-all-scheduler.test.ts:730, eddd8b076779)
  • Current parent-signal test: Current main has a POSIX parent-signal proof that starts a long-lived child, sends SIGTERM to the runner, expects exit 143, verifies the first grandchild is cleaned, and verifies the second command never starts. (test/scripts/docker-all-scheduler.test.ts:699, 11eeba972f46)
  • Scheduler grace contract: runShellCommand tracks active children, uses a 10s default shutdown grace, waits for process-group exit with Date.now-based deadlines, then force-kills survivors; the PR accelerates only this test's spawned process clock. (scripts/test-docker-all.mjs:571, 11eeba972f46)
  • Scoped policy: The scoped test guide warns against shared Vitest fake timers in unit-fast; this patch does not use Vitest fake timers and confines the clock override to a disposable spawned .mjs process. (test/AGENTS.md:3, 11eeba972f46)
  • Coverage shape: The current scheduler test file still has 27 it/posixIt cases, matching the PR body's 27 -> 27 coverage claim. (test/scripts/docker-all-scheduler.test.ts:86, 11eeba972f46)
  • Live PR state: Live GitHub data shows head eddd8b0, mergeable state MERGEABLE/UNSTABLE, no reviews or human comments, a protected maintainer label, a successful real-behavior-proof check, and some CI still in progress during review. (eddd8b076779)

Likely related people:

  • steipete: Authored the current PR and recently landed adjacent test-performance work on test/scripts/crabbox-wrapper.test.ts, including the same clock-scaling test helper pattern. (role: recent adjacent contributor; confidence: high; commits: eddd8b076779, 11eeba972f46; files: test/scripts/docker-all-scheduler.test.ts, test/scripts/crabbox-wrapper.test.ts)
  • Vincent Koc: The shipped scheduler helper and test file appear in release-tagged commit e085fa1, authored and committed by Vincent Koc. (role: released area introducer; confidence: medium; commits: e085fa1a3ffd; files: scripts/test-docker-all.mjs, test/scripts/docker-all-scheduler.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready verification for eddd8b07677909b4f8c233f2810af00dd854a52a:

Known proof gaps: none for this test-only change.

@steipete
steipete merged commit 445976e into main Jul 4, 2026
85 of 87 checks passed
@steipete
steipete deleted the test/docker-all-scheduler-tests-fast branch July 4, 2026 14:41
@steipete

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant