RoomConformanceSuite
Reusable contract test suite for RoomFactory implementations.
Subclass and implement newHarness to bind any RoomFactory under test. Every Test encodes a required invariant of the Room lifecycle state machine.
Lives in commonMain of :kuilt-conformance (not a module's commonTest) so every RoomFactory adapter can subclass it from its own test source set.
Virtual time convention: all partition tests advance in 100 ms steps using fastHeartbeatConfig (interval=100ms, timeout=200ms, reconnectWindow=500ms):
4 × 100 ms → MembershipEvent.Partitioned fires.
9 × 100 ms → past reconnect window → PeerLost / MembershipEvent.HostLost.
Scope contract: newHarness receives the test's CoroutineScope (typically backgroundScope from runTest) so FaultyLoom and SeamRoomFactory are correctly structured under the test's virtual-time scheduler.
Fault injection: tests that require partition behaviour check RoomHarness.faultyLoom — when null the test is skipped so subclasses backed by fabrics that do not support fault injection still pass the suite.
Types
A harness that bundles host and joiner RoomFactorys plus optional FaultyLoom for partition tests.
Properties
Fast heartbeat config shared by all tests so virtual-time advancement is cheap. Advancing 4 × 100 ms triggers MembershipEvent.Partitioned; advancing 9 × 100 ms exhausts the reconnect window (PeerLost / HostLost).
Functions
Provide a fresh RoomHarness for one test, using scope as the coroutine scope for background loops (SeamRoomFactory, FaultyLoom).
Faults only the host's FaultySeam (0) with FaultProfile.DropAll in both directions. The joiner's seam (1) stays Healthy, mirroring us.tractat.kuilt.session.PartitionRoleTest's proven partition/recovery pattern.