Repository navigation
Conversation
…st, and the test no longer waits on jsdom frames Opening the card focuses Discard, its safe action, so a keyboard user lands on its answers. Focus also returns to Suggest when nothing could be applied. The test stubs requestAnimationFrame to a 0ms timer. ui-sdk's agent waits two frames per step, and jsdom's 60Hz frames stretched a staging past the 1000ms findBy limit under load.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The goal is to fix every
ui-sdkbranch bug we can fix on our side, so the branch is ready to land on main with no known issues. This PR closes two tracker follow-ups on/agent-staged:body(keyboard) or to the Region trigger (pointer). A keyboard user had to Tab back to Discard or Keep changes.agent-staged.test.tsxsometimes timed out when the full suite ran under load.What
Suggestionfocuses Discard. ui-sdk's popup focus rules (docs/popups.md, Focus) send an alert dialog's initial focus to its first Close part. Discard is the card's safe action (approval.tsx: "a slip lands on the button that does nothing"). Focus still returns to Suggest after Discard or Keep. It now also returns to Suggest when nothing could be applied (unapplied), because Suggest was disabled while it had focus.requestAnimationFramewith a 0ms timer. ui-sdk core'sagent.actwaits two frames per step (@ui-sdk/core/dist/page/agent/agent.jsframes()). One staging runs 16 frames. jsdom's frames are 60Hz wall-clock timers, so each staging spent about 165ms just waiting. Under CPU load, one staging took 1060ms, past React Testing Library's (RTL) 1000msfindBylimit.Verification
vpr checkpassed on the head commit.vpr buildpassed.vpr testpassed in all 5 full-suite runs (545 passed, 1 expected fail).Per-test times in the full suite, in ms:
Time from pressing Suggest to the card appearing, measured with a temporary probe:
File alone with
--repeats=19: eight runs passed. Back to back on the same load, 20 repeats took 24.2s and 30.7s before, and 8.4s and 13.5s after.Real browser: Playwright on a static flagged build (
VITE_AGENT_BRIDGE=1), with the_devguard and prerender patched for that build only. Those patches are not in this PR. Both themes passed:shots/E-staged/keyboard-review-{light,dark}.png,keyboard-discarded-*,keyboard-kept-*,pointer-review-*, plusreport.json.Tradeoffs
waitFor. Its focus comes from a passive effect, and in about 1 of 100 repeatsfindByRoleresolved before that effect ran.Tracker
agent-staged.test.tsxtimes out": fixed. Cause: ui-sdk's agent waits two frames per step on jsdom's 60Hz wall-clock frames. The test stubs rAF with a 0ms timer, and staging dropped from about 165ms to about 30ms.