SeamConformanceSuite

abstract class SeamConformanceSuite

Reusable contract test suite for Loom implementations.

Subclass and implement newLoomPair to bind any fabric under test. Every Test in this class encodes a required invariant of the seam contract — a conforming implementation must pass all of them.

Lives in commonMain of :kuilt-conformance (not a module's commonTest) so every fabric adapter can subclass it from its own test source set — realising the "one conformance suite, every fabric passes it" invariant.

Provide a fresh host/joiner pair per test via newLoomPair:

  • .first hosts via Loom.host (i.e. weave(Rendezvous.New(pattern))).

  • .second joins via Loom.join with joinTag (i.e. weave(Rendezvous.Existing(joinTag()))).

In-process radio fabrics return the same instance twice: (loom, loom). Role-split fabrics (websocket, mdns, webrtc, multipeer) return distinct host/joiner Looms wired to reach each other.

Weaving timing invariant

The invariant "a frame sent while SeamState.Weaving is not silently dropped" is not asserted in this suite because all current harnesses produce instant-SeamState.Woven seams: relay fabrics (WebSocket, InMemory) weave at construction, and the Multipeer fake fires its peer-connected callback synchronously during weave(), so no harness actually starts SeamState.Weaving by the time newLoomPair returns. Asserting a Weaving precondition here would produce a vacuously-passing test on every fabric.

The enforcement point for this invariant is DelayedWovenLoomTest, which uses DelayedWovenLoom — a test-only harness that holds the seam in SeamState.Weaving until DelayedWovenSeam.markWoven is called explicitly — to reproduce the radio-fabric timing window deterministically. Radio fabric conformance harnesses that fire their connected event asynchronously should run their own equivalent of DelayedWovenLoomTest to confirm frames are not dropped in the window.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun closeDrivesStateTornNormal(): TestResult
Link copied to clipboard
fun closeIsIdempotent(): TestResult
Link copied to clipboard
fun hostStateIsWovenEvenAlone(): TestResult
Link copied to clipboard
open fun incomingCompletesWhenSeamCloses(): TestResult
Link copied to clipboard
open fun joinTag(): Tag

The advertisement the joiner uses. Defaults to the in-memory tag.

Link copied to clipboard
abstract fun newLoomPair(): Pair<Loom, Loom>

Provide a fresh host/joiner Loom pair per test.

Link copied to clipboard
fun stateIsWovenAfterConnect(): TestResult