CultLib/packages/cultmesh-ts/test
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens e943159a47 Fix an orphaned pendingSends race, add Cut 5 runtime-release and eviction tests
Real bug found while writing the "dispose with a pending send in flight"
regression test, not a pre-scoped fix: sendOnStream() registered a
pendingSends entry unconditionally. If the reliable-send microtask queued
by sendFrame() (chained onto reliableSendTail) ran after cleanup() had
already executed — cleanup()'s own reject-sweep runs once and is guarded
against re-entry, and offConnectionEvent means no later native event can
resolve the entry either — that entry's promise then never settles,
leaking the pending send forever. Confirmed by a hanging test that
reproduced intermittently (~20-25% of runs) when a peer transport's
dispose() raced an in-flight reliable-ordered sendFrame() on the same
transport; not reproducible in isolation outside the full node:test file
(over 100 standalone cycles clean), which points at the race window being
narrow enough that only real inter-test timing variance opens it.
sendOnStream() now checks `this.disposed` before registering, closing the
gap: a send that loses the race rejects immediately instead of
registering an entry nothing will ever settle.

Also gives that regression test its own `{ timeout: 10_000 }` so a
recurrence fails that one test loudly instead of hanging the whole file
for the harness's 60s+ default; 60 consecutive full-file runs were clean
with both changes in place (25 with the fix alone still showed the hang
occasionally, so the fix closes a real but not the only contributing
factor — recorded here rather than claimed as a full proof).

New coverage for the Cut 5 provider's runtime-release-on-every-path
requirement:
- a reliable-ordered send failure evicts the peer without broadcast()
  throwing to the caller;
- the runtime reference is released when the listener itself fails to
  open (a real PKCS12 credential, but a port already bound by another
  listener, so listen()'s own `catch { await runtime.release(); throw
  error; }` actually runs) — split out from a same-named test that had
  only exercised an earlier failure point (extractLeafCertificateDer(),
  before CultMeshQuicNativeRuntime.open() is ever called), which is kept
  as its own, more honestly named test;
- dispose() with a pending send in flight releases the runtime reference
  (the test whose flakiness led to the fix above).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-23 16:36:41 +02:00
..
fixtures Add a provenance note for the QUIC test fixtures 2026-09-23 14:46:25 +02:00
interop Let the TS interop peer prove convergence and golden bytes for lane 3/4 2026-09-23 15:09:37 +02:00
support Add the release() use-after-free regression test (fix 2) 2026-09-23 16:14:42 +02:00
cultmesh.test.ts Fix cultnet-ts test build for out-of-package contract location 2026-09-13 17:43:55 +02:00
provider-rudp-transport.test.ts Fence provider RUDP connection generations 2026-07-19 00:50:20 +01:00
provider-session-wire.test.ts Fence provider RUDP connection generations 2026-07-19 00:50:20 +01:00
provider-session.test.ts Add durable TypeScript provider sessions 2026-07-14 23:13:13 +01:00
realtime-quic-consumer.test.ts Add fix-1 handler-isolation tests for both fault paths 2026-09-23 16:06:16 +02:00
realtime-quic-native.test.ts Add tests for M4b, M10, F7 and strengthen F6kinds 2026-09-23 16:04:52 +02:00
realtime-quic-provider.test.ts Fix an orphaned pendingSends race, add Cut 5 runtime-release and eviction tests 2026-09-23 16:36:41 +02:00
realtime-quic-release-uaf.test.ts Add the release() use-after-free regression test (fix 2) 2026-09-23 16:14:42 +02:00
realtime-quic-session-manager.test.ts Add tests for dial cancellation, F5abort and F5loser 2026-09-23 15:53:34 +02:00
realtime-wire.test.ts Stop the realtime decoder handing back a view of its own frame 2026-09-16 20:20:16 +02:00