// **A consumer that cannot be bound yet is bound again** (novox/hq issue 1793): the runtime's "no responders" at the // bundle's start, seen 2026-10-22 00:28:37 on mesh-catalog#427's verdict, ended the bundle and the verdict was never // written on the forge. import { test } from "node:test"; import assert from "node:assert/strict"; import { bindUntilHeld, bindWait } from "../dist/bind.js"; test("a bind refused with no responders is asked again until it holds, and says so", async () => { let calls = 0; const waits: number[] = []; const said: string[] = []; await bindUntilHeld("mesh-controller.checked", async () => { calls++; if (calls < 4) throw new Error("binding gitea's consumer novox_gitea: nats: no responders available for request"); }, async (ms) => { waits.push(ms); }, (l) => said.push(l)); assert.equal(calls, 4); assert.deepEqual(waits, [2_000, 5_000, 10_000]); assert.equal(said.length, 4); assert.match(said[0], /no responders available for request.*asking again in 2s/); assert.match(said[3], /is bound after 4 attempts/); }); test("a bind that holds the first time says nothing and waits for nothing", async () => { const said: string[] = []; await bindUntilHeld("x", async () => {}, async () => assert.fail("waited"), (l) => said.push(l)); assert.deepEqual(said, []); }); test("the wait grows to 30 s and stays", () => { assert.deepEqual([1, 2, 3, 4, 50].map(bindWait), [2_000, 5_000, 10_000, 30_000, 30_000]); });