qa: session-matrix round-2 QA log (PASS) and a stale protocol.md citation
Verified the rework against the reference checkout at 3104d5c: read-error counting now matches SocketStuff.cs:1330-1529/1531, Switcher.learn persists only on a new machine (MachineStuff.cs:737/755), parkCursor carries the HideMouseCursor gate (Common.cs:1488, MachineStuff.cs:1025), and contract C1's forward(_:)-only stamping matches SkSend (Common.cs:901-935). Fixed a trivially wrong citation in protocol.md §10.2 note 11 (Common.cs:914 -> 916, the actual PackageID increment line). tools/gates.sh green. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
1 parent
f190157535
commit
43e5e35885
2 files changed
+101
-1
No files matched your search
@@ -685,3 +685,103 @@ Three findings, none touching wire bytes or the trust boundary itself:
|
||||
"consumers must" rule alongside the existing ones in Handshakes.
|
||||
|
||||
Verdict: REWORK
|
||||
|
||||
### 2026-09-16 — QA (Sonnet), round 2
|
||||
|
||||
Process: `tools/guard.sh -t 300 -- tools/gates.sh` (green — swift-format lint
|
||||
--strict, MWBCore layering, `swift build -Xswiftc -warnings-as-errors`), then
|
||||
`git diff 08b243a..HEAD` and `git log --oneline 08b243a..HEAD` read against
|
||||
the reference checkout at `3104d5c` (`SocketStuff.cs`, `Common.cs`,
|
||||
`MachineStuff.cs`), then a fresh top-to-bottom read of `Session.swift` and
|
||||
`Switching.swift`, then `xcrun swift-format format` on both files diffed
|
||||
against the working tree (no drift). Scope: only `Sources/MWBCore/Session.swift`,
|
||||
`Sources/MWBCore/Switching.swift`, `docs/features/session-matrix/README.md`
|
||||
and `docs/protocol.md` changed — no wire-core file, no `docs/topo.md`, no
|
||||
`TODO.md` touched (§2 was already `done` before this round, correctly).
|
||||
|
||||
**Finding 1 — read-error counting.** Verified line-for-line against
|
||||
`SocketStuff.cs`: `errCount++` at `:1334`, the six-in-a-row close at
|
||||
`:1344`, the reset (any non-`Error` type, including `Invalid`) at `:1368`,
|
||||
the fall-through past `Type == Handshake` at `:1371`, `++packageCount >= 10`
|
||||
at `:1389` (the `untrustedPacketLimit` doc comment's citation, corrected
|
||||
from round 1's `:1390`), the give-back for `Mouse`/`Heartbeat`/
|
||||
`Heartbeat_ex` at `:1501-1519`, and the `receivedCount > 0` guard on the
|
||||
trusted branch at `:1531`. Traced both counters through `Session.swift`'s
|
||||
new `receive(_:bytesReceived:)`: a 0-byte read increments `receiveErrors`
|
||||
and, past 5, closes with `.error` before `handle` ever runs; every read
|
||||
(0-byte, short, or a real packet) still reaches `handle`/`countUntrusted`
|
||||
via the same path, so `.error`- and `.invalid`-typed synthetic packets
|
||||
spend `untrustedCount` exactly like Windows spends `packageCount` — the
|
||||
6th non-exempt untrusted packet reports `.invalidKey` status only (no
|
||||
close, no event — matches Windows's `UpdateTcpSockets` call with no
|
||||
`break`), the 10th sends ten `Invalid` packets, emits
|
||||
`.invalidKey(.tooManyUntrustedPackets)`, and closes. When trusted,
|
||||
`bytesReceived > 0` is required before `deliver`, and a short read's
|
||||
synthetic `.invalid` packet reaches `deliver` but is dropped there
|
||||
(`packet.type == .invalid`), matching `PreProcess` at `Receiver.cs:42-50`.
|
||||
Confirmed.
|
||||
|
||||
**Finding 2 — `learn` persistence.** `Switching.swift:277` now returns `[]`
|
||||
for the known-machine branch, matching `MachineStuff.cs:737`'s early
|
||||
`return machineInfo.Name;` ahead of `UpdateMachinePoolStringSetting()` at
|
||||
`:755`. The in-memory refresh (id/timestamp update, and re-pointing
|
||||
`desMachineID` when the controlled machine's id changed, `:731-735`) is
|
||||
correctly kept — that part runs before the early return on Windows too.
|
||||
Confirmed.
|
||||
|
||||
**Finding 3 — `parkCursor` gate.** `SwitchAction.parkCursor` now carries
|
||||
`destinationIsRemote`; `Switcher.destinationIsRemote` computes
|
||||
`desMachineID != localID && != MachineID.all`, matching the first half of
|
||||
`Common.cs:1488`'s gate. Checked call order at both sites:
|
||||
`switchToMachine` calls `setDesMachine(id)` before appending `.parkCursor`
|
||||
(`Switching.swift:207-215`), and `handleByeBye` routes through
|
||||
`switchToMachine(named: localName, ...)` (`:312`), so on the exact scenario
|
||||
QA round 1 raised — control coming home on `ByeBye` — `destinationIsRemote`
|
||||
evaluates to `false` after the switch and the OS cursor stays put, matching
|
||||
`MachineStuff.cs:1025`'s `HideMouseCursor(false)` running after
|
||||
`DesMachineID` is set. `handleHideMouse` also passes `destinationIsRemote`
|
||||
alongside `byHideMouseMessage: true`; harmless since that gate is an `||`.
|
||||
Confirmed.
|
||||
|
||||
**Contract C1.** `Session.send(_:)` is gone; grepped the whole of
|
||||
`Sources/` for `.send(` and the only matches are the unrelated
|
||||
`SwitchAction.send` case. The only path that stamps an `Id` is the private
|
||||
`originate(_:)`, reachable solely from `tick` (heartbeat), `sayGoodbye`
|
||||
(`ByeBye`), `start` (handshake, via `sendDirect` directly — random bytes,
|
||||
not `originate`, correctly per `SocketStuff.cs:1269-1289`) and
|
||||
`acceptAck`'s initial heartbeat — the same four/five per-connection sends
|
||||
Windows makes outside `SkSend`. `forward(_:)` calls `sendDirect` only,
|
||||
which never touches `p.id`. `Common.cs:901-935` (`SkSend`) confirms the
|
||||
mechanism: one `Interlocked.Increment(ref Package.PackageID)` at `:916`
|
||||
before the socket loop, the same `DATA` hand to every matching `TcpSend`.
|
||||
protocol.md §10.2 note 11 cited this increment as `Common.cs:914` — off by
|
||||
two against the reference checkout; fixed directly (see below). Confirmed
|
||||
otherwise.
|
||||
|
||||
**Handshakes section vs shipped API.** Read `Session.swift` and
|
||||
`Switching.swift` top to bottom against the Handshakes code block: the
|
||||
`noteReceiveError(bytesReceived:)` signature, the removed `send(_:)` line,
|
||||
`forward`'s updated comment, `SwitchAction.parkCursor`'s two-argument case
|
||||
and `Switcher.destinationIsRemote` all match the actual public surface
|
||||
exactly. No public member exists that the block omits and no member the
|
||||
block lists is missing.
|
||||
|
||||
**CLAUDE.md compliance of the changed files.** `swift-format format` on
|
||||
both `.swift` files produced no diff against the working tree.
|
||||
`Session.swift` is 422 lines, `Switching.swift` 371 — both within the
|
||||
300–600 target. No force-unwrap, `try!`, `fatalError` or `precondition` in
|
||||
either file (grepped). `MWBCore` imports only `Foundation` in both files
|
||||
(gate 2 confirms no AppKit/CoreGraphics/Network anywhere in `MWBCore`).
|
||||
Nothing logs. Scope held: only the four files listed above changed.
|
||||
|
||||
One trivial finding, fixed directly per the QA remit: **`docs/protocol.md`
|
||||
§10.2 note 11 cited `Common.cs:914` for `SkSend`'s `PackageID` increment;
|
||||
the reference checkout (`3104d5c`) has it at line 916.** Fixed in this
|
||||
commit (`qa: …`); no behavioural content changed.
|
||||
|
||||
No other findings survive. The three round-1 findings are each fixed at
|
||||
the wire-behaviour level, not just papered over in a comment, and are
|
||||
cross-checked line-for-line against the reference checkout rather than
|
||||
against the Work log's own citations.
|
||||
|
||||
Verdict: PASS
|
||||
+1
-1
@@ -594,7 +594,7 @@ sees them. One subsection per lane, appended, never rewritten.
|
||||
and `PreProcess` drops it for being `Invalid` (`Receiver.cs:42-50`).
|
||||
11. **`SkSend` stamps one `Id` and writes the same `DATA` to every matching
|
||||
socket.** The increment happens once, before the loop
|
||||
(`Common.cs:914`), and the same struct is then handed to `TcpSend` for
|
||||
(`Common.cs:916`), and the same struct is then handed to `TcpSend` for
|
||||
each socket whose `MachineId` matches `Des` — or, for `Des == ID.ALL`,
|
||||
every socket that is not `exceptDes` and whose machine is in the matrix
|
||||
(`:919-929`). `TcpSend` fills `Src` when it is `ID.NONE` and touches
|
||||
|
||||
Reference in new issue
Block a user