From 8f50f2eece627c82c15140c48035d9263aaf28a6 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 16 Jun 2026 04:22:19 +0100 Subject: [PATCH] Assert RUDP reconnect policy in interop profiles --- docs/cultnet-transport-parity.md | 3 +- docs/runtime-parity-scope.md | 7 +++-- .../test/interop/cultnet-interop.test.ts | 28 ++++++++++++++++--- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/docs/cultnet-transport-parity.md b/docs/cultnet-transport-parity.md index 06ce00dd..84ec3fd5 100644 --- a/docs/cultnet-transport-parity.md +++ b/docs/cultnet-transport-parity.md @@ -186,7 +186,8 @@ Current progress: directions for C#, Kotlin, Python, and Rust peers against TypeScript. Those tests send `cultnet.schema_catalog_request.v0` payloads through reliable ordered `schema` frames and validate `cultnet.hello.v0` responses with advertised - RUDP transport profiles where the responding runtime owns them. + RUDP transport profiles where the responding runtime owns them, including the + shared `reconnectPolicy` field. - The same harness now proves reliable ordered `schema` delivery survives one dropped data packet in both directions between TypeScript and C#/Kotlin/Python/Rust. The drops happen below the transport connection through a UDP bridge, so the diff --git a/docs/runtime-parity-scope.md b/docs/runtime-parity-scope.md index 3ed5ffcc..1099484c 100644 --- a/docs/runtime-parity-scope.md +++ b/docs/runtime-parity-scope.md @@ -43,9 +43,10 @@ CultMesh. TypeScript, Rust, Python, and Kotlin, including loss, reordering, fragmentation, disconnect reason propagation, ping/pong, and schema-v0 MessagePack over RUDP for C#, Rust, Python, and Kotlin peers against - TypeScript. Runtime-local tests also cover RUDP transport-profile - advertisement of the portable reconnect policy plus the deterministic delay - helper in C#, TypeScript, Rust, Python, and Kotlin. + TypeScript. Those RUDP schema-message tests also assert the advertised + `reconnectPolicy` profile field from C#, Rust, Python, and Kotlin peers. + Runtime-local tests cover the deterministic delay helper in C#, TypeScript, + Rust, Python, and Kotlin. - `packages/cultcache-py/PARITY.md` is the Python-specific audit ledger. Its "Still Not Claimed" section is part of the contract, not an apology. - `docs/cultnet-transport-parity.md` is the transport ownership map. It tracks diff --git a/packages/cultnet-ts/test/interop/cultnet-interop.test.ts b/packages/cultnet-ts/test/interop/cultnet-interop.test.ts index 8a71976c..6510d0d9 100644 --- a/packages/cultnet-ts/test/interop/cultnet-interop.test.ts +++ b/packages/cultnet-ts/test/interop/cultnet-interop.test.ts @@ -999,12 +999,13 @@ test("CultNet TypeScript and Python exchange schema-v0 MessagePack messages over schemaVersion?: string; runtimeId?: string; supportsSchemaCatalog?: boolean; - transportProfiles?: Array<{ transports?: Array<{ protocol?: string; channels?: Array<{ channelId?: string }> }> }>; + transportProfiles?: Array<{ transports?: Array<{ protocol?: string; reconnectPolicy?: unknown; channels?: Array<{ channelId?: string }> }> }>; }; assert.equal(message.schemaVersion, "cultnet.hello.v0"); assert.equal(message.runtimeId, "python-rudp-message-interop"); assert.equal(message.supportsSchemaCatalog, true); assert.equal(message.transportProfiles?.[0]?.transports?.[0]?.protocol, "rudp"); + assertRudpReconnectPolicy("Python", message.transportProfiles?.[0]?.transports?.[0]?.reconnectPolicy); assert.equal(message.transportProfiles?.[0]?.transports?.[0]?.channels?.[0]?.channelId, "schema"); const [exitCode] = await withTimeout(once(pythonPeer.child, "exit"), 2_000, "Python RUDP message peer exit"); @@ -1182,12 +1183,13 @@ test("CultNet TypeScript and Rust exchange schema-v0 MessagePack messages over R schemaVersion?: string; runtimeId?: string; supportsSchemaCatalog?: boolean; - transportProfiles?: Array<{ transports?: Array<{ protocol?: string; channels?: Array<{ channelId?: string }> }> }>; + transportProfiles?: Array<{ transports?: Array<{ protocol?: string; reconnectPolicy?: unknown; channels?: Array<{ channelId?: string }> }> }>; }; assert.equal(message.schemaVersion, "cultnet.hello.v0"); assert.equal(message.runtimeId, "rust-rudp-message-interop"); assert.equal(message.supportsSchemaCatalog, true); assert.equal(message.transportProfiles?.[0]?.transports?.[0]?.protocol, "rudp"); + assertRudpReconnectPolicy("Rust", message.transportProfiles?.[0]?.transports?.[0]?.reconnectPolicy); assert.equal(message.transportProfiles?.[0]?.transports?.[0]?.channels?.[0]?.channelId, "schema"); const [exitCode] = await withTimeout(once(rustPeer.child, "exit"), 2_000, "Rust RUDP message peer exit"); @@ -1366,12 +1368,13 @@ test("CultNet TypeScript and C# exchange schema-v0 MessagePack messages over RUD schemaVersion?: string; runtimeId?: string; supportsSchemaCatalog?: boolean; - transportProfiles?: Array<{ transports?: Array<{ protocol?: string; channels?: Array<{ channelId?: string }> }> }>; + transportProfiles?: Array<{ transports?: Array<{ protocol?: string; reconnectPolicy?: unknown; channels?: Array<{ channelId?: string }> }> }>; }; assert.equal(message.schemaVersion, "cultnet.hello.v0"); assert.equal(message.runtimeId, "csharp-rudp-message-interop"); assert.equal(message.supportsSchemaCatalog, true); assert.equal(message.transportProfiles?.[0]?.transports?.[0]?.protocol, "rudp"); + assertRudpReconnectPolicy("C#", message.transportProfiles?.[0]?.transports?.[0]?.reconnectPolicy); assert.equal(message.transportProfiles?.[0]?.transports?.[0]?.channels?.[0]?.channelId, "schema"); const [exitCode] = await withTimeout(once(csharpPeer.child, "exit"), 2_000, "C# RUDP message peer exit"); @@ -1550,12 +1553,13 @@ test("CultNet TypeScript and Kotlin exchange schema-v0 MessagePack messages over schemaVersion?: string; runtimeId?: string; supportsSchemaCatalog?: boolean; - transportProfiles?: Array<{ transports?: Array<{ protocol?: string; channels?: Array<{ channelId?: string }> }> }>; + transportProfiles?: Array<{ transports?: Array<{ protocol?: string; reconnectPolicy?: unknown; channels?: Array<{ channelId?: string }> }> }>; }; assert.equal(message.schemaVersion, "cultnet.hello.v0"); assert.equal(message.runtimeId, "kotlin-rudp-message-interop"); assert.equal(message.supportsSchemaCatalog, true); assert.equal(message.transportProfiles?.[0]?.transports?.[0]?.protocol, "rudp"); + assertRudpReconnectPolicy("Kotlin", message.transportProfiles?.[0]?.transports?.[0]?.reconnectPolicy); assert.equal(message.transportProfiles?.[0]?.transports?.[0]?.channels?.[0]?.channelId, "schema"); const [exitCode] = await withTimeout(once(kotlinPeer.child, "exit"), 2_000, "Kotlin RUDP message peer exit"); @@ -2963,6 +2967,22 @@ function assertTcpFramedTransportProfile(peerId: string, value: unknown): void { assert.equal(transport?.channels?.[0]?.ordering, "ordered"); } +function assertRudpReconnectPolicy(peerName: string, value: unknown): void { + assert.ok(value && typeof value === "object", `${peerName} did not advertise an RUDP reconnect policy`); + const policy = value as { + schemaVersion?: string; + policyId?: string; + baseDelayMs?: number; + maxDelayMs?: number; + maxJitterMs?: number; + }; + assert.equal(policy.schemaVersion, "cultnet.reconnect_policy.v0"); + assert.equal(policy.policyId, "default"); + assert.equal(policy.baseDelayMs, 1_000); + assert.equal(policy.maxDelayMs, 30_000); + assert.equal(policy.maxJitterMs, 250); +} + async function requestCultMeshFromPython(port: number, request: Record): Promise { const socket = connectTcp(port, "127.0.0.1"); const framer = new LengthPrefixedMessageFramer();