Skip to content

improve(test): speed up config save browser tests - #192116

Merged
roboclaw-bot merged 1 commit into
mainfrom
test-health/ui-config-clock
Nov 3, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
test-health/ui-config-clock

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Related: #191958 (clock and owner-proof precedent)

What Problem This Solves

Config-save browser tests spend real time waiting through secret-field idle windows and saved-revision polling.

User Impact

No user-visible change. The same 14 cases pass faster: summed file medians fall from 54.607s to 46.819s, saving 7.788s (14.26%) on the measured Testbox.

Why This Change Was Made

Install the existing Playwright page clock before navigation. Advance every original 1.5s/1.2s secret idle window in full, retaining the zero-write assertions, then resume normal time for neighbor autosave. Advance time between Apply-status reads so the real config polling owner, mock WebSocket responses, and promise settlement still determine the result.

Typed, cleared, template/include, Cancel, exact Save payloads, RPC acknowledgments, Saved-before-Apply, external-edit/reload values, and all geometry assertions remain. No production change, direct refresh, fabricated state, timeout change, or injection seam.

The resize comparison now waits for the shell's actual CSS transition to finish before taking its reference box. The earlier candidate exposed the existing same-frame stabilization poll accepting a still-moving layout; its failed geometry run is excluded from the final timing samples. The coordinate-stability poll and both exact box assertions remain.

The simplification pass kept this within the two existing test fixtures. Test delta +16/-4, net +12 lines; the requested config/test-lines-allocations/ui-config-clock.txt records the 12-line justification. Including that two-line record, the complete delta is net +14 lines. Production delta: zero.

Evidence

Three baseline and three final candidate runs used the same Blacksmith 16-class Testbox tbx_01m6h3yv7sfjwg54xn4r0bnef4, with frozen-lockfile installation: Testbox run 41674898066. All six measured runs passed all 14 cases. The file numbers below are native Vitest file durations, including hooks, rather than command wall time or a CI critical-path claim. Baseline source: 868609a3f6cb9d736d89b577b57ebedb899d5d4f. Candidate commit: 33800a46f58b063383e016526341c328b61775b0.

File under ui/src/e2e/ Baseline median Candidate median Saved
config-secret-field-save.e2e.test.ts 10.429s 7.324s 3.105s
config-safe-write.e2e.test.ts 44.178s 39.495s 4.683s
Three samples and relevant case medians
File Baseline samples (s) Candidate samples (s)
config-secret-field-save.e2e.test.ts 11.536 / 10.429 / 10.106 7.324 / 7.302 / 8.618
config-safe-write.e2e.test.ts 44.178 / 45.918 / 40.470 39.957 / 39.495 / 37.034
Case Baseline median Candidate median
reports autosave without moving the page and preserves untouched 64-bit identifiers through reload 6.774s 2.952s
preserves a refreshed external edit after reverting a retained Raw draft 6.027s 3.569s
holds a secret field while the field beside it keeps autosaving 3.416s 2.249s
replaces a stored secret on Save, and leaves it alone on Cancel 2.193s 1.423s
keeps a stored secret read-only when the file holds a template or an include 3.818s 2.237s
keeps the edit when Save is refused, and when leaving the page 0.981s 1.546s

Command, repeated three times per version:

corepack pnpm test:ui:e2e ui/src/e2e/config-secret-field-save.e2e.test.ts ui/src/e2e/config-safe-write.e2e.test.ts --maxWorkers=1 --reporter=default --reporter=json --outputFile.json=<sample-report>

All paired mutation controls ran on the same Testbox. Mutations changed production behavior temporarily and were restored between executions. Killed means the existing test failed; survived means the selected existing tests passed.

File Product mutation Baseline Candidate
Secret field Send the held secret through config.patch after 750ms, inside the claimed idle window Killed: zero-write assertion Killed: same assertion
Secret field Disable config.apply submission Survived: 4 passed Survived: 4 passed
Secret field Replace the field Save patch with {} Killed: exact patch assertion Killed: same assertion
Safe write Send held secrets early Survived: 10 passed Survived: 10 passed
Safe write Disable config.apply submission Killed: Apply RPC wait Killed: same wait
Safe write Replace submitted config bytes with {} Killed: identifier and exact payload assertions Killed: same assertions
Safe write Drop refresh adoption while a draft is dirty Killed: original-api instead of external-api Killed: same assertion
Safe write Disable the applied-revision polling owner Killed: both targeted Apply-status waits Killed: same waits

The two cross-file survivors also survive on unchanged baseline tests. The other file owns the missing behavior and kills the same mutant in both versions:

  • Early secret writes are owned by “holds a secret field while the field beside it keeps autosaving” in config-secret-field-save.e2e.test.ts: expect(await gateway.getRequests("config.patch")).toHaveLength(0) fails with one early request. The cleared-secret case also fails its zero-write assertion. Safe-write has no secret field.
  • Apply submission is owned by “edits schema and raw config with guarded set, patch, reload, and apply requests” in config-safe-write.e2e.test.ts: it awaits gateway.waitForRequest("config.apply") and asserts expect(applyParams.raw).toBe(rawDraft). Disabling Apply fails that RPC wait on both versions. The secret-field file does not apply config.

No baseline kill became a candidate survival. All 12 matrix executions completed. Five production input hashes were checked against the local frozen source; all 13 product restorations and both final test-file restorations were verified by SHA-256. No mutant or probe is committed.

Scoped format, lint, and two-file typecheck passed on Testbox. Final isolated Codex autoreview of the complete local candidate against the base above: P0–P2, scoped-clean, no actionable findings. Its unchanged context omitted the secret-owner file because the review helper rejects that filename; the changed tests, mock Gateway, and timer/config owners were included. Runtime and mutation proof were collected separately.

All browser executions, installs, builds, and checks ran on Testbox. No browser/container run, broad suite, dependency install, or broad lint/typecheck ran on the production Team host. The owned Testbox was stopped after proof. PR CI supplies broad validation. No merge is requested.

Advance full secret idle windows and applied-revision polling with the page clock while preserving RPC, payload, and geometry assertions. Wait for the real resize transition before recording the reference geometry.

Co-authored-by: steipete <[email protected]>
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR advances browser clocks through config-save waits and waits for the resize transition before comparing geometry.

Example: The browser test types partial-token into Api Token.

  • Before: It waits 1,500 milliseconds before checking that no config write occurred.
  • After: It advances the browser clock through the same 1,500 milliseconds and retains both zero-write assertions.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, coherent test optimization with detailed paired timing and mutation evidence, preserved assertions, and no identified correctness defect.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored, test-only PR changes no shipped behavior; its body supplies exact-revision browser benchmark samples and paired mutation results, while raw linked logs remain inaccessible from this review environment.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Config-save browser tests spend unnecessary real time waiting through idle and polling windows.
Reason: The maintainer-authored direction is established, the change is narrow, and the supplied measurements show a useful reduction while retaining the same assertions.

Merge readiness

✅ Ready for maintainer review

This PR is a focused test-speed improvement that preserves existing assertions; no actionable defect was found.

Priority: P3
Reviewed head: 33800a46f58b063383e016526341c328b61775b0

Before merge

None.

Findings

None.

Agent review details

How this fits together

The browser tests drive Settings forms against a mock Gateway, exercising production UI timers and checking RPC payloads, save status, reload values, and geometry.

flowchart LR
  A[Browser test] --> B[Playwright page clock]
  B --> C[Settings UI timers]
  C --> D[Mock Gateway]
  D --> C
  C --> E[Status and geometry assertions]
Loading

Technical review

Best possible solution:

Keep the existing fixtures and production owners while advancing complete timer windows and preserving every behavioral assertion.

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

This is test optimization rather than a product bug; source confirms the original real waits, and the PR supplies paired benchmark results that were not rerun during this read-only review.

Is this the best way to solve the issue?

The change uses the existing page-clock capability, retains complete idle windows and production polling, and introduces no parallel owner or test-only production seam.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5a4da85b672b.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned change and preserved assertions: The introduced diff replaces three real idle waits with equal clock advances, installs clocks in existing fixtures, advances Apply polling, and waits for shell animations; it removes no assertion or production behavior. (ui/src/e2e/config-secret-field-save.e2e.test.ts:99, 33800a46f58b)
  • Polling remains owned by production code: The applied-config refresh owner schedules subsequent reads after promise settlement; the modified assertion advances time without invoking refresh directly or fabricating applied state. (ui/src/lib/config/applied-refresh.ts:29, 33800a46f58b)
  • Resize completion matches the layout owner: The shell transitions its grid columns and rows; waiting for its animations before recording the reference box preserves the subsequent coordinate-stability and exact-box checks. (ui/src/e2e/config-safe-write.e2e.test.ts:213, 33800a46f58b)
  • Supplied benchmark and mutation evidence: The PR body reports three baseline and three candidate runs of all 14 cases on the same Testbox, with summed file medians improving by 14.26%; its paired mutation matrix reports no baseline kill becoming a candidate survival. (33800a46f58b)
  • Raw-log inspection limitation: The linked Testbox workflow was cancelled after the reported proof collection and has no listed artifacts; reading its job log redirected to a storage host blocked by this review environment, so the raw benchmark and mutation logs were not independently inspected.
  • Current-main comparison: The fetched main revision retains the original versions of both tests and does not contain this clock optimization. (ui/src/e2e/config-safe-write.e2e.test.ts, 5a4da85b672b)

Likely related people:

  • Vyctor H. Brzezowski: Raw commit 716621b adds ui/src/e2e/config-secret-field-save.e2e.test.ts:82 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 716621b9f55b; files: ui/src/e2e/config-secret-field-save.e2e.test.ts)

PR surface

Tests +12, Other +2. Total +14 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 16 4 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 3 18 4 +14

Labels

Label changes:

  • add P3: This is a focused test-runtime improvement with no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is a focused test-runtime improvement with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 3, 2026, 12:19 PM ET / 17:19 UTC.

@roboclaw-bot
roboclaw-bot merged commit 54b9ecd into main Nov 3, 2026
86 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

@roboclaw-bot
roboclaw-bot deleted the test-health/ui-config-clock branch November 3, 2026 17:30
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
Advance full secret idle windows and applied-revision polling with the page clock while preserving RPC, payload, and geometry assertions. Wait for the real resize transition before recording the reference geometry.

Co-authored-by: steipete <[email protected]>
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant