app-ui: QA log (PASS, one low finding)
Verified gates/bundle build-only, settings completeness against README §Settings, menu actions, status colours against the PowerToys devdocs, hotkey-recorder modifier mapping, the SettingsStore-only edit path, the single Permissions.request() call site, bundle-identifier guards on notifications/SMAppService, dead-code removal in AppLifecycle, file/ function size and force-unwrap/try!/fatalError checks, MWBMac layering imports, and that the security key never reaches a log call. One plausible low-severity finding: a strong reference cycle between Engine and UIBridge from a dropped [weak ui] capture, inert today because AppDelegate is a process-lifetime singleton. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
1 parent
783c358334
commit
083b00bb9f
1 file changed
+132
@@ -370,4 +370,136 @@ Five deviations from the shape this section sketched at planning time:
|
||||
|
||||
## QA log
|
||||
|
||||
- **2026-09-16 (QA)** — reviewed against CLAUDE.md, `README.md` §Settings,
|
||||
`docs/contracts.md` C2/C4/C5, this README (all sections) and
|
||||
`docs/features/app-engine/README.md` Handshakes, plus
|
||||
`doc/devdocs/modules/mousewithoutborders.md` for the status-colour table.
|
||||
Build-only per CLAUDE.md invariant 5: **neither the app nor the settings
|
||||
window was launched**, no permission was requested, no notification was
|
||||
posted, no socket was opened.
|
||||
|
||||
*Gates.* `tools/guard.sh -- tools/gates.sh` green (`swift-format lint
|
||||
--strict`, `MWBCore` layering, `swift build -Xswiftc -warnings-as-errors`).
|
||||
`tools/guard.sh -- env MWB_ADHOC=1 tools/bundle.sh` produced `dist/mwb.app`
|
||||
and `codesign --verify` passed (not opened).
|
||||
|
||||
*Completeness.* Every property in README §Settings has a bound control:
|
||||
`SecurityKey`/`TCPPort` (`SecurityPane`), `EasyMouse` + the fullscreen
|
||||
toggle and its excluded-apps list (`BehaviourPane`), `WrapMouse`/
|
||||
`MachineMatrixString`/`MatrixOneRow` (`MachinesPane`), `ShareClipboard`/
|
||||
`TransferFile`/`HideMouseAtScreenEdge`/`MoveMouseRelatively`/
|
||||
`BlockMouseAtScreenCorners`/`BlockScreenSaverOnOtherMachines`/
|
||||
`ShowClipboardAndNetworkStatusMessages` (`BehaviourPane`),
|
||||
`ValidateRemoteMachineIP`/`SameSubnetOnly`/`Name2IP` (`NetworkPane`), the
|
||||
four shortcuts + `HotKeySwitchMachine` (`HotkeysPane`), `MachineID`/
|
||||
`DeviceID` shown read-only in `AdvancedPane` (Windows does not let the user
|
||||
edit these either). `MachinePool`, `LastX`/`LastY`/`PackageID` and the
|
||||
five accepted-but-ignored properties are correctly not surfaced — Windows
|
||||
has no control for them either. `DrawMouseCursor` is the one property with
|
||||
no control; the README documents why (no accessor in `Settings.swift`,
|
||||
which is app-engine's file) and files it as an open Handshake request
|
||||
rather than reaching across lanes — exactly the workflow CLAUDE.md asks
|
||||
for, not a defect.
|
||||
|
||||
Every menu action in the brief is present and in the documented order
|
||||
(`StatusItem.swift buildMenu`): matrix rows (unlisted peers shown but
|
||||
disabled — `machineItem`/`isEnabled`), "Control All Computers", "Easy
|
||||
Mouse", "Reconnect"/"Lock All Machines" labelled with their shortcuts,
|
||||
the problem lines in order (hostname, permissions, cannot-inject,
|
||||
tap-not-running, last recovery), "Settings…" ⌘,, the version, "Quit …" ⌘Q.
|
||||
|
||||
Status colours (`StatusColor.nsColor`) checked component-by-component
|
||||
against `doc/devdocs/modules/mousewithoutborders.md` § Status colors: all
|
||||
ten match (NA `#717171`, Resolving yellow, Connecting orange, Handshaking
|
||||
blue, Error red, ForceClosed purple, InvalidKey `#A52A2A`, Timeout
|
||||
`#FFC0CB`, SendError maroon, Connected green).
|
||||
|
||||
Hotkey recorder (`HotkeysPane.swift` `HotkeyRecorderView.keyDown`) maps
|
||||
`.command`→`Hotkey.command` (Win), `.option`→`.option` (Alt),
|
||||
`.control`→`.control` (Ctrl), `.shift`→`.shift`, matching
|
||||
`MWBCore/InputTypes.swift:137-144`'s own doc comments
|
||||
(`command` = "Requires ⌘ (`HotkeySettings.Win`)", etc.), and reads the VK
|
||||
through `KeyMap.vk(forKeycode:)`, never a raw keycode. Escape (keyCode 53)
|
||||
cancels without recording, as documented.
|
||||
|
||||
Every edit path goes through `SettingsViewModel.commit` →
|
||||
`store.update(body)` → `publishToEngine` → `engine.apply`; grepped the
|
||||
whole lane for `.save(` and any other `FileManager`/settings-file write —
|
||||
none outside `SettingsStore` itself. `Permissions.request()` has exactly
|
||||
one call site in the repository (`AdvancedPane.swift:128`, the "Request…"
|
||||
button). `Notifier.isAvailable` and `LaunchAtLogin.isAvailable` both gate
|
||||
on `Bundle.main.bundleIdentifier != nil` (`LaunchAtLogin` additionally
|
||||
requires the bundle extension to be `.app`), so neither does anything
|
||||
under `swift run`. `AppLifecycle.swift`'s placeholder status item
|
||||
(`buildStatusItem`, `render`, `setTitle`, `requestPermissions`,
|
||||
`reconnect`, `quit`, the `statusItem`/`titleItem` properties) is gone
|
||||
entirely — diffed old vs new, no remnant, no dead code.
|
||||
|
||||
*Readability.* All 14 changed/added Swift files are 50-373 lines, well
|
||||
inside the 300-600 target. No function read over ~50 lines. No
|
||||
force-unwrap, `try!`, `fatalError` or `precondition` in any changed file
|
||||
(grepped every `!` and `try!`/`fatalError(`/`precondition(` — all hits are
|
||||
boolean negation). `MWBMac` imports checked file-by-file: only
|
||||
`Foundation`/`AppKit`/`SwiftUI`/`MWBCore`/`UserNotifications`/
|
||||
`ServiceManagement` — no `MWBNet`, no executable-target import anywhere in
|
||||
`Sources/MWBMac/` (the layering gate only checks `MWBCore`; this half of
|
||||
D2 has to be checked by hand). Public items all carry a one-line doc
|
||||
comment; internal-only helpers (`StatusIcon`, `HotkeyRecorderView`, the
|
||||
pane structs) are correctly not `public`, matching the Handshakes'
|
||||
Promised list exactly. `swift build -Xswiftc -warnings-as-errors` under
|
||||
Swift 6 strict concurrency is clean, which rules out illegal actor-
|
||||
isolation escapes for every `@MainActor` type touching AppKit/SwiftUI.
|
||||
|
||||
*Security key.* Grepped every `Log.*` call site added or touched by this
|
||||
lane (`SettingsViewModel.swift:79`, `AdvancedPane.swift:139`,
|
||||
`Notifications.swift:41,43,58`, `AppLifecycle.swift:167,178`) — none takes
|
||||
the key, a draft string, or a `Settings` value; the two that log an
|
||||
`Error` log `SettingsError`/`SMAppService`/notification errors, which
|
||||
carry a file name or system message, never settings content. The only two
|
||||
places the key reaches a system API are `SecurityPane`'s "Copy" button
|
||||
(`SettingsViewModel.copyKey()`, pasteboard only, only from the button
|
||||
action) and the key field itself, which is a `SecureField` unless "Show"
|
||||
is pressed.
|
||||
|
||||
*Findings.*
|
||||
|
||||
1. **[correctness, PLAUSIBLE, low] `Engine` and `UIBridge` hold each other
|
||||
in a strong reference cycle.** `Sources/mwb/AppLifecycle.swift`'s
|
||||
`startEngine()` now does
|
||||
`await engine.observe { snapshot in Task { @MainActor in ui.render(snapshot) } }`
|
||||
with `ui` captured strongly (no `[weak ui]`); `Engine.observe` stores
|
||||
that closure forever in `observer` (`Sources/mwb/Engine.swift:286-288`,
|
||||
not this lane's file, but the storage shape matters here) — so the
|
||||
Engine actor now retains `UIBridge` for its whole life. `UIBridge`
|
||||
retains `Engine` right back, both directly (`private let engine:
|
||||
Engine`) and through closures it hands to long-lived objects it owns:
|
||||
`StatusActions`' eight closures each capture `[engine]`
|
||||
(`UIBridge.swift:192-207`) and are held by `StatusItemController`;
|
||||
`SettingsViewModel`'s `apply` closure also captures `[engine]`
|
||||
(`UIBridge.swift:36-38`). The pre-app-ui placeholder avoided exactly
|
||||
this: `Task { [weak self] in await engine.observe { snapshot in Task {
|
||||
@MainActor in self?.render(snapshot) } } }` — the removed `[weak
|
||||
self]` is what is missing now. In this app neither object is ever
|
||||
released without the other (`AppDelegate` holds both for the process's
|
||||
whole life and the app exits via `exit(0)`/`NSApp.terminate`, not by
|
||||
dropping references and expecting `deinit` — `applicationWillTerminate`
|
||||
already calls `ui?.stop()` explicitly rather than relying on
|
||||
dealloc), so this cannot leak *today*. It is still a real cycle and
|
||||
worth a `[weak ui]` in the `observe` closure (or `[weak self]` /
|
||||
`[weak engine]` on the `UIBridge` side) so the shape does not become a
|
||||
problem the day something creates or tears down more than one
|
||||
`Engine`/`UIBridge` pair — a loopback harness being the obvious future
|
||||
case.
|
||||
|
||||
*Not a finding.* `badgeColour` in `StatusItem.swift` also badges the menu
|
||||
bar icon while a remote peer is merely `.resolving`/`.connecting`/
|
||||
`.handshaking` (any non-local, non-`.na`, non-`.connected` status), which
|
||||
is broader than the three "cannot do its job" states app-engine's request
|
||||
2 named. That is a reasonable reading of "a coloured badge when anything
|
||||
is wrong" (brief, Assumptions) rather than a bug — a peer mid-handshake is
|
||||
visibly not yet connected — and CP1 is where the user judges whether the
|
||||
flicker while connecting is annoying in practice.
|
||||
|
||||
Verdict: PASS
|
||||
|
||||
## Review
|
||||
Reference in new issue
Block a user