Repository navigation
Conversation
[Medium impact] The change affects gesture-button actions across the OS-hook and HID++ capture paths. The gesture change needs the required user documentation and regression counter-proof before merging. Findings
|
| pub fn end(&mut self) -> Option<GestureDirection> { | ||
| self.held_since.take()?; | ||
| if self.fired { | ||
| return None; | ||
| } | ||
| Some(detect_swipe(self.dx, self.dy).unwrap_or(GestureDirection::Click)) |
There was a problem hiding this comment.
SwipeAccumulator::end extends release behavior while held_since, fired, last, repeat, and repeat_cross still encode the phase separately. For example, last = Some(direction) with fired = false is invalid, but the type permits it. This violates the repository requirement to make extended state machines explicit.
Replace these phase fields with an enum such as Idle, Uncommitted, and Committed, carrying only valid data. Keep transitions under one owner and test refused edges, including motion while idle and repeated release. No newly reachable invalid combination was established, so this is a maintenance concern rather than a demonstrated gesture failure. The explicit repository requirement must still be satisfied before merging.
Context Used: Implicit state machines Flag any change that introduces or extends an implicit state machine: a lifecycle, phase, or mode that the code tracks through a combination of independent fields instead of one enum with one transition function. Report it as... (source)
| if self.fired { | ||
| return None; | ||
| } | ||
| Some(detect_swipe(self.dx, self.dy).unwrap_or(GestureDirection::Click)) |
There was a problem hiding this comment.
Fast-release guidance is missing
SwipeAccumulator::end now turns a quick press with enough travel into a swipe rather than a click, but this PR changes only Rust files. The repository requires user-visible behavior changes to be documented in docs/CONFIGURATION.md, docs/USAGE.md, or docs/DECISIONS.md in the same change.
Before merging, explain that the 160 ms gate applies to firing during motion, not to recognizing a swipe on release. The fast-release tests cover the code boundary; the missing piece is the required user documentation.
Rule Used: Severity: medium. A user-visible behaviour change or a known limitation left by a fix (state lost on restart, a race window not covered, Ctrl-C skipping a hand-back) is stated in docs/CONFIGURATION.md, docs/USAGE.md, or docs/DECISIONS.md in the... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| assert_eq!(triggered.token(), press.token()); | ||
| assert_eq!(action, Action::PreviousDesktop); |
There was a problem hiding this comment.
Regression counter-proof is missing
The repository requires the PR to name the reverted line or killed mutant that makes its regression test fail. The testing notes list tests and a hardware check, but give no counter-proof.
For fast_hook_gesture_dispatches_the_swipe_before_ending_its_press, temporarily restore click-only release classification while keeping the new return type. Confirm that the Action::PreviousDesktop assertion fails and record the result before merging. The test reaches the production hook path; this concerns the required proof, not a claim that the test is ineffective.
Rule Used: Severity: medium. Every bug fix ships a regression test that fails without the fix, and the PR states the counter-proof (the reverted line or the killed mutant). A test that passes with the fix reverted is not a regression test: ask for inputs where ... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
A gesture button released before
GESTURE_HOLD_FOR_SWIPE(160 ms) was classified as a plain click, so a quick thumb flick either fired the button'sClickaction or did nothing. The release now classifies the travel it accumulated, so a fast swipe still moves.Changes
openlogi-core:SwipeAccumulator::endreturns the direction still due (Option<GestureDirection>) instead of a "was a click" flag, classifying the hold's final travel. A hold that already committed mid-motion emits nothing, so a fast swipe cannot also click or fire twice.openlogi-agent-core: the OS-hook path resolves the action from the release direction (resolve_gesture_action, formerlyresolve_gesture_click), keeping theClick/default fallback for sparse maps and honoring an explicitAction::None.openlogi-device: the HID++ capture path forwards the release direction rather than aClick(gesture releasedinstead ofgesture click).Testing
cargo test -p openlogi-core -p openlogi-agent-core -p openlogi-deviceClick, and a release never dispatches twice.