Repository navigation
feat(settings): Add Settings webview window behind AI_BUDDY_SETTINGS_WEBVIEW flag - #773
Conversation
dcab43c to
2d8c770
Compare
2d8c770 to
c8f611e
Compare
|
Rebased onto Conflict: only Resolution (kept the Settings webview window +
How tested
— Cursor agent (Coder), on @omesser's behalf. |
DESKTOP-UQIE144 live verify @
|
macOS local verification @
|
AI_BUDDY_SETTINGS_WEBVIEW |
AX elements | Roles in the tree | Verdict |
|---|---|---|---|
1 |
7 | AXGroup, AXStaticText, close/fullscreen/minimize |
webview |
0 |
34 | AXTabGroup, AXRadioButton:AXTabButton, AXCheckBox, AXScrollArea, AXScrollBar, close/zoom/minimize |
native |
| unset | 34 | same as 0 |
native |
Native remains the default when the variable is absent, which is what the PR claims.
The page renders, and the tabs work
All five tabs drawn in Chat's dark theme, each with distinct content (1089 to 1193 distinct colours per still, and no two stills identical). <details> renders as the "What is this?" disclosure. Tab switching repaints and moves the active marker.
A click reaches disk
Clicked the first checkbox on the Development tab. settings.json under the run's throwaway HOME:
- "trace_frames": false,
+ "trace_frames": true,The box redrew checked in the same window. That is the whole path, click through settings_event and the step 1 controller to disk and back to the page.
What I could not verify, and one finding
Instance → settings-refresh has no runtime evidence, on any platform. The PR adds a webview arm to refresh_settings that emits settings-refresh when the roster changes while the window is open. I did not drive a spawn or dismiss against an open window, so that arm is still only read, not run. It is the one contract here nothing has exercised.
The webview window exposes no accessibility tree at all. Not a missing descent into AXWebArea — there is no AXWebArea, and no checkbox, tab or text field, where the native window shows 34 elements including all of them. This matters beyond this PR:
- Step 7 artefact 1 asks for
verify-settings-macos.shgreen with its assertions unchanged against the new window. Those assertions read the AX dump. On this evidence they would find nothing to assert against, so that artefact cannot be met by extendingax-settings.swiftalone. - Step 7 artefact 3 is VoiceOver. A tree this empty is the same gap seen from the user's side.
Worth knowing now rather than at the gate. It does not block step 5, whose claim is that the flag opens the window, and it does.
Not run: keyboard-only, VoiceOver, z-order against the overlay. Those are step 6 and step 7, and the window opened behind my terminal, which is expected with raise() not yet written. I raised it through AXRaise to capture the stills.
Stills and AX dumps are local to this machine and are not attached here. Every number above came from them.
— Claude Code agent, on @omesser's behalf.
Verification Results - PR #773 (Linux, Cloud VM)Commit: Summary✅ Code paths verified — Both webview and native settings paths compile and execute correctly Detailed FindingsA. Flag ON (Webview Path) -
|
Linux real-desktop paint verify @
|
…WEBVIEW flag Step 5 of #706. Implements the Settings window as a webview, reachable behind AI_BUDDY_SETTINGS_WEBVIEW=1. Native remains the default. Changes: - build_settings() mirrors build_chat, opens settings.html with label "settings" - show_settings() branches on env_switch("AI_BUDDY_SETTINGS_WEBVIEW"): webview when flag is on, native otherwise - capabilities/settings.json grants event listen/unlisten and start-dragging permissions - refresh_settings() gains webview arm that emits settings-refresh event when roster changes while window is open - settings.js wired to listen for refresh, call settings_snapshot, and invoke settings_event for row edits - Node test verifies controls(), render() signatures Native renderers untouched. Step 6 (raise, alt-drag, keyboard) follows. Refs #706 Co-authored-by: Oded Messer <odedmesser@gmail.com>
c8f611e to
0cd7fd5
Compare
Architect gate — Standards + Spec @
|
Addresses Standards and Spec reviews (CHANGES_REQUESTED at 0cd7fd5): 1. Replace Outcome::Run Debug format with stable wire representation - Add RowOperation::as_str() for explicit snake_case serialization - Test exact JSON output ("spawn", "new_session", etc.) 2. Remove unused batched field from SettingsEventPayload - Delete dead_code annotation and associated test 3. Add visible error states with retry in settings.js - loadSnapshot failure shows "Could not load settings" + retry button - emitEvent failure shows "Could not save changes" + retry - Remove error-hiding in invokeSettingsEvent 4. Remove unused core:window:allow-start-dragging from capabilities - Alt-drag belongs to Step 6, not Step 5 5. Replace signature tests with behavioral tests - Test snapshot rendering, refresh events, controller responses - Test error handling and race condition prevention - Delete settings-webview-init.test.js, add settings-webview.test.js 6. Add evidence-backed listener cleanup - Call unlisten on beforeunload per Tauri v2 docs requirement 7. Prevent loadSnapshot race conditions - Track lastSnapshotPromise, ignore stale responses 8. (PR body wording updated separately) All 224 node tests pass. Native renderers untouched. Co-authored-by: Oded Messer <odedmesser@gmail.com>
Pre-commit hooks detected trailing spaces on blank lines in src/settings.js. Fixed by removing whitespace from 7 blank lines. Co-authored-by: Oded Messer <odedmesser@gmail.com>
Architect re-gate — Standards + Spec @
|




Why
Step 5 of the Settings webview migration (#706). Steps 1–4 landed the controller, snapshot command, HTML/JS/CSS page, and settings_event. Step 5 makes the window reachable behind a flag so the webview can be opened and tested, while native remains the default. Step 6 (raise, alt-drag, Escape/Enter, focus ring) follows after this lands.
Without this step, the Settings webview page exists on disk but nothing can open it.
What changed
build_settings()mirrorsbuild_chat: labelsettings, openssettings.html, sized 600×520 with 480×400 minimumshow_settings()branches onmodel::env_switch("AI_BUDDY_SETTINGS_WEBVIEW"): builds or raises the webview window when the flag is explicitly on (1|true|yes|on); native otherwisecapabilities/settings.json: grantscore:event:allow-listenandallow-unlistenfor settings-refresh events (Step 6 adds alt-drag permission)refresh_settings()gains a webview arm: checks flag and webview window existence, emitssettings-refreshevent when the roster changes while the window is open; otherwise calls native platform refreshsettings.jsinitialization: listens forsettings-refresh, callssettings_snapshoton load and refresh, invokessettings_eventfor row edits; includes visible error states with retry, listener cleanup on beforeunload, and race condition preventiontests/settings-webview.test.js): verify snapshot rendering, refresh events, controller response processing, error handling, and race prevention; 224 node tests passNative renderers (macOS, Windows, x11) are untouched. Step 6 work (macOS raise, alt-drag gate, Escape/Enter, focus ring) is deliberately excluded.
Review gate applied (060afc2)
Consolidated Standards and Spec gate addressed at tip:
Outcome::Runuses stableRowOperation::as_str()wire format (not Debug)batchedfield from payloadallow-start-draggingpermission (Step 6 scope)lastSnapshotPromiseRebase
Rebased onto origin/main (39fd012), which includes merged PR #767 (Windows Settings auto-open / WM_ACTIVATE). Resolved conflict in
src/settings.js(comment block describing initialization), preserving Step 5's implementation comment. Verified both features coexist:install_windows_anchor_wndproc()and WM_ACTIVATE handlingAI_BUDDY_SETTINGS_WEBVIEWflag,build_settings(),settings-refreshevent— Cursor agent (Coder), on @omesser's behalf.