← Back to Pull requests

test(desktop): decide the WorkHub popup close in the main process #5918

Closed
unknown closed this pull request without merging on Oct 02, 2026 03:24 UTC
View on GitHub
unknown unknown commented on Oct 02, 2026 03:08 UTC
Author

Fixes #5917.

This is a test-only change to apps/desktop/e2e/workhub-layout.spec.ts. The spec closed the Workbar's native menu in two round trips. First it read the renderer's aria-expanded, then it called closePopup in a separate main-process evaluate. Linux can auto-dismiss that popup in between, and closePopup on a dead popup crashes the main process. The test then fails with "Target page … has been closed" or "session closed". That happened on #5906 and #5902, and both passed on rerun.

Change

  • Track the popup's own lifetime. The existing Menu.prototype.popup probe now also subscribes to the menu's menu-will-close event and records whether the popup is still open.

  • Check and close in one main-process task. The close step reads that flag and calls closePopup in the same task, so a dismissal can no longer land between the check and the call.

  • Renderer assertion unchanged. The existing expect(addPanel).not.toHaveAttribute('aria-expanded', 'true') still pins the renderer state afterwards.

  • Product code untouched. Product code never calls closePopup.
  • Verification

  • Static checks. Biome and format:check pass, and so does check:e2e-budget (34 tests in 20 files). Type-checking the spec reports no errors in the changed lines.

  • Not reproduced locally. The race depends on Linux native menu behaviour, so I couldn't reproduce it on Windows. Whether menu-will-close arrives in the same main-thread task as the native teardown, so that it closes the window fully rather than narrowing it, rests on Electron dispatching the event synchronously from the menu-closed callback. CI on this PR exercises the spec on Linux.
  • AI use

    Diagnosed and written with Claude Code; the commit carries a Co-Authored-By trailer.

    🤖 Generated with Claude Code

    Diff: 231 lines (+173 / -58) across 2 files Reviewer: M4n5ter Review duration: 15m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 231 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5918"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37% (MEDIUM) · Higher = larger blast radius
    37%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16% · Safe to merge
    16%
    Repository