Commit graph

3 commits

Author SHA1 Message Date
2131193f1f fix: come back quickly after a hub restart, and pin the dependencies
Two things helloeco ran into while wiring the gateway.

grpc-js waits a second before its second reconnect attempt and backs
off towards two minutes. That is right for a far-away service and
wrong for a hub on the same network: after a restart or a deploy a
gateway sits out the backoff with requests in hand. The client now
sets initial 200 ms and a 5 s ceiling, and a caller's own
channelOptions still win. The client exposes the options it ended up
with, which is the only way to tell a default that applies from one
that was silently replaced.

The dependencies are pinned exactly instead of by range. This package
is consumed by a handful of services, not by a library ecosystem, and
a surprise minor of grpc-js is what breaks a portal at three in the
morning. Raising one is a commit, with the skew job in front of it.

Guards: the defaults and the precedence are asserted (probed by
mutation), plus a case that a run works again once the hub is back.

Signed-off-by: flemming-it <sf@flemming.it>
2026-10-27 03:01:08 +01:00
0db793494d feat: idempotency key, the INTERRUPTED phase, and a real-hub skew suite
The hub now takes an idempotency key and reports INTERRUPTED for a run
its process did not survive, so the client exposes both. The real-hub
suite gained the cross-language half of the idempotency guard: a
repeated key has to answer with the first run's outputs, which only a
real hub can prove.

Signed-off-by: flemming-it <sf@flemming.it>
2026-10-27 01:32:58 +01:00
b6c6cc8295 feat: TypeScript client for Node, with a scriptable fake hub
A service in front of a hub needs four things: start a flow, follow
it, read what a detached run produced, and decide approvals. This is
that surface, plus the part a gateway cannot test without: a fake hub
that speaks the same service from the same .proto files and can be
scripted into every failure a real hub produces.

Errors carry the hub's own class (chain-error-kind), a coarse family,
and reachedHub, which separates a refused connection from a hub that
reports a dependency as down. Both arrive as gRPC UNAVAILABLE, and a
gateway that shows 'service not reachable' for the second one lies to
its users.

The .proto files are carried verbatim and loaded at runtime, so no
generated code can drift from the contract; two guards hold the
copies in place, and a skew suite runs the same client against a real
hub binary.

32 hermetic tests plus 4 against a real hub.

Signed-off-by: Dr. Stefan Flemming <sf@flemming.it>
2026-10-27 00:59:57 +01:00