From 9e95374bca5f2d278469fc57075a54bb1453593f Mon Sep 17 00:00:00 2001 From: ecgang Date: Fri, 31 Jul 2026 10:07:39 -0700 Subject: [PATCH] Restore the periphery ignore the skip-set fix made necessary again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing the alias-scoped sweep from flushOutbox took away the only direct read of PeerMessageKey.peerID, so Periphery flags it assign-only and the Dead Code check goes red. That sweep is exactly what commit a450204 cited when it dropped this suppression, and exactly what the Critical fix in 1adf220 had to delete: it derived the flush's skip set from every secureTransmissions entry under the aliases with no liveness check. The property is not dead. It is what scopes secureTransmissions and dropMessage per peer, and it is read through the synthesized Hashable conformance, which the indexer cannot attribute. Deleting it to satisfy the scanner would let one alias's drop clear its twin under the other — the bug this PR spent three commits closing. Verified locally with periphery scan --strict: the MessageRouter warning is gone and the restored directive is not itself reported superfluous, which is the failure mode that turned this red the last time round. Co-Authored-By: Claude Opus 5 (1M context) --- bitchat/Services/MessageRouter.swift | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bitchat/Services/MessageRouter.swift b/bitchat/Services/MessageRouter.swift index 1577153e..06ecc4f8 100644 --- a/bitchat/Services/MessageRouter.swift +++ b/bitchat/Services/MessageRouter.swift @@ -35,10 +35,19 @@ final class MessageRouter { typealias QueuedMessage = MessageOutboxStore.QueuedMessage private struct PeerMessageKey: Hashable { - // Both properties are read directly now — `peerID` by the alias-scoped - // sweep in `flushOutbox(forAliases:)`, `messageID` throughout — so the - // ignore directive this once carried (for reads visible only through - // the synthesized Hashable conformance) would itself be flagged. + // periphery:ignore - read only via the synthesized Hashable + // conformance (dictionary-key identity), which the indexer + // cannot attribute; see retain_codable_properties in .periphery.yml + // for the same class of false positive. + // + // The alias-scoped sweep in `flushOutbox(forAliases:)` used to read + // this directly, which is why the suppression was dropped in a450204. + // That sweep was the bug: it derived the flush's skip set from every + // `secureTransmissions` entry under the aliases with no liveness + // check, so removing it brought the false positive back. Do not delete + // the property to satisfy the scanner — it is what scopes + // `secureTransmissions` and `dropMessage` per peer, and collapsing it + // would let one alias's drop clear its twin under the other. let peerID: PeerID let messageID: String }