mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-08-15 07:06:11 +00:00
Two gaps a review found in the launch-restore predicate. A private group could never restore. A group id is `group_` plus 32 hex, so both peer lookups guard on `isShort` and return empty without ever consulting the group — leaving `isDirectChatRestorable` to refuse every group, silently, every time. That is backwards: `startPrivateChat` gates group re-entry on nothing at all, because a group is local state rather than a claim about reaching a peer, so there is no phantom to guard against. Groups are now admitted on their own branch, ahead of the peer terms and behind the block veto. One test pins the admission and a second pins that neither peer term is consulted, so a group cannot be let in by an unrelated term happening to match. The geoDM reasoning was also describing behaviour the code does not have. It claimed a geoDM restores on its own favorite record; in fact `FavoritesPersistenceService` is keyed by Noise public key alone, and `getFavoriteStatus(forPeerID:)` matches by rebuilding `PeerID(publicKey:)`, which carries no prefix and so can never equal a `nostr_`-prefixed id. A geoDM therefore never restores today. The branch is the right shape for the day a Nostr-keyed lookup exists; until then it resolves to false. Documented rather than fixed, because adding that lookup means new favorites plumbing and this change does not touch that service. Mutation-proven: removing the group branch fails both group tests and nothing else, while the blocked-group test keeps passing on its own veto. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>