Skip to content

perf(test): fake TUI auth child timers - #126563

Merged
steipete merged 1 commit into
mainfrom
perf/tui-auth-child-fake-timers
Aug 20, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/tui-auth-child-fake-timers

Conversation

@steipete

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

The TUI auth-child unit suite spends more than two seconds waiting for real
one-second cancellation timers, slowing every selected maintainer and CI test
run without improving its process-lifecycle coverage.

Why This Change Was Made

This maintainer-requested, AI-assisted test-performance change selectively fakes
only setTimeout and clearTimeout in the two timing-sensitive unit tests. It
preserves all four existing tests and strengthens the escalation boundary: no
SIGKILL at 999 ms, exactly one SIGKILL at 1,000 ms, and no escalation through
1,001 ms after the child exits. The separate real PTY sibling continues to cover
actual child-process behavior; production code and product behavior are unchanged.

User Impact

There is no user-visible behavior change. Developers and CI get faster,
deterministic TUI auth-child unit tests while real-process integration coverage
remains independently intact.

Evidence

  • Controlled same-Testbox A/B: tbx_01m0ewexxkdy1pnsbkj6tbw94v, with one worker,
    distinct caches, import diagnostics, /usr/bin/time -v, one excluded warmup,
    and two retained runs per side:
    https://github.com/openclaw/openclaw/actions/runs/32338236379
    • Wall time: baseline 6.01 s and 6.15 s (mean 6.08 s); candidate 3.96 s and
      4.27 s (mean 4.115 s): 1.965 s faster, a 32.3% improvement.
    • Every candidate sample is at least 1.74 s faster than every baseline sample.
    • Vitest mean: 2.90 s → 0.856 s; test-body mean: 2.13 s → 28 ms; RSS slightly lower.
  • Independent proof Testbox: tbx_01m0ex1ah2jsk3vz3bp93rhpb1:
    https://github.com/openclaw/openclaw/actions/runs/32338929522
  • Focused owner unit suite: 4/4 passing.
    node scripts/run-vitest.mjs src/tui/tui-auth-child.test.ts
  • Real PTY sibling suite: 2/2 passing; it exercises the real TUI/child process,
    not a fake process lifecycle.
    node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-auth-child-pty.e2e.test.ts
  • Complete changed gate: green in 9m51s with zero lint warnings/errors.
    node scripts/check-changed.mjs -- src/tui/tui-auth-child.test.ts
  • Fault injection: advancing only 999 ms fails exactly at the expected second
    SIGKILL call assertion; the approved patch was restored afterward.
  • Fresh branch autoreview: no findings.
  • git diff --check: clean.
  • Production LOC: +0/−0. Test LOC: +14/−6. All four existing unit tests retained.
  • Documentation, changelog, screenshots, and release notes: not applicable; this
    changes test execution only. No agent transcript is included.

@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 20, 2026 06:41
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 20, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for reviewed head 30f323d70b312d659fc0705b0eb2ab3621cf2ec2:

This is a bounded, maintainer-requested test-performance change only. The TUI
auth-child lifecycle owner and all production behavior are unchanged. All four
owner unit tests remain, with selective fake setTimeout/clearTimeout only in
the two escalation cases: no kill at 999 ms, exactly one SIGKILL at 1,000 ms,
and no escalation through 1,001 ms after child exit. The separate real PTY
sibling still proves actual TUI/child-process integration.

Commands and results:

  • node scripts/run-vitest.mjs src/tui/tui-auth-child.test.ts — 4/4 passed.
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-auth-child-pty.e2e.test.ts — 2/2 passed.
  • node scripts/check-changed.mjs -- src/tui/tui-auth-child.test.ts — full
    changed gate passed in 9m51s with zero lint warnings/errors.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main
    — fresh exact-branch review clean, confidence 0.99, zero findings.
  • git diff --check — clean; stable patch ID preserved through rebase.
  • Fault injection with only 999 ms advancement failed at the expected missing
    second SIGKILL assertion; the exact approved patch was restored.

Controlled same-machine A/B, one worker, separate caches, one discarded warmup,
and two retained runs per side:

Production LOC: +0/-0. Tests: +14/-6. Documentation, changelog, screenshots,
live Gateway, and agent transcript are not applicable. No known proof gaps for
this behavior-preserving, test-only change.

Latest ClawSweeper state: acknowledgement only; no substantive review and no
Rank-up moves: have been published, so there are no actionable moves to apply
or skip. Per maintainer policy, landing does not block on the review publisher.

@steipete
steipete merged commit c3051d4 into main Aug 20, 2026
172 checks passed
@steipete
steipete deleted the perf/tui-auth-child-fake-timers branch August 20, 2026 06:50
@steipete

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