fix(09): WR-03/IN-03/IN-04 add drain-listener teardown, test-only __resetDrainState, and remove stale RED @ts-ignore

This commit is contained in:
Lucas Berger
2026-06-12 20:51:49 -04:00
parent e1ffddf8dc
commit b724b3e932
2 changed files with 36 additions and 15 deletions
+12
View File
@@ -873,6 +873,18 @@ export function stopOutboxTrigger(): void {
unsubscribeDrain = null;
}
/**
* IN-03: test-only reset for the module-level concurrency flags.
* isDraining/drainRequested are the entire concurrency contract for the
* single-process deployment and are NOT touched by vi.resetAllMocks(). Tests call
* this in beforeEach so each test starts from a known-quiescent state instead of
* relying on the previous test having drained cleanly. Not for production use.
*/
export function __resetDrainState(): void {
isDraining = false;
drainRequested = false;
}
/**
* Starts the 15-second background outbox drain schedule (polling fallback, D-08).
* Call once at API startup (wired in index.ts beside startBrokerPoller).