Skip to content

ui-react: diagrams-renderer webkit per-figure actions can be clicked before they render #2946

Closed

Description

@schlessera

Context

Main CI browser (2) on 2c83cd2f1 (run 40228351245, job 121274778244) failed one case in the diagrams-webkit project:

packages/ui-react/tests/browser/diagrams-renderer.layout.tsx › "per-figure SVG PNG and PDF actions use the exis…" — TypeError: undefined is not an object (evaluating 'convertToLocator(element).click') at diagrams-renderer.layout.tsx:66:155.

2674 of 2675 browser tests passed; the commit only changed three unrelated ui-react fixtures (#2928). The element passed to the second click was undefined. A menu render/lookup ordering race is a source-supported hypothesis, not yet a demonstrated causal schedule or exclusion of menu-close/reset behavior.

Acceptance criteria

  • Reproduce deterministically (e.g. delay the figure's action render) and confirm the lookup races the render.
  • Await the action's actual presence (a locator/role query that waits), without raising timeouts or adding retries; mutation shows the test still fails if the action never renders.

Verification

bun run test for the diagrams layout project, webkit included.

Scope

Identify and reproduce the menu-item absence at the per-format lookup, then make this fixture wait for the actual intended menu item before interacting, under the existing test deadline. Inspect every same-pattern lookup in this test/file. Keep the three format selections and real existing share/render path.

Out of scope

Product share behavior or export formats, raised deadlines, retries for green, weakened response/content/MIME assertions, removed formats, new provider calls, or changed browser/offline guards.

Source and archived failure review

At main c670449d3bf1b0639e50ce554d728961f4313add, the format loop (packages/ui-react/tests/browser/diagrams-renderer.layout.tsx:66) clicks the trigger then immediately snapshots all menu items and uses .find(...)! before the second click. The non-null assertion adds no runtime wait. The product opens the menu through setOpen (handleTrigger, packages/ui-react/src/components/share/share-menu.tsx:97-104) and renders items conditionally (same file:124-145). runOption also closes the menu and enters busy state (same file:77-87); the prior files.length wait is not by itself evidence of the next trigger’s settled state. Capture format, trigger disabled/expanded state, menu presence and fixture lifetime when introducing a controlled schedule; do not assume delayed figure rendering is the only trigger.

The archived browser (2) job log was fetched directly and confirms the stated WebKit test, TypeError and 66:155 location. It is a retained natural failure, not a fresh local browser reproduction. At that October 25 review, the deterministic trigger was still missing. The controlled delayed-open evidence below now supplies the narrow fixture synchronization premise; the historical invocation itself remains unattributed. Preserve the whole original format loop as the positive control and show that an intentionally absent requested item still fails at the ordinary deadline. Restore complete original navigator property descriptors and owned fixture state on failure.

Contract impact

None expected for the scoped fixture synchronization. A product cause requires a separately explicit owning scope rather than an inferred UI behavior change.

The controlled delayed-open failure below scopes this to browser-fixture synchronization, so its full deliverable advances #2753. Attach natively to that existing epic; no product menu change is included.

Archived raw job-log SHA-256: 55569d368a1c07d2d930639a3a7fd863ec0c5a25650ccc7b5a32aad1e2694314.

2026-10-25 triage at main c670449d3bf1b0639e50ce554d728961f4313add: Verified the archived natural WebKit failure and current immediate lookup/conditional-menu source. Completed the bounded scope, exclusions, synchronization/negative-control evidence requirement and contract statement; retained needs: repro because the causal schedule is not established. No browser pass or product cause is claimed.

Controlled delayed-open reproduction — 2026-10-29

Pinned main a8e80eea1ec045579ee7d69d6019bce5e78afa5e, frozen independently copied dependencies (lock SHA-256 5bbd5f6651f111db3fcfabeda512d44a21163cba54c58993f8878012d548cc14), Bun 1.4.4, Vitest 4.1.11 and the unchanged pinned Playwright 1.63.0 image, image ID sha256:eff16c30e6f3f4af0a03fa4b706120d5e9b0891c344a27d64559aff5900a4a27.

The complete unchanged WebKit file passes 16/16, no filtered/skipped cases, 17.58 seconds Vitest. Command: node scripts/visual.mjs --project=diagrams-webkit --filter=diagrams-renderer.layout --proof-report, with an owned scratch directory supplied through TMPDIR. Log SHA-256 f63ccfa4b7604d0b0c63598d3a1b468840c35e7ebc0d933230e69c9dbd0810db. The earlier attempt failed during native-producer dependency copying with EDQUOT before a browser test started; it is setup failure only, not this bug or a passing browser receipt.

For one controlled schedule, only the emitted packages/ui-react/dist/components/share/share-menu.js artifact changes temporarily: the multi-option trigger schedules its existing open-state toggle after 100 ms using the component's already-owned timer ref, instead of committing immediately. Busy/single-option branches, menu contents, original test source, all assertions/deadlines and navigator property-descriptor restoration remain unchanged. A browser trace confirms TRIAGE_SHARE_OPEN_SCHEDULED 100; no deferred commit occurs before the immediate lookup/click fails. The scheduled callback is owned by the existing unmount cleanup.

This complete-file control exits 1 with 15 pass / 1 fail, 13.77 seconds Vitest. The original per-figure case fails in 126 ms with the exact reported TypeError: undefined is not an object (evaluating 'convertToLocator(element).click') at 66:155. Log SHA-256 eb4d2765f87753100e31848472e416979df7a9b2f17ce7377a1480e7e52afcc8. The only controlled artifact hashes are original 0eb5d6658eae67409c0f764fc15b4da7e8fd8f819959e52c91e76636b2a745d0, delayed 9a78da038c7e4f0f27b44424e56673cd6f9d9e7ff6d97fde3e7f99efa6c27f54. The original artifact is restored byte-for-byte, and the authored working-tree diff is empty. This is an explicitly modified runtime control, not an unchanged-candidate pass.

The missing precondition is now demonstrated: awaiting the trigger click does not establish that the requested menu item is present when opening commits later. The repair remains fixture-only: await the actual intended item before clicking, under the existing deadline, and inspect all same-pattern immediate lookups. An intentionally absent item must still fail at that ordinary deadline. Preserve all SVG/PNG/PDF selections, real share/render requests, print-theme content, MIME/file assertions, navigator descriptors and cleanup; do not introduce product delays or retries.

The artificial delay does not reconstruct the historical WebKit scheduling or prove that every original occurrence had this cause. It supplies a source-bound causal fixture control and a bounded repair brief. Remove needs: repro, add agent-ready, retain p2/type test/areas, and add native parent #2753. No fixture/product implementation, publication, provider call or broader browser qualification is claimed by triage.

Restored complete-file control: exit 0, 16/16 pass, no skipped/filtered cases, 17.17 seconds Vitest; log SHA-256 107b0b4de64e59471cda3c640237eabbb099c2ee606b25e8515d3dd2358fc493. The original emitted artifact hash above is verified after restoration. This restored pass is separate from the induced failing schedule and does not erase the historical failure.

Activity

  1. added this to the 0.45.0 milestone on Oct 25, 2026
  2. added
    type: test
    area: ui-react
    priority: p2
    needs: repro
    area: ci
    on Oct 25, 2026
  3. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main c670449d3bf1b0639e50ce554d728961f4313add: Verified the archived natural WebKit failure and current immediate lookup/conditional-menu source. Completed the bounded scope, exclusions, synchronization/negative-control evidence requirement and contract statement; retained needs: repro because the causal schedule is not established. No browser pass or product cause is claimed.

  4. added
    agent-ready
    and removed
    needs: repro
    on Oct 29, 2026
  5. self-assigned this
    on Nov 3, 2026
  6. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Claimed for implementation (token claim-2946-bf816c7f), branch fix/2946-diagram-webkit-action-clicks from main 416ed8d8c. Verified at that main: #3410 (framed header actions) did not change the lookup — packages/ui-react/tests/browser/diagrams-renderer.layout.tsx:66 still clicks the trigger and immediately .find(...)!s the menu item; ShareMenu still opens via setOpen (handleTrigger, packages/ui-react/src/components/share/share-menu.tsx:97-104) and renders items conditionally (same file:124-143). Collision report for the cited files: closure-category overlaps only, no path collisions.

  7. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Draft PR #3493 (head dc2c2c6f7) waits for the requested share menu item before clicking it. Locally: the original test under a 100 ms delayed-open artifact reproduced the exact WebKit TypeError (15/1); the fix passes under that delay (16/16); an absent PDF item fails on SHARE_MENU_ITEM_RENDERED PDF at the ordinary poll deadline; the final head passes Chromium + WebKit 32/32. Hosted selected proof is pending; the PR stays a draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: ciarea: ui-reactpriority: p2type: test

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions