3 Commits
Author SHA1 Message Date
lucioandClaude Opus 5 1445d546a1 polish P1: carry the cipher scheme through the channels, diagnose a mismatch
ChannelConfig and BulkConfig carry MacCipherScheme; a change to it reopens
every connection the way a key change does. PeerConnection reads the
scheme's preamble length (16 legacy, 48 modern) instead of a hard-coded 48.

The diagnostic: the peer's opening bytes are kept until one packet has
framed. If the first packet fails framing under the configured scheme and
the same raw bytes frame under the other one, the connection closes with
.invalidKey(.cipherSchemeMismatch) and reports status
.cipherSchemeMismatch, so the menu names the setting to change rather than
blaming the security key. Costs one AES setup on a connection that was
going to fail anyway, and nothing at all on success.

The bulk channel needs no diagnostic: a transfer only starts with a peer
whose control connection already framed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 21:08:19 -07:00
lucioandClaude Opus 5 c4ac584df0 control-channel: CLAUDE.md re-read — citation and doc-comment fixes
Item 4 of the rework brief: re-read the four MWBNet files against
CLAUDE.md. Sizes (189/234/356/524), function lengths, layering, the
one-sentence responsibility test, no force-unwrap/try!/fatalError/
precondition, no logging of any kind and no packet interpretation all
hold; `swift-format format -i` is a no-op on all four. Three citations
were off and are corrected against the source:

- `Common.SendByeBye` is Common.cs:611-615, not 612-616 (ControlChannel,
  PeerConnection).
- `SkSend`'s stamp-and-fan-out is Common.cs:916-930, and the
  `Des == ID.ALL` matrix test is :922-930, not :912-930 / :919-929.

`DisconnectReason.idCollision` and `channelDetectedIDCollision` now say
in their doc comments what the previous commit made true in the code:
the collision is looked for on outbound connections only
(SocketStuff.cs:1980-1992).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-09-16 01:43:07 -07:00
lucio f6cc824e91 control-channel: ChannelConfig, Resolver, PeerConnection, ControlChannel; drop MWBNet placeholder 2026-09-16 01:21:18 -07:00