Integration test fixes: reconcile SyncTypeFlags phantom-bit assertions and sync-round counts

- SyncTypeFlags phantom-bit tests used bits 8/9/10 as unmapped examples;
  board/prekey/group now map those, so use bits 11+ (still unmapped).
- rawValueInitNormalizesPhantomBits: highest known bit is now 10, so the
  flags serialize to 2 bytes, not 1.
- Board/fragment/announce sync tests silence the prekey round (added by the
  prekeys feature; default 60s schedule fires at the maintenance barrier).
- DiagnosticsMockContext: conform to the CommandContextProvider members added
  by private-groups (group*) and cashu-chips (sendPublicMessage).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jack
2026-07-06 22:38:45 +02:00
co-authored by Claude Fable 5
parent 94e7f91b7b
commit e0e90af9fd
5 changed files with 28 additions and 11 deletions
@@ -38,9 +38,10 @@ struct SyncTypeFlagsBoardTests {
/// decode path accepts the bytes and simply maps unknown bits to no
/// message type, so a board-only request reads as "nothing I can serve".
@Test func unknownBitsDecodeToNoTypes() throws {
// Bits 9-15 are unassigned; a future (or unknown) two-byte bitfield
// Bits 11-15 are unassigned after the feature integration (bit 8 is
// board, 9 prekey, 10 group); a future (or unknown) two-byte bitfield
// must decode without error and yield no known types.
let decoded = try #require(SyncTypeFlags.decode(Data([0x00, 0xFE])))
let decoded = try #require(SyncTypeFlags.decode(Data([0x00, 0xF8])))
#expect(decoded.toMessageTypes().isEmpty)
for type in [MessageType.announce, .message, .fragment, .fileTransfer, .boardPost] {
#expect(!decoded.contains(type))
@@ -48,8 +49,8 @@ struct SyncTypeFlagsBoardTests {
}
@Test func mixedKnownAndUnknownBitsKeepKnownTypes() throws {
// Known low-byte flags survive alongside unknown high bits.
let decoded = try #require(SyncTypeFlags.decode(Data([0x03, 0xFE])))
// Known low-byte flags survive alongside unknown high bits (11-15).
let decoded = try #require(SyncTypeFlags.decode(Data([0x03, 0xF8])))
#expect(decoded.contains(.announce))
#expect(decoded.contains(.message))
#expect(Set(decoded.toMessageTypes()) == Set([.announce, .message]))