Repository navigation
fix: request checks and protocol edges (review P1-1) - #200
Merged
Merged
Conversation
- PressButton sets Outcome::alert_reported when it reports a system alert - long_press falls back to HID like a tap (Route::Hid, WDA unreachable) - Tap count, TapSequence points, PressButton's button and non-finite coordinates are checked before the device lock and the cache drop - Touch Prepare isn't a device action: not refused during a task, not the user acting under takeover; touch_rotation is cleared once an up was sent - ScrollCollect no longer denies unknown fields (forward compatibility) - a stored passcode needs 4 digits; state.json isn't replaced by an empty file when it doesn't serialize; NotifyConfig's Debug hides the keys Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MCP server never checked for alerts after a button (wants_alert_check), so the fix fills Outcome::alert_reported for protocol clients; the changelog and regression case said otherwise. A long press done by HID in WDA's place says so, as the other gestures do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 tasks done
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.
What and why
P1, first batch, from the full review of
mainafter #195: request checks and protocol edges in the daemon.PressButtonand alerts: Home that finds a system alert in the way reported it in the text, butOutcome::alert_reportedstayed false, unlikeLaunchAppandOpenUrl: a protocol client readingOutcomemissed it (the MCP server doesn't check for alerts after a button anyway, so it wasn't affected).press_buttonandnative_homenow return(text, alert reported); the four returns that report one saytrue.long_pressand HID: onRoute::Hid, or when WDA answersUnavailable, it reported WDA down where a tap falls back to HID. Now it falls back the same way (not for a point measured on the page's view through WDA), and says "(via HID)" as the other gestures do.Checked before the lock:
Tap.count(1–10),TapSequence.points(1–20, finite),PressButton.button(known names), and finite coordinates forTap,LongPressandSwipeare checked incheck_request. Before, such a request queued for the device lock and dropped the cached element tree first.TouchPrepare(the page opens the HID session ahead of the finger) is no longer a device action:Also,
touch_rotationis cleared once an up was sent, not before it: an up refused for its point leaves the finger down, to be lifted by the next one (review of fix: low-level crates (review P0-C) #198).ScrollCollectand unknown fields: it no longer hasdeny_unknown_fields. Keys that apply to every request sit beside its fields, so a key a newer client adds would have made an older daemon refuse this request alone. This loosens the assertion added with it in Report input delivery and collect list rows across screens #170: an unknown key is now ignored, as for every other request; a wrong type in its own fields is still an error.Small ones:
passcode setasks; entering it relies on that;Persisted::savewrites nothing when serializing fails, instead of an emptystate.json;NotifyConfig'sDebugshows only whether each key is set.Tests
1. Unit tests
cargo test --workspace --all-features --locked: 580 passed; clippy-D warnings;cargo fmt --checkfor all 11 packages;tests/check_regression_cases.py: 0 missinghopeless_requests_are_refused_up_front,getting_ready_for_a_touch_is_not_acting,notification_keys_stay_out_of_debug_output; added toothers_may_look_but_not_act_until_the_user_takes_over(Prepare),missing_or_non_digit_passcode(3 digits)raw_scroll_collect_validates_scope_and_boundsnow asserts an unknown key is ignored and a wrongly typed field is refused (it asserted unknown keys fail)2. Real-device regression
tests/device/run.py: 16 calls, 0 failed3. Regression cases
4. Real-device proof
tapwithcount0,press_buttonpower, an emptytap_sequence: refused at once (0.00 s,not_sent/preflight)scroll_collectwith an extra top-level key: runlong_pressand Home: as beforetouchpreparewent through, adownwas refused as beforeRoute::Hid(neither test device takes it: iOS 27 is native, the iPad on iOS 26 has no HID fallback)Checklist
🤖 Generated with Claude Code