Skip to content

test(console): name the focused element when the mobile drawer check fails - #2938

Merged
freeqaz merged 2 commits into
mainfrom
test/drawer-focus-diagnostics
Oct 19, 2026
Merged

freeqaz merged 2 commits into
mainfrom
test/drawer-focus-diagnostics

Conversation

@freeqaz

@freeqaz freeqaz commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Finding 2016: Console Browser went red once on #2255 (run 39250245319, job 118052053777) at tests/browser/console.test.mjs:846, the unlabelled check that the reopened mobile drawer's Agents link holds focus right after the toggle click. It failed as false !== true, so nothing says what held focus instead. The test failed once in 1,734 runs, during the 10-19 runner slowdown.

Change

Test-only. A focusSettles(locator, settleMs) helper samples document.activeElement and describes it (tag, role, class, accessible text, detached or not).

  • Opened-drawer check (the flake): waits up to 1 s for focus to reach the Agents link (or the Settings item in the account-menu case). If it settles after starting elsewhere, the test logs a diagnostic with the first sample. On failure the message names the target, what holds focus, the first sample and the drawer's aria-expanded.
  • Post-release check: keeps its single strict sample (no settling) and now names what holds focus too.

openDrawer focuses the first nav link synchronously, so the 1 s wait only covers a click that lands while the shell is being replaced. A real focus move would still fail, and the message now says where focus went.

Verification

  • Mutant: openDrawer with no focus call fails with The opened drawer focuses its navigation link <a> "◇Agents"; focus is on <body> (first check: <button class="mobile-toggle"> "Open navigation"; drawer true).
  • Repro attempts: the three mobile-drawer tests 25/25 on 1 CPU and 20/20 on 1 CPU shared with a busy loop. No failure, and focus never settled late.
  • Pinned at 2 CPUs (taskset): the three mobile-drawer tests 20/20. Full console.test.mjs 48/48. Repeated on the final head after the review nits: the class is read with getAttribute (an SVG element's className is an object), and the drawer state is read only on failure.

Risks

Low. Test-only. The opened-drawer check now tolerates up to 1 s of focus elsewhere before failing, and logs it when that happens. The post-release "keeps focus" check is unchanged.

…fails

Finding 2016: console.test.mjs:846 failed once as 'false !== true', so the
element that held focus was unknown. The opened-drawer check now waits up
to 1 s for focus to reach the Agents link (or Settings item), logs a
diagnostic when it settles after starting elsewhere, and names the
focused element, the first sample and the drawer state on failure. The
post-release check keeps its strict single sample and names the focused
element too.
@freeqaz
freeqaz requested a review from a team as a code owner October 19, 2026 13:23
@clawsweeper

clawsweeper Bot commented Oct 19, 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds focused-element descriptions and bounded initial focus polling to two existing mobile-drawer browser tests.

Example: The mobile drawer opens but focus remains on the page body.

  • Before: The assertion reports false !== true.
  • After: The failure names the expected Agents link, the body holding focus, the first observed element, and the drawer state.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused test improvement with no identified defect; confidence rests on source review and reported browser-harness validation, with exact-head browser CI still running.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only change is outside the ordinary live-proof gate; the body reports mutation sensitivity and browser-suite runs, while inspected screenshots concern the linked Secret-access feature and do not demonstrate drawer diagnostics.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Contributors investigating a mobile-drawer test failure cannot tell which element held focus.
Reason: Actionable failure diagnostics have clear maintenance value, and the maintainer-authored PR records the assertion-timing choice.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it provides useful browser-test diagnostics, preserves the strict post-render focus check, and introduces no identified defect.

Priority: P3
Reviewed head: 615d6b1bd1064a2e93bc0c427cee420ef141a50a

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The reported intermittent failure was not reproduced; this test-only change adds no production behavior requiring a new end-to-end scenario.
Agent review details

How this fits together

The browser suite opens the controller-backed Console with fixture storage and Drivers, holds a Namespaces response, and checks drawer state and keyboard focus around the resulting render.

flowchart LR
  A[Browser test] --> B[Controller fixture]
  B --> C[Console mobile drawer]
  C --> D[Focus samples]
  D --> E[Assertion diagnostics]
Loading

Technical review

Best possible solution:

Retain the focused diagnostics and bounded initial wait while preserving strict focus verification after the held response completes.

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

The original intermittent focus failure has no reliable reproduction: the author reports unsuccessful constrained-CPU attempts, and the available job metadata establishes only that the cited browser job failed.

Is this the best way to solve the issue?

Extending the existing behavioral checks is proportionate, and the drawer contributor explicitly accepts bounded initial settling while preserving the consequential post-render assertion.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 40676a7fed34.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Review metrics

Metric Value Why it matters
Change scope Production +0/-0; tests +47/-6 The growth supplies shared sampling and diagnostics for existing cases without adding production seams or duplicate test groups.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This improves contributor-facing test diagnostics without changing production 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-19T13:36:48.195Z sha 4f46a23 :: needs maintainer review before merge. :: none

Reviewed October 19, 2026, 9:45 AM ET / 13:45 UTC (Revision 2).

…drawer state only on failure

Review nits on finding 2016's helper: an SVG element's className is an
object, and the drawer's aria-expanded was read even when the check
passed.
@freeqaz

freeqaz commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@freeqaz
freeqaz merged commit 7afa66c into main Oct 19, 2026
48 checks passed
@freeqaz
freeqaz deleted the test/drawer-focus-diagnostics branch October 19, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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