Skip to content

test(ui): wait for the lazy native menu before asserting its trigger - #141533

Merged
steipete merged 2 commits into
mainfrom
steipete/upg-ui-dedupe
Sep 7, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/upg-ui-dedupe

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

ui/src/app/native-link-routing.lazy.test.ts (from #140988 earlier today) failed the UI shard and reproduces locally about one run in five: it reads the lazily appended openclaw-native-link-menu synchronously after vi.dynamicImportSettled(), but showMenu appends in the continuation after its awaited import, which can run one microtask later.

Why This Change Was Made

Wait for the element before asserting its trigger. The product's generation-token logic (request !== menuRequest) is correct — the later right-click wins; only the test's synchronous read was wrong. No assertion changed. Ten consecutive local runs pass.

User Impact

None. Test-only; production LOC 0.

Evidence

  • ui/src/app/native-link-routing.lazy.test.ts: 10 consecutive local runs pass after the change (about 1 in 5 failed before).
  • Exact-head CI green on the merged head.

Note on scope

This PR was opened to delete the twice-landed markdown-streaming-parts.test.ts (#141466 vs #141485), but #141519 removed it first; after rebasing, this PR's merged content is the flake fix above only. The squash title predates that and is wider than the change.

Related: #140988 #141519 #141494

#141466 moved the toStreamingMarkdownParts and indented-source suites into
markdown-streaming.test.ts; #141485 then landed the same 16 cases again as
markdown-streaming-parts.test.ts during the concurrent max-lines split. The two
files differ only in whether htmlFragment is imported or inlined. Keep the copy
that shares the test-support helper and drop the other.
@clawsweeper

clawsweeper Bot commented Sep 7, 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.

@steipete
steipete marked this pull request as ready for review September 7, 2026 20:19
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Sep 7, 2026
@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 Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 4:36 PM ET / 20:36 UTC.

ClawSweeper review

What this changes

Removes duplicate streaming Markdown tests and makes the native-link menu test wait for its asynchronously created element before checking the latest right-click target.

Merge readiness

✅ Ready for maintainer review

Keep open: the duplicate-suite deletion already landed through #141519, but the new lazy-menu synchronization fix remains useful and is absent from fetched main. No actionable patch defects found; the maintainer-protected PR also remains outside automatic cleanup.

Priority: P3
Reviewed head: df23c600253dec1e6deb5b14313a027eaeb6ac84

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test cleanup with equivalent coverage retained and a sound asynchronous wait; no blocking defects found.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR changes only test discovery and assertion synchronization; the contributor runtime-proof gate does not apply, and reported test runs remain supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR changes only test discovery and assertion synchronization; the contributor runtime-proof gate does not apply, and reported test runs remain supplemental validation.
Evidence reviewed 7 items Introduced scope and re-review continuity: The complete host-pinned introduction contains only the duplicate test deletion and the menu wait. Compared with the previous reviewed head, only the five-line synchronization addition is new; the previous review retained no findings.
Deleted coverage is retained: Read the surviving suite and compared its complete describe-block suffix with the deleted merge-base file using a read-only Python comparison: identical. The shared htmlFragment helper has the same implementation, and ui/vitest.config.ts retains general unit-test discovery.
Wait matches the production completion boundary: The routing owner awaits the menu import, rejects superseded or disposed requests, sets the trigger, and then appends the element. The revised test retains checks for the latest trigger, exactly one append, and exactly one import; it adds no production retry or timeout increase.
Findings None None.
Security None None.

How this fits together

Control UI tests protect streamed Markdown rendering and native-app link menus. These changes retain rendering coverage and synchronize a menu assertion with the DOM update after a lazy import.

flowchart LR
  A[Markdown fixtures] --> B[Streaming renderer]
  B --> C[Retained rendering assertions]
  D[Simulated right clicks] --> E[Lazy native menu import]
  E --> F[Menu element appears]
  F --> G[Latest target and single append assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -279. Total -279 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 5 284 -279
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 5 284 -279

Review metrics

None.

Technical review

Best possible solution:

Keep one canonical streaming Markdown suite and synchronize the lazy-menu test with element creation while preserving its latest-request and single-append assertions.

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

The duplicate coverage is directly verifiable from source. The menu timing failure is supported by the asynchronous owner and reported repeated runs, but was not independently reproduced in this read-only review.

Is this the best way to solve the issue?

Yes. Equivalent rendering assertions remain intact, and waiting for the menu element observes the actual completion boundary without relaxing the subsequent behavioral assertions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0ad318398e90.

Labels

Label justifications:

  • P3: This is test-only deduplication and synchronization cleanup with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR changes only test discovery and assertion synchronization; the contributor runtime-proof gate does not apply, and reported test runs remain supplemental validation.

Evidence

What I checked:

  • Introduced scope and re-review continuity: The complete host-pinned introduction contains only the duplicate test deletion and the menu wait. Compared with the previous reviewed head, only the five-line synchronization addition is new; the previous review retained no findings. (ui/src/app/native-link-routing.lazy.test.ts:61, df23c600253d)
  • Deleted coverage is retained: Read the surviving suite and compared its complete describe-block suffix with the deleted merge-base file using a read-only Python comparison: identical. The shared htmlFragment helper has the same implementation, and ui/vitest.config.ts retains general unit-test discovery. (ui/src/components/markdown-streaming.test.ts:8, df23c600253d)
  • Wait matches the production completion boundary: The routing owner awaits the menu import, rejects superseded or disposed requests, sets the trigger, and then appends the element. The revised test retains checks for the latest trigger, exactly one append, and exactly one import; it adds no production retry or timeout increase. (ui/src/app/native-link-routing.ts:223, df23c600253d)
  • Partial overlap already on main: Provided GitHub metadata verifies test(ui): remove duplicate streaming Markdown coverage #141519 merged as 5180c45. Fetched main lacks the redundant file but still reads the menu immediately after dynamicImportSettled, without this PR's wait. (ui/src/app/native-link-routing.lazy.test.ts:60, 0ad318398e90)
  • Merged cleanup provenance and release check: The duplicate deletion commit is dated 2026-09-07T13:22:53-07:00. The local tag-containment check returned no release tags, so release inclusion is not established; this supports only the observed fetched-main overlap. (5180c4569c5d)
  • Validation and inspection limits: The captured PR body reports the surviving suite passing and ten consecutive lazy-menu test passes; provided checks show all three UI unit shards successful. No tests were executed during this read-only review. Live GitHub refresh failed because network resolution was unavailable, and deeper follow/blame traversal encountered unavailable objects; local source inspection and bounded commit history succeeded. (df23c600253d)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-07T20:25:06.071Z sha 209b095 :: needs maintainer review before merge. :: none

showMenu appends the native link menu in the continuation after its awaited
dynamic import, and that microtask can run after vi.dynamicImportSettled()
resolves. The assertion read the element synchronously and failed about one
run in five on the UI shard. Wait for the element; every assertion is unchanged.
@steipete
steipete merged commit aa83b75 into main Sep 7, 2026
81 of 83 checks passed
@steipete
steipete deleted the steipete/upg-ui-dedupe branch September 7, 2026 20:41
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete steipete changed the title test(ui): remove the duplicate streaming markdown suite test(ui): wait for the lazy native menu before asserting its trigger Sep 7, 2026
steipete added a commit that referenced this pull request Sep 7, 2026
…dget (#138666)

Fixes #138590.

Measure composer, sessions, session-detail, and usage context displays against a validated last-run prompt budget. Gateway checks session, model/provider, and effective-cap provenance; context-window changes invalidate derived telemetry and session events clear obsolete budgets. Preserve current-cap fallback and approximate-token warning behavior.

Retain the original contributor's implementation history and complete the stale-budget repair at its Gateway owners. Label the estimate as a last-run prompt budget rather than promising a specific compaction threshold.

Validation: 584 focused tests and real Chromium/mock-Gateway before/after and live-update proof. Final required CI passed on 47f32b9 after one unchanged-job rerun for a documented unrelated temporary-directory teardown race. Main QA repairs #141533 and #141555 are included.

Co-authored-by: Peik S. <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: DasX <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
)

* test(ui): remove the duplicate streaming markdown suite

openclaw#141466 moved the toStreamingMarkdownParts and indented-source suites into
markdown-streaming.test.ts; openclaw#141485 then landed the same 16 cases again as
markdown-streaming-parts.test.ts during the concurrent max-lines split. The two
files differ only in whether htmlFragment is imported or inlined. Keep the copy
that shares the test-support helper and drop the other.

* test(ui): wait for the lazy native menu before asserting its trigger

showMenu appends the native link menu in the continuation after its awaited
dynamic import, and that microtask can run after vi.dynamicImportSettled()
resolves. The assertion read the element synchronously and failed about one
run in five on the UI shard. Wait for the element; every assertion is unchanged.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
…dget (openclaw#138666)

Fixes openclaw#138590.

Measure composer, sessions, session-detail, and usage context displays against a validated last-run prompt budget. Gateway checks session, model/provider, and effective-cap provenance; context-window changes invalidate derived telemetry and session events clear obsolete budgets. Preserve current-cap fallback and approximate-token warning behavior.

Retain the original contributor's implementation history and complete the stale-budget repair at its Gateway owners. Label the estimate as a last-run prompt budget rather than promising a specific compaction threshold.

Validation: 584 focused tests and real Chromium/mock-Gateway before/after and live-update proof. Final required CI passed on 47f32b9 after one unchanged-job rerun for a documented unrelated temporary-directory teardown race. Main QA repairs openclaw#141533 and openclaw#141555 are included.

Co-authored-by: Peik S. <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: DasX <[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 maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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