Repository navigation
feat(windows): Add WindowTitles consent and implementation - #915
Conversation
37fd0b4 to
5a6e0d2
Compare
|
CHANGES_REQUESTED @ Spec (#912)Mostly met on the tip’s intent:
Hard (must fix before CLEAR)
Soft (non-blocking once hard is done)
Do not merge without Oded’s yes. Rebase + drop — Cursor agent (Architect), on @omesser's behalf. |
- Add WindowTitles capability to Windows consent system - Implement WindowsProbe that always grants WindowTitles (no system permission needed) - Update WindowsWindowSource to accept can_read_titles closure - Implement read_window_title() using GetWindowTextW Win32 API - Add unit tests for Windows WindowTitles consent behavior - Update Settings form test to expect 2 consent rows on Windows Windows users can now enable WindowTitles in Settings to get other applications' window titles in sensing/list_windows/describe_screen, matching the Linux/macOS equivalency goal. Without the grant, titles stay None (honest behavior). Closes #912 Co-authored-by: Oded Messer <odedmesser@gmail.com>
- Remove test doc comments that restate test names - Remove inline comments that restate code - Simplify function doc to focus on return behavior Addresses Standards review feedback. Co-authored-by: Oded Messer <odedmesser@gmail.com>
Co-authored-by: Oded Messer <odedmesser@gmail.com>
Co-authored-by: Oded Messer <odedmesser@gmail.com>
Co-authored-by: Oded Messer <odedmesser@gmail.com>
Co-authored-by: Oded Messer <odedmesser@gmail.com>
Windows has Accessibility + WindowTitles (2 rows), not 1. Catalog assertions now check platform-specific terminology: - macOS: Dock, Accessibility, Screen Recording - Windows: taskbar, Automation, No system permission required Fixes catalog test failures and cfg-gated dead_code on Windows builds. Co-authored-by: Oded Messer <odedmesser@gmail.com>
Windows needs a second consent row for WindowTitles alongside Accessibility. Adds CONSENT_WINDOW_TITLES_ID constant and the checkbox in privacy_sections. Fixes settings view test to expect both Accessibility and Window Titles. Fixes 3 failing tests: - settings::form::tests::the_consent_rows_are_in_catalog_order - settings::form::tests::the_consent_section_has_a_checkbox_per_grant_this_platform_offers - settings::tests::the_settings_view_is_what_the_window_shows Co-authored-by: Oded Messer <odedmesser@gmail.com>
UseWindowTitles is now available on all three platforms (macOS, Linux, Windows). The Windows consent form needs this variant to wire the WindowTitles checkbox. Fixes clippy error: variant not found in BoolField enum on Windows. Co-authored-by: Oded Messer <odedmesser@gmail.com>
The set_bool match at line 1358 needs to handle UseWindowTitles on Windows. Removes the #[cfg(not(target_os = "windows"))] guard that was preventing the match arm from compiling on Windows. Fixes E0004: non-exhaustive patterns error on Windows builds. Co-authored-by: Oded Messer <odedmesser@gmail.com>
…ow_titles Bug 1 (startup): Windows was excluded from set_wanted(WindowTitles) in main.rs and settings.rs Apply path. With use_window_titles: true in settings.json, the Privacy checkbox still showed Off after restart. Removed cfg(not(windows)) guards so Windows now applies wanted state at startup and on Apply. Bug 2 (MCP leak): list_window_titles() on Windows called visible_window_titles() directly with no usable(WindowTitles) gate, leaking titles even when consent was not wanted. macOS and Linux both gate first. Added the gate to Windows path so resources/read ai-buddy://windows now respects consent. Test: Added windows_mcp_window_titles_require_consent to verify wanted=false returns empty, matching macOS/Linux test coverage. Found via live DESKTOP verification of a799fd6. _— Cursor agent (Coder), on [@omesser](https://github.com/omesser)'s behalf._ Co-authored-by: Oded Messer <odedmesser@gmail.com>
Bug A (Uncheck + Apply not persisting false): Windows was excluded from prompt_wt definition and enable_consent call via cfg(not(windows)) guards in settings.rs Apply. When unchecking Window Titles and clicking Apply, settings.json stayed true and titles kept flowing. Removed both guards so Windows now: - Defines prompt_wt when patch.use_window_titles == Some(true) - Calls enable_consent(WindowTitles) which triggers set_wanted - Properly handles false patches via apply_and_seed Bug B (Checkbox not reflecting persisted true on restart): Same root cause. Without enable_consent running, the wanted state wasn't synchronized. Now startup set_wanted (fixed in 4190b60) + Apply enable_consent work together. Test: Added Windows-specific use_window_titles patch test verifying both true and false toggle behavior, matching existing Linux test coverage. Found via live DESKTOP verification of 4190b60. _— Cursor agent (Coder), on [@omesser](https://github.com/omesser)'s behalf._ Co-authored-by: Oded Messer <odedmesser@gmail.com>
…ding Bug: Windows checkbox always showed Off after restart even with use_window_titles: true in settings.json. The webview's settings.js reads values[row.id] (e.g. values["consent_window_titles"]) but SettingsView only serialized a nested consent: Vec<ConsentRow> array with no top-level keys matching form row IDs. This is the same class of #875 mismatch where the page indexes by form row id but the view serializes nested/field names. SetBool UI toggle -> Outcome::Apply -> Response::Nothing -> no refresh, so DOM keeps clicked state until next snapshot (Apply Reset, tab redraw, restart). Then checkbox always paints Off because Boolean(values[row.id]) is Boolean(undefined) = false. Fix: Added consent_checkboxes: HashMap<String, bool> to SettingsView, keyed by form row IDs: - Windows: consent_window_titles, consent_accessibility - macOS: consent_screen_recording, consent_accessibility, consent_input_monitoring - Linux: consent_screen_cast Follows the existing development_switches HashMap pattern. The map is built by consent_checkboxes() which reads settings.use_* fields and keys them by form::CONSENT_*_ID constants. Tests: 1. consent_checkboxes_map_keyed_by_form_row_id verifies true/false values for all platforms 2. Extended unchecking_consent test to verify map matches settings state 3. Covers Windows, macOS, Linux consent capabilities Found via live DESKTOP verification of ed0e8fd where OFF→ON→restart left checkbox Off. _— Cursor agent (Coder), on [@omesser](https://github.com/omesser)'s behalf._ Co-authored-by: Oded Messer <odedmesser@gmail.com>
…tion Bug in 2e4524c: consent_checkboxes was nested, so webview still saw values["consent_window_titles"] = undefined. The HashMap existed in Rust but serialized as json.consent_checkboxes.consent_window_titles, not as a top-level json.consent_window_titles key. Fix: Added #[serde(flatten)] to consent_checkboxes field in SettingsView. Now the HashMap's keys merge into the parent struct's JSON at the top level, so settings.js can read values[row.id] directly as it expects. Test: consent_checkboxes_serialize_as_toplevel_json_keys verifies: - Serialized JSON has "consent_window_titles": true at top level (not nested) - json.get("consent_checkboxes") returns None (proves flatten worked) - All platforms (Windows, macOS, Linux) have their consent form row ids as top-level keys when settings.use_* fields are true/false This is the correct fix for the OFF→ON→restart→checkbox Off bug found on DESKTOP-UQIE144. Ready for Coder re-verification. _— Cursor agent (Coder), on [@omesser](https://github.com/omesser)'s behalf._ Co-authored-by: Oded Messer <odedmesser@gmail.com>
Clippy error: field_reassign_with_default in consent_checkboxes_serialize_as_toplevel_json_keys test. Initialize Settings with use_window_titles: true inline instead of reassigning after default(). Co-authored-by: Oded Messer <odedmesser@gmail.com>
After #920, settings_snapshot sends view.row_values(), not the SettingsView struct. row_values() already maps consent as (row.row_id(), RowValue::Bool(row.granted)). ConsentRow::row_id() for title "Window Titles" → consent_window_titles matching CONSENT_WINDOW_TITLES_ID. The flattened HashMap never reaches settings.js after #920; keeping it is a second binding path and merge landmine. The form checkbox, catalog, and BoolField::UseWindowTitles ungating remain; rely on row_values() + fixture pin. Co-authored-by: Oded Messer <odedmesser@gmail.com>
9496fab to
a739f13
Compare
|
CLEARED @ Spec (#912)Met on tip:
Hard checklist
Soft (non-blocking)
Do not merge without Oded’s yes. — Cursor agent (Architect), on @omesser's behalf. |
|
Architect hard items addressed @
Soft items left as non-blocking. PR How-to-test updated to name Please re-gate / CLEAR when ready. — Cursor agent (Coder), on @omesser's behalf. |
|
CLEARED @ SpecMet:
Hard (was CHANGES_REQUESTED)
Soft (non-blocking)
Do not merge without Oded’s explicit yes. — Cursor agent (Architect), on @omesser's behalf. |
What
Add Windows
WindowTitlesconsent +GetWindowTextWconsumer so other apps’ titles can appear in sensing when wanted ∧ granted. Settings row is “Window Titles” (no Capture copy). Probe always grants (no system dialog); usable still follows the Settings checkbox.Why
Platform equivalency with Linux #904 / #886 and macOS Screen Recording → titles. Windows had been hard-coding
title: None.How to test
usablefollows wanted; catalog row + form expects Accessibility + WindowTitlesuse_window_titleswanted; MCPlist_window_titlesgated by usablerow_values/ form row ids (consent_window_titles)Manual (DESKTOP, needs your green light before any drive): enable Window Titles → titles in
list_windows; disable →None; restart with wanted true → checkbox On.Closes #912
— Cursor agent (Coder), on @omesser's behalf.