Repository navigation
fix(annotate): pre-release QA fixes for the armed-mode interaction seams - #1363
Merged
Merged
Conversation
Six confirmed QA findings on the HTML/live annotate surface plus missing pi-extension resync coverage: 1. Armed pinpoint drifted click (>4px, no selection) was swallowed AND leaked to the page: the always-on drag work armed the trailing-click suppression on drift alone. The mouseup arming site now requires the drag to have actually produced a text selection; drifted clicks pin normally and never reach the page. Bridge tests for armed drift, armed real drag, and Interact drift. 2. Esc ladder: hover-clear is no longer its own rung; clearing the pinpoint outline and posting annotate-exit happen on the same press when no draft is open. Draft-close keeps its own press. 3. Compact touch layouts no longer apply a restored toolsHidden:true chrome cookie (both header toggles are desktop-only, so applying it stranded the user); the cookie value is preserved for desktop. 4. The live-app probe now announces the static-conversion downgrade on stderr when a loopback probe fails, naming --app to force live mode. 5. Live-app export: page group headers are now '## Page:' with '### N.' entries nested below them; exports without pageUrl stay byte-identical. 6. Shift+1-4 mode shortcuts no longer fire while the annotation toolbar's type-to-comment listener owns printable keys, so typing ! @ # $ into a starting comment cannot silently switch modes. Also adds the missing tests for the two resyncPhaseFromSession executing->idle fallbacks that arm idleNoticePending (verified by mutation: flipping either arm fails its test).
…red chrome guards Follow-up scope from the forensics sweep, same surface: - Compact touch layouts get Options-menu actions for the HTML/live surface: 'Annotate page'/'Interact with page' (the desktop pen and Mod+Shift+A were unreachable on touch, so every tap annotated with no way out) and 'Show tools'/'Hide tools' (the desktop eye). With the menu as the way back, the toolsHidden cookie now applies on compact again (desktop parity) instead of being ignored. - The annotate servers' stop() now guards every disposal step individually (Bun: runGuardedShutdown, mirrored inline in Pi): a throwing agent-terminal teardown (#1314-class) no longer skips liveProxy.stop() and the other disposals after it. Unit-tested with a throwing disposer. - Re-added the two regression guards dropped in the htmlHideTools -> htmlChrome test rename: the restore commit never writes stale pre-restore chrome values to the cookie, and the sidebar stays reachable via Mod+B while tools are hidden.
…only
The Display popover's 'Reset terminal display settings' button also called
onSideChange('left'), durably overwriting a user's chosen right/hidden
placement in config.json with no disclosure — the label scopes the reset
to font/appearance. Position is a layout preference with its own explicit
segmented control right below, so the reset no longer touches it: the
button now resets exactly the display settings through the panel's one
sanitized update path, and the popover no longer has any code path from
reset to the side.
AgentTerminalDisplayPopover is now exported with a defaultOpen test seam
(the surrounding panel needs a live WebTUI session to render it); tests
assert reset restores the display defaults without firing onSideChange,
and that the Position control remains the explicit way to change
placement.
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.
Pre-release fix round for v0.28.0: six confirmed QA findings on the HTML/live annotate surface and its export path, three additions from a parallel forensics sweep, plus missing pi-extension resync coverage. All changes branch off origin/main (81ecd67).
Findings and fixes
1. Armed pinpoint: drifted click swallowed AND leaked to the page (regression, root-caused)
The always-on drag work removed the pinpoint guard from the drag-yield mousedown listener, so pinpoint began arming drag-yield; mouseup then set the trailing-click suppression from >4px drift alone, and the pinpoint click handler consumed it before preventDefault. A trackpad click with a few pixels of travel neither pinned nor stayed off the page. Fixed at the arming site in
bridge-script.ts: the mouseup handler only arms the trailing-click suppression (and only schedules the drag-selection pass in armed pinpoint) when the drag actually produced a non-empty text selection. Drifted clicks pin normally and are prevented/stopped; real drags keep the selection-toolbar behavior; Interact is untouched. Bridge tests cover all three: drifted click while armed pins and never reaches page handlers, real drag opens the drag selection without a trailing re-pin, drifted click in Interact reaches the page. A Playwright smoke against real Chromium confirms the fix (and reproduces the leak on the pre-fix bridge).2. Esc-to-Interact needed two presses when hovering
Hover-clear is no longer a ladder rung: with no pending draft, one Esc clears the pinpoint hover outline and posts annotate-exit on the same press. Draft-close keeps its own press. Ladder tests updated, plus a new same-press hover test.
3. Compact/mobile stranding by a toolsHidden cookie (superseded by addition A below)
Solved together with the armed-mode stranding: the compact Options menu now carries the tools toggle, so the restored cookie stays applied on every layout and always has a way back.
4. Cold-dev-server silent downgrade
When the loopback live-app probe fails without
--app, the fallback to static conversion is kept but now emits one stderr line naming the URL, the probe error, and--appas the way to force live mode. Tested via the injectablelogseam, including the no-notice path for live-eligible probes.5. Live-app export heading inversion
Page group headers were
### Page:above## N.entries, nesting each page under the previous entry. Page-grouped exports now emit## Page:headers with### N.entries nested below (unpaged entries lead at the same entry level); exports without any pageUrl stay byte-identical to the classic## N.format. Export tests added for hierarchy, global numbering across groups, and the unchanged non-live format.6. Shift+1-4 shadowing type-to-comment
While the annotation toolbar's type-to-comment listener owns printable keys, the Shift+1-4 mode shortcuts (
! @ # $) no longer fire, so typing into a starting comment cannot silently arm Redline. The toolbar acquires a capture inannotationMode.shortcuts.tsfor the lifetime of its listener; the scope hook refuses to dispatch while any capture is held. Tests cover both directions: shortcut works with no toolbar, and!with the toolbar open starts a comment with the character intact and no mode change.Forensics sweep additions
A. Touch/compact devices could not disarm annotate mode (HIGH)
htmlAnnotateArmeddefaults true, but the pen and eye toggles are desktop-header-only and Mod+Shift+A is keyboard-only, so on touch every tap annotated and the page beneath was unreachable. The compact Options menu's Document section now carries both affordances, matching the existing compact idiom: "Annotate page"/"Interact with page" (newannotateaction id, pen icon) and "Show tools"/"Hide tools" (restoredtoolsaction id, eye icon). This also supersedes finding 3: with a reachable toggle, thetoolsHiddencookie applies on compact again (desktop parity) instead of being ignored. Tests: compact menu disarms and re-arms the mode (armed ring appears/disappears with no pen present), and atoolsHidden: truecookie is undoable through "Show tools".B. Live-proxy leak on shutdown (MEDIUM)
stop()disposed the agent terminal before the live proxy in a flat try with onlyserver.stop()in finally; a throwing disposal (agent-terminal teardown is historically fragile, see #1314) orphaned the proxy's listener and upstream WebSockets. Every disposal step is now individually guarded via an exportedrunGuardedShutdownhelper (failures logged with the step name, later steps and the listener close still run), mirrored inline in the Pi server's stop(). Unit tests: a throwing disposer does not skip later steps or the listener close.C. Dropped chrome regression guards (SMALL)
Re-added the two tests lost in the htmlHideTools to htmlChrome rename, adapted to current behavior: the restore commit never writes stale pre-restore chrome values to the cookie (guards the skipNextHtmlChromeSaveRef/htmlChromeRestoredRef ordering), and the sidebar stays reachable via Mod+B while tools are hidden.
D. Agent TUI display reset silently overwrote terminal placement (HIGH, state sweep)
The Display popover's "Reset terminal display settings" button also called onSideChange("left"), durably overwriting a chosen right/hidden placement in config.json even though the label scopes the reset to font/appearance. Placement is a layout preference with its own explicit Position control in the same popover, so the reset now touches display settings only: the button resets exactly the display defaults through the panel's one sanitized update path, and the popover no longer has any code path from reset to the side. The popover is exported with a defaultOpen test seam (the surrounding panel needs a live WebTUI session to render it); tests assert reset restores the display defaults without firing onSideChange, and that the Position control remains the explicit way to change placement.
Also: tests for the two
resyncPhaseFromSessionexecuting-to-idle fallbacks that armidleNoticePending(missing plan file, missing submitted path). Verified by mutation: flipping either arm tofalsefails exactly its new test.Verification
bun run typecheckcleanpackages/ui+packages/editor(DOM_TESTS=1)apps/hook+apps/pi-extension+ annotate/live-proxy server suites green: 537 passapps/reviewbuild thenbuild:hooksucceedAI-assisted (Claude) under maintainer direction.