Keysat 890d671bf2 Dedupe relay response-parsing + operator calls; add relay unit tests
Collapse three byte-identical response-parsing blocks (getRelay, postRelay,
and the tts error path) into one handleRelayResponse helper. pingBalance is
deliberately left out: it records a relay error even on a parsed envelope,
a different contract from the other three (updateRelayState clears lastError
while recordRelayError sets it), so folding it in would change observable
state.

Collapse the six operator-to-relay calls into operatorPost / operatorGet,
preserving their intentional split: writes (tier grant, invoice, order)
throw on misconfig or non-OK so the operator action surfaces the failure;
reads (tier, plans, expiring subs) return null so the caller falls back to
a default. Per-function signatures, body shapes, error messages, and the
throw-vs-null behavior are unchanged.

Add server/test/relay.test.js (first fetch-mock harness for relay.js):
14 tests covering the tts error-path control flow, handleRelayResponse's
envelope parsing and error-recording rule, and the operator throw-vs-null
contract including the missing-config branch. 158 tests pass.

ROADMAP gains the deferred refactor-survey items (subscription engine,
/api/process pipeline, sweep middleware, transcript coalescers) and notes
the relay-test coverage against the existing known-debt entries.
2026-06-20 06:07:21 -05:00
2026-04-09 15:03:31 -05:00
2026-06-14 09:39:46 -05:00
2026-04-09 15:03:31 -05:00
2026-04-09 15:03:31 -05:00
2026-04-09 15:03:31 -05:00
2026-04-09 15:03:31 -05:00
S
Description
No description provided
52 MiB
Languages
JavaScript 45.9%
HTML 39%
TypeScript 13.4%
Shell 1.2%
Makefile 0.3%
Other 0.2%