Skip to content

perf(test): speed up lazy UI lifecycle polling - #127025

Merged
steipete merged 1 commit into
mainfrom
perf/lazy-ui-test-polling
Aug 21, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/lazy-ui-test-polling

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Control UI lazy-element and onboarding-memory-import regression suites spent about 0.8 seconds waiting for default 50 ms polling intervals even though their observed state transitions settle immediately through Promises. Recent onboarding coverage introduced additional waits on this same owner boundary.

Why This Change Was Made

Use the existing Control UI waitForFast helper for the 17 asynchronous assertions across the two affected suites. It retains the original assertions, one-second failure deadline, actual lazy-element controller, application shell, and lifecycle ordering while reducing the polling interval to 1 ms. No production code, timeout, mock, fixture, or browser boundary changes.

User Impact

No user-visible behavior changes. Developers and CI retain all existing lazy-load, failure, retry, dismissal, foreground takeover, and onboarding cleanup coverage while running these focused tests approximately 16% faster end to end.

Evidence

  • Same Blacksmith Testbox, one worker, distinct filesystem module caches, import diagnostics, GNU /usr/bin/time -v, and excluded warmups.
  • Before retained runs: 2.94 s / 3.09 s wall, 2.38 s / 2.57 s Vitest, 820 ms / 821 ms test bodies, 685440 KB / 677964 KB max RSS, 2.55+0.31 s / 2.72+0.30 s user+system CPU; 11 tests passed in both runs.
  • After retained runs: 2.59 s / 2.45 s wall, 1.97 s / 1.82 s Vitest, 33 ms / 32 ms test bodies, 683404 KB / 679792 KB max RSS, 2.87+0.44 s / 2.82+0.38 s user+system CPU; the same 11 tests passed in both runs.
  • Mean wall time: 3.015 s → 2.520 s, 16.4% faster; mean test-body time: 820.5 ms → 32.5 ms, 96.0% faster. Import counts stayed unchanged at 20.
  • Intended-fault proof: temporarily removing the production lazy controller's authoritative current-request assignment makes the preserved regression fail with expected undefined to match object { status: "loading", ... }; production source was restored completely.
  • Focused owner and canonical-helper sibling coverage: 60 tests passed. Real isolated Chromium stale-chunk recovery: 4 tests passed across terminal, desktop, dashboard, and command-palette recovery.
  • OPENCLAW_UI_E2E_SKIP_REAL_GATEWAY=1 OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test ui/src/app/lazy-custom-element.test.ts ui/src/app/app-host-onboarding-memory-import.test.ts ui/src/app/question-prompt.test.ts ui/src/e2e/lazy-custom-element-recovery.e2e.test.ts --maxWorkers=1 --reporter=verbose
  • pnpm check:changed
  • node_modules/.bin/oxfmt --check ui/src/app/lazy-custom-element.test.ts ui/src/app/app-host-onboarding-memory-import.test.ts
  • Independent structured autoreview: clean, no actionable findings.
  • Production LOC: +0/-0. Tests: +19/-17 across two files; 17 existing waits replaced and two existing-helper imports added. No tests or assertions removed.
  • Blacksmith proof run: https://github.com/openclaw/openclaw/actions/runs/32447826685

@clawsweeper

clawsweeper Bot commented Aug 21, 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 21, 2026 05:04
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Aug 21, 2026
@steipete
steipete force-pushed the perf/lazy-ui-test-polling branch from 41c8296 to 12d1ee2 Compare August 21, 2026 05:14
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready after exact-head CI for 12d1ee261330170109bf994bc44231a84572cd8b.

The two changed UI suites preserve all 11 existing tests and assertions while replacing 17 default 50 ms Vitest polling intervals with the existing 1 ms waitForFast helper. On the same Blacksmith Testbox, one worker, isolated filesystem caches, and excluded warmups, retained end-to-end wall times improved from 2.94 s / 3.09 s to 2.59 s / 2.45 s: 3.015 s to 2.520 s mean wall, 16.4% faster. Test-body time improved from 820 ms / 821 ms to 33 ms / 32 ms: 96.0% faster. Import counts and all test counts stayed unchanged.

Intended-fault proof: removing the lazy controller's authoritative current-request assignment makes the preserved loading-state regression fail; the production owner was immediately restored. Focused coverage passed 60 UI owner/sibling tests plus four real Chromium stale-chunk recovery tests. The complete pnpm check:changed gate passed on the same Blacksmith Testbox, focused tests passed again after rebasing, and both pre-commit and exact-branch structured reviews reported no actionable findings.

Production LOC: +0/-0. Test LOC: +19/-17. No timeouts increased, assertions weakened, snapshots/baselines changed, or runtime boundaries mocked.

Blacksmith benchmark/focused/full-gate evidence: https://github.com/openclaw/openclaw/actions/runs/32447826685

Exact-head PR CI: https://github.com/openclaw/openclaw/actions/runs/32449817759

@steipete
steipete merged commit 3cf3358 into main Aug 21, 2026
93 checks passed
@steipete
steipete deleted the perf/lazy-ui-test-polling branch August 21, 2026 05:23
@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

app: web-ui App: web-ui maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant