diff --git a/docs/features/extras/README.md b/docs/features/extras/README.md index b6856b9..dd3dc44 100644 --- a/docs/features/extras/README.md +++ b/docs/features/extras/README.md @@ -360,4 +360,131 @@ window made, no IOKit assertion taken and no notification posted. ## QA log +### 2026-09-16 (QA) + +**Scope**: `git diff b73e878..HEAD`, build-only (CLAUDE.md invariant 5): no app +launched, no tap created, no event posted, no overlay window made, no IOKit +assertion taken, no notification posted. + +**Gates**. `tools/gates.sh` — clean: `swift-format lint --strict`, the +`MWBCore` layering grep (no AppKit/CoreGraphics/Network/IOKit import), `swift +build -Xswiftc -warnings-as-errors`. `swift build` only (gates.sh runs no +`swift test`), so `tools/guard.sh` was not needed for this step. + +**Status/TODO ticks, checked against the Windows source.** + +- **Awake** (`Sources/MWBMac/Awake.swift`, `Engine.swift:558-565`). Matches + `Receiver.cs:244-249` (`AddToMachinePool` + `HumanBeingDetected`) and + `Common.cs:545-591`: the setting gates only the *sender* (`SendAwakeBeat`), + the receiver honours any `Awake` unconditionally, and `renew()` (90 s + `kIOPMAssertionTimeoutKey`, re-create-before-release) is a faithful + substitute for the effect `PokeMyself` is reaching for, without posting + input. Confirmed only `.awake` calls `renew()`; `.heartbeat`, + `.heartbeatEx`, `.hello` do not (`Engine.swift:558-572`). +- **Fullscreen** (`Sources/MWBMac/Fullscreen.swift`, + `Engine.swift:485-512`). Confirmed `easyMouseSwitchAllowed()` is called + from exactly one place, `considerCrossing` (the edge path), and not from + the `.nextMachine` case — matches `Event.cs:79`'s call inside + `MouseEvent`, gated the same way (`IsSwitchingByMouseEnabled()` on the + geometry call, `IsEasyMouseSwitchAllowed()` only after a non-empty jump) + and never called from `Receiver.cs:145-172`'s relative-mode path or + `Receiver.cs:195-201`'s `NextMachine` handler. The two early-outs + (`Common.cs:1638-1650`) are reproduced in order. Cache keyed on the + excluded set (not on `displays`), but `Fullscreen.invalidate()` is called + from `applyConfiguration()`, which fires on `.screensChanged` + (`Engine.swift:395-396`) as well as every settings change, so a display + edit is still felt within one `applyConfiguration()`, not stale for a + whole cache window. Excluded-apps matching + (`Fullscreen.isExcluded(_:in:)`) tests bundle identifier, localized name, + and bundle file name with/without `.app`, case-insensitively — the two + spellings `Common.cs:1597-1599` accepts, correctly widened for bundle + identifiers which Windows has no equivalent of. +- **Drawn cursor** (`Sources/MWBMac/FakeCursor.swift`). `CursorOverlay` is + `@MainActor` (`FakeCursor.swift:224`), `ignoresMouseEvents = true` + (click-through, `:272`). Hidden on `.parkCursor` + (`EngineActions.swift:69`, matching `Common.cs:1495`'s + `ShowFakeMouseCursor(int.MinValue,…)` at the end of `HideMouseCursor`), + on local input while the destination is not remote (`Engine.swift:456`, + matching `InputHook.cs:256-264`'s `if (local) { … ShowFakeMouseCursor + (int.MinValue,…) }`), and in `Engine.stop()` (`Engine.swift:295`). + `FakeCursor` itself (`Sendable`, lock-coalesced) is only ever driven from + `Engine.swift` (`.mouse` case, `applyConfiguration()`, `.parkCursor`, + `stop()`); grepped `Sources/MWBMac/EventTap.swift` for `FakeCursor` / + `CursorOverlay` — no hits, so the tap never touches it, as required. +- **`ClipboardBridge.swift` provisional lines** (`clipboardFailed`, the + `.note` case, `commitReceivedFile`'s success arm). Read every string + that reaches `TransferNotices.post`: `"clipboard text could not be + compressed"`, `"clipboard file not found"`, `"clipboard payload from + \(source) was too big"`, `"image received"`, `"text received"`, + `"clipboard text could not be decoded"`, and `"Received \(name)."` — all + fixed strings or a filename, never clipboard content, and `clipboardFailed`'s + `reason` is `BulkChannel`'s own failure description, not the payload. + `Notifier.post` (`Notifications.swift:47-56`) does not log `body`. Minimal: + 4 added lines total (one is a citation comment), matching the "three + one-line additions" the Handshakes section describes. +- **`drawMouseCursor` accessor + toggle** (`Settings.swift:198-205`, + `BehaviourPane.swift:38-44`). Plain boxed-bool accessor matching the + existing pattern; toggle placed after "Block mouse at screen corners" as + claimed, matching `MouseWithoutBordersPage.xaml:246-251`'s ordering. + `DrawMouseEx` stays a boxed default (`Settings.swift:159`, pre-existing) + that nothing reads — "accepted and ignored" is accurate. +- **Corners and relative mode**, two claims spot-checked directly against + code (not just the README's prose): `Edge.isNearCorner` + (`Edge.swift:139-142`) is `abs(dx) < 100 && abs(dy) < 100` — a Chebyshev + square, not a radius, over `config.corners`, matching + `MachineStuff.cs:222-234`. `EventTap.remotePosition` + (`EventTap.swift:397-410`) tags *every* delta, zero included, with + `Coordinates.tagRelative` when `moveMouseRelatively` is on, matching the + cited `InputHook.cs:311-312`; confirmed `Coordinates.isRelative` tests + both axes (`Coordinates.swift:119`). Also confirmed the filed gap is + real: `EventTap.easyMouseKeyDown` (`EventTap.swift:93`) is `private`, so + `Engine.swift:551`'s `.nextMachine` case can only test + `settings.easyMouse == .enable`, not the held Ctrl/Shift key + (`Event.cs:152-155`) — correctly cited and correctly left as a Handshake + request rather than worked around by reaching into `EventTap.swift` + (input-capture's file). + +**Read top to bottom**: `Awake.swift`, `FakeCursor.swift`, `Fullscreen.swift` +in full (new files); the diffed regions of `Engine.swift`, `EngineActions. +swift`, `UIBridge.swift`, `ClipboardBridge.swift`, `Settings.swift`, +`BehaviourPane.swift`. No force-unwraps, `try!`, `fatalError` or +`precondition` in any changed line. No new `@unchecked Sendable` (the two +in `ClipboardBridge.swift`/`Settings.swift` predate this diff). `IOKit` is +imported only in `Awake.swift`; `MWBMac` imports no `MWBNet` in the new +files; `MWBCore` still imports nothing but Foundation (gate 2). No retain +cycles found: `FakeCursor`'s `Task { @MainActor in self.draw() }` is a +one-shot hop with no back-reference from `CursorOverlay`, and +`TransferNotices`' `notifier` is `weak`. `Engine.swift` grew from 620 to +678 lines — under the 800-line "consider splitting" mark, no action +needed. Comments are cited throughout; none found uncited. + +**Finding (informational, not blocking)**. `Common.HumanBeingDetected()` +(`Common.cs:561-572`) only runs `PokeMyself()` when +`lastInputEventCount == Event.InputEventCount`, i.e. only when *this* +machine's own user has had no input since the previous `Awake`/beat — a +machine whose local user is already active never jiggles itself. The port's +`displayAwake.renew()` (`Sources/mwb/Engine.swift:565`) has no equivalent +guard: it renews the assertion on every `Awake` regardless of local +activity. This is harmless with the assertion-based mechanism (renewing +while the local user is already active costs nothing and asserts nothing +false — the display would stay awake anyway), so it is not a wire or +recoverability defect, but it is a behaviour Windows has that the port +silently drops without a note in the Assumptions section or protocol +§10.8 note 1, both of which describe the *jiggle* being dropped but not +this conditional. Suggest a one-line addition to protocol §10.8 note 1 +next time that file is touched; not worth a rework on its own. + +**No typos found to fix directly.** + +**Verdict: PASS** + +Findings: +1. (informational, low severity) `Sources/mwb/Engine.swift:565` + (`displayAwake.renew()`) vs. `Common.cs:561-572` + (`HumanBeingDetected`'s `lastInputEventCount` guard): the port renews + the display-awake assertion on every `Awake` packet unconditionally, + where Windows only pokes itself when the receiving machine's own user + has been idle since the last beat. No correctness or invariant impact; + recorded so protocol §10.8 note 1 can mention it. + ## Review