session-matrix: learn() persists only when a new machine is learned

QA finding 2. AddToMachinePool returns inside the TryFindMachineByName
branch (MachineStuff.cs:737), before the UpdateMachinePoolStringSetting()
at :755 — which is reachable only from the fall-through "new machine"
path. Switcher.learn was returning [.persistMachinePool] from the known
branch too, asking the app to write MachinePool to disk on every
heartbeat cadence tick from every already-known peer. It now returns [].

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
lucioandClaude Opus 5 committed 2026-09-16 00:58:52 -07:00
1 parent 0e6ee77dc7
commit e0638de0b9
2 files changed
+15 -8

No files matched your search

+7 -3
View File
@@ -80,9 +80,13 @@ the Windows source again.
(`MachineStuff.cs:712-777`) adds to the pool and, when the name is new,
rebuilds the matrix from the pool slot-for-slot so control is
bidirectional at once, then queues the four `Matrix` packets — reported
as `SwitchAction`s, the app decides to persist and reconnect. This lives
on `Switcher`, not on `Session`: the pool and matrix are app-wide and a
session is per-connection.
as `SwitchAction`s, the app decides to persist and reconnect. A peer that
is **already** known produces **no actions**: Windows returns from that
branch at `MachineStuff.cs:737`, before the
`UpdateMachinePoolStringSetting()` at `:755`, so a heartbeat from a known
machine refreshes the in-memory id and timestamp and writes nothing.
This lives on `Switcher`, not on `Session`: the pool and matrix are
app-wide and a session is per-connection.
- **Geometry uses `CGRect`/`CGPoint` from Foundation** (no CoreGraphics
import) in the Windows convention: top-left origin, y down, integer
pixels. The `input-capture` lane converts from CoreGraphics display