Skip to content

fix(tests): Usage scroll proof fails when the page title briefly leaves UI Automation after a resize - #2175

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-usage-scroll-proof-flake
Nov 13, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-usage-scroll-proof-flake

Conversation

@bkudiess

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: the Usage scroll-proof fixture check (UsageHero_ViewportRemainsAnchoredWhileTheCardScrollsAway) fails intermittently with "Missing Usage title during scroll proof." when the page title briefly leaves UI Automation after the test resizes the window.

User Impact

No user-visible change. Mock Gateway fixture shard B stops failing on this test.

Why This Change Was Made

The test resizes the window to 1400 DIP and waits only for the window width. Its scroll poll then threw on the first UsagePageMarker lookup that came back empty, because WaitUiAsync swallows only ElementNotAvailableException. The Usage page is a plain, non-virtualized PageScroll, so the title stays in the UI Automation tree when it scrolls away. A missing title is therefore a transient: most likely the page re-rendering after the resize. That cause is inferred, not reproduced. The test now records the scroll host's and the live page root's runtime IDs, so a future failure shows whether the page was replaced.

Changes:

  • The two-sample settle from fix(tests): Usage hero fixture check fails when a Usage element briefly leaves UI Automation after a resize #2165 (fix(tests): Usage hero fixture check fails when a Usage element briefly leaves UI Automation after a resize) becomes the shared WaitForSettledUsageHeroLayoutAsync. That test now uses the helper, with no behavior change.
  • After the resize, this test reads the scroll host from a settled layout.
  • At the top of the page, it reads the hero, range and title from a settled layout, and takes the scroll host and pattern from that layout.
  • The scroll poll records a missing title and polls again. Only a found title that is offscreen or has moved up proves the scroll.
  • The checks after the wait use the captured title.
  • The timing-pattern baseline for this file drops from 38 to 31.

Evidence

  • RED: main plus one injected missing title lookup on the first scroll poll fails with the CI signature: System.InvalidOperationException : Missing Usage title during scroll proof.
  • GREEN: this change plus the same single injected miss passes. The injection was temporary and is not committed.
  • Clean runs:
    • 5 of 5 consecutive clean passes (10 s each) before the review follow-up;
    • 3 of 3 on the final head;
    • the real-shell hero test that shares the helper passes.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • none: test-only change to a mock Gateway fixture UI test. CI runs it natively in fixture shard B.

Validation

Local, head df04485 on main e9ed3ba, isolated OPENCLAW_TRAY_* profile. Native runs held the exclusive native-desktop lock, and the real %APPDATA% and %LOCALAPPDATA%\OpenClawTray metadata manifests were unchanged.

Command Result
Scroll proof, RED (main plus injected miss) ❌ Missing Usage title during scroll proof. (expected)
Scroll proof, GREEN (fix plus the same injection) ✅ 1 passed
Scroll proof, clean ✅ 5 of 5, then 3 of 3 on the final head
UsageHero_RealShellCapturesCardAndRangeInLightAndDark (shared helper) ✅ passed
scripts\validate-test-timing-patterns.ps1 ✅ pass; baseline is 31
./build.ps1 ✅ pass
dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj ✅ 5862 passed, 29 skipped
dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj ✅ 6444 passed
git diff --check ✅ pass

Hanselman dual review (Claude Opus 5.5 and GPT-6 Astra, high effort), with a delta re-review of the final head: no blocking issues.

  • Fixed:
    • the scroll host could be stale after a re-render, so it is re-acquired from the at-top settled layout;
    • the scroll pattern is now acquired inside a wait.
  • Disclosed: the injected RED shows how the test handles a missing title. It does not reproduce the re-render, which is why the cause is called inferred.

Real Behavior Proof

  • Environment tested: local Windows 11 interactive desktop (exclusive native-desktop lock), fixture Gateway, isolated profile.
  • PR head or commit tested: df04485 (base main e9ed3ba)
  • Exact steps or command run: dotnet test tests\OpenClaw.Tray.UITests -c Debug -r win-x64 -p:DevBuild=false --filter "FullyQualifiedName~UsageHero_ViewportRemainsAnchoredWhileTheCardScrollsAway", with the fixture environment that scripts\test-gateway-fixture.ps1 sets.
  • Evidence after fix: RED failed with the CI message; GREEN and the clean runs passed, as in the table above.
  • Observed result: one missing title peer during the scroll no longer fails the proof, and the proof still requires the found title to move or go offscreen.
  • Screenshot or artifact links verified? N/A
  • Not verified or blocked: the full fixture shard was not run locally; CI runs shard B natively.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? No
  • Data access scope changed? No
  • If any answer is Yes, explain the risk and mitigation: N/A

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? No
  • Migration needed? No
  • If yes, list the exact upgrade steps: N/A

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

…es UI Automation after a resize

UsageHero_ViewportRemainsAnchoredWhileTheCardScrollsAway threw from its scroll
poll when the UsagePageMarker lookup missed once. Read the scroll host and the
at-top hero layout from settled samples after the resize, treat a missing title
during the scroll poll as not ready, and use the captured title afterwards.
Extract the two-sample settle from the real-shell hero test so both tests share it.

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

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🦞👀
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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR makes the Usage scroll test tolerate a transient missing title and share the existing layout-settling helper.

Example: After resizing Usage to 1400 DIP, the first title lookup during scrolling returns no element.

  • Before: The test immediately throws "Missing Usage title during scroll proof."
  • After: The test polls again and passes only after finding a title that has moved upward or gone offscreen.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused test repair with reported native RED/GREEN validation and no concrete defect; the original resize cause is inferred and the exact-head fixture checks remain in progress.
Proof confidence 🦐 gold shrimp (3/6) This test-only change requires no shipped-behavior proof; supplied native fixture results cover the missing-lookup repair and shared helper, and no target code was executed during this read-only review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Maintainers encounter an intermittent Usage fixture failure when a title lookup briefly returns no element.
Reason: This maintainer-authored repair removes an immediate test failure while retaining the behavior the test must prove.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR repairs a failure path still present on main while preserving the scroll assertions. No actionable introduced defect was found; checks remain in progress.

Priority: P2
Reviewed head: df044851ea6b1466898a7476e875917cb946aaf4

Before merge

None.

Findings

None.

Agent review details

How this fits together

The native Usage fixture tests drive the real Windows app through UI Automation against synthetic Gateway data and produce layout assertions and diagnostic artifacts.

flowchart LR
  A[Fixture Gateway] --> B[Native Usage page]
  C[Fixture UI test] --> D[UI Automation]
  D --> B
  D --> E[Settled layout samples]
  E --> F[Scroll assertions and artifacts]
Loading

Technical review

Best possible solution:

Retain the existing UI test owner, reuse its settled-layout sampling, and retry missing title observations without relaxing the scroll contract.

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

Source confirms that one missing title lookup escapes the poll as InvalidOperationException; supplied injected RED/GREEN results exercise that path, while the underlying resize transient remains inferred.

Is this the best way to solve the issue?

The change fits the existing owner and preserves independent scroll assertions; sharing the established settling implementation avoids a competing readiness path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 90653249bd8a.

Provenance checked

  • Usage scroll observations and assertions keeps the original intent (9d36f5c: The Usage feature added native layout and scrolling proof; this PR preserves that proof while changing transient lookup handling.)
  • Settled hero-layout sampling and timing baseline keeps the original intent (30e8a49: The earlier repair required consecutive matching geometry samples to survive missing peers after resizing; extraction preserves its algorithm and lowers the baseline.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Raw commit 9d36f5c adds tests/OpenClaw.Tray.UITests/GatewayFixtureUiTests.UsageResponsive.cs:462 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9d36f5c8bfa0; files: tests/OpenClaw.Tray.UITests/GatewayFixtureUiTests.UsageResponsive.cs)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Scope Production +0/-0; test code +58/-32; baseline +1/-1 Growth stays within the existing fixture and supports shared settling, captured peers, and failure diagnostics.

Labels

Label changes:

  • add P2: Repairs an intermittent native fixture failure with limited impact on development validation and no changed product behavior.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Repairs an intermittent native fixture failure with limited impact on development validation and no changed product behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • 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 13, 2026, 1:38 PM ET / 18:38 UTC.

@bkudiess
bkudiess merged commit d767009 into openclaw:main Nov 13, 2026
34 checks passed
karkarl added a commit to karkarl/openclaw-windows-node that referenced this pull request Nov 13, 2026
Resolves conflicts with openclaw#2173 (session dashboard tab beside chat), openclaw#2176, openclaw#2175, openclaw#2116 and openclaw#2172:

- ReactorBoardView: embedded board keeps main's compact 12/0 padding, standalone pages keep the shared PageResponsiveLayout PaddingTop/PaddingBottom.
- Resources.resw (all 6 locales): keep this PR's PageAction_Refresh keys and main's Chat_Panel_Dashboard.
- TestTimingPatternBaseline.json: main's counts, then lowered for this branch.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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