CultLib/scripts
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens 6cbc73fb17 Encode a CultMesh realtime frame in TypeScript
One codec, `packages/cultmesh-ts/src/realtime-wire.ts`, rule for rule what
`CultMeshRealtimeWireProtocol` does: the 37-byte little-endian fixed header
with magic 0x31545343, the delivery byte as the C# enum ordinal, the i64
epoch and sequence, three u16 identity lengths, the i32 payload length, the
stamped header size and wire version, then UTF-8 identities and the payload.
It touches no socket; QUIC stream framing stays transport-owned. The blank
reading in `Validate` is `IsNullOrWhiteSpace`, whose whitespace set is not
`String.prototype.trim`'s, so it borrows `isNullOrWhiteSpaceCSharp` from
`cultnet-ts` rather than growing a second reading of the same rule.

Byte parity is proven in both directions and in two processes, which is what
the authority vectors cost us to learn. `contracts/cultmesh/realtime-frame-vectors.json`
is written by the new C# test under CULTMESH_WRITE_VECTORS=1 and decoded and
re-encoded here; `realtime-frame-vectors.ts-written.json` is written by
`scripts/write-cultmesh-realtime-frame-vectors.mjs` with this codec, over
different identities and epochs, and decoded by the same C# test with the
reference implementation alone. Both files share one field shape, so each
side reads both with one reader. The two cases that would put megabytes into
a committed contract file, identities at exactly 65,535 UTF-8 bytes and a
64 MiB payload, are recorded as a build rule plus the digest of the whole
encoding; both sides build them the same way.

Three things the C# reference gets from its type system and TypeScript does
not, each refused rather than left to surface as a stray runtime error: a
`bigint` outside the i64 range, a delivery string the union cannot spell, and
a leading U+FEFF, which `TextDecoder` deletes by default and
`Encoding.UTF8.GetString` keeps. The last one is a real divergence the test
caught; the decoder now sets `ignoreBOM`. U+FEFF is not whitespace to .NET,
so such an identity passes the transport contract and reaches the wire.

There was no C# test for this codec before; this is also its first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 19:20:41 +02:00
..
build-quic-native.ps1 Recover authority-bound CultMesh and atomic generations 2026-08-26 19:01:24 +02:00
build-unity-package.ps1 Release CultLib Unity 1.0.57 with deterministic plugin assemblies 2026-09-14 15:18:42 +02:00
measure-reactive-document-performance.mjs Measure reactive performance across runtimes 2026-08-18 03:08:01 +02:00
measure-reactive-document-performance.ps1 Split the Python runtime into cultcache-py, cultnet-py, cultmesh-py 2026-09-10 13:10:47 +02:00
mutate-cultmesh-authority.mjs Repair only the file states the mutation runner itself wrote 2026-09-16 18:35:44 +02:00
pack-nuget.ps1 Delete the CultCache MessagePack source generator 2026-09-13 23:38:08 +02:00
run-typescript-workspaces.mjs Add real browser CultMesh transport proof 2026-08-18 00:05:57 +02:00
sign-cultmesh-authority-vectors.mjs Pin the TypeScript-signed direction of the authority parity check 2026-09-16 16:27:06 +02:00
test-typescript-package-closure.mjs Let the verse catalog schema say what the reference emits 2026-09-10 13:55:46 +02:00
verify-eve-browser-network.mjs Let the browser sample read the provider's advertisement 2026-09-10 13:55:46 +02:00
verify-eve-getting-started.ps1 Ship authenticated remote transports in Unity package 2026-08-18 20:23:27 +02:00
verify-eve-two-runtime-sample.ps1 Retain native clients across provider routes 2026-08-18 03:34:59 +02:00
verify-reactive-document-scaling.ps1 Split the Python runtime into cultcache-py, cultnet-py, cultmesh-py 2026-09-10 13:10:47 +02:00
write-cultmesh-realtime-frame-vectors.mjs Encode a CultMesh realtime frame in TypeScript 2026-09-16 19:20:41 +02:00