cultmesh-ts: test that a grant arriving after the decide timeout is refused and never reaches the handler
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Failing after 4m41s
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Successful in 57s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Libby 2026-11-08 09:13:08 +00:00
commit 386f036849

View file

@ -251,6 +251,21 @@ test("an authority that never settles refuses after the timeout and does not blo
});
});
test("an authority that settles GRANTED after the timeout is still refused and the write never reaches the handler", async () => {
const authority = new Recording((request) => request.recordKey === KEY_A
? new Promise((resolve) => setTimeout(() => resolve({ granted: true }), 300))
: { granted: true });
await using(await rig(authority, { writeAuthorityTimeoutMs: 100 }), async (r) => {
r.peer.send(put(KEY_A));
r.peer.send(del(KEY_A));
await sleep(700);
assert.equal(r.replies.length, 2, "one refusal per frame, no late second reply");
assertRefused(r.replies[0], KEY_A);
assertRefused(r.replies[1], KEY_A);
assert.deepEqual([r.puts.length, r.deletes.length], [0, 0], "the late grant never reached the handler");
});
});
test("a write authority timeout that is not a usable timer delay is refused at construction", () => {
for (const bad of [0, -1, Number.NaN, Number.POSITIVE_INFINITY, 2 ** 31]) {
assert.throws(() => CultMesh.createRudpDocumentServer("authority-server", 1, {