feat(mesh): give boot a grace period for a slow teapot, and fail for an absent one #53

Merged
chrnx merged 1 commits from feat/mesh-boot-retry into develop 2026-08-18 18:18:24 +00:00
Owner

Reemplaza al #49, que apuntaba a feat/mesh-envelope y por eso no recibía CI — ci.yml filtra por rama destino (pull_request: branches: [develop, main, contrib]).

bootTimeoutMs (default timeoutMs) reintenta a un teapot que aún no termina de arrancar. Cuando se agota el presupuesto el boot falla igual: un provider del que depende el grafo no es opcional, y arrancar sin él solo mueve el fallo al primer request, donde es un 503 de quien llama en vez del error del deploy. 0 restaura un solo intento.

La batería completa atrapó el primer intento equivocado: un secreto incorrecto se estaba reintentando. Eso es decisión del teapot, no de la red, y va a ser la misma en 30s — ahora falla de inmediato. Se distinguen por si el socket llegó a abrir, lo que evita hilar códigos de cierre por el contrato de socket neutral de los cuatro runtimes.

Los reintentos van al logger y al bus como mesh:boot:retry, separado de mesh:disconnect — ese es un link que estuvo arriba y se cayó; este nunca subió.

437 vitest / 12 Deno / 7 Bun / edge / JSR dry run.

Reemplaza al #49, que apuntaba a `feat/mesh-envelope` y por eso no recibía CI — `ci.yml` filtra por rama destino (`pull_request: branches: [develop, main, contrib]`). `bootTimeoutMs` (default `timeoutMs`) reintenta a un teapot que aún no termina de arrancar. Cuando se agota el presupuesto **el boot falla igual**: un provider del que depende el grafo no es opcional, y arrancar sin él solo mueve el fallo al primer request, donde es un 503 de quien llama en vez del error del deploy. `0` restaura un solo intento. **La batería completa atrapó el primer intento equivocado:** un secreto incorrecto se estaba reintentando. Eso es decisión del teapot, no de la red, y va a ser la misma en 30s — ahora falla de inmediato. Se distinguen por si el socket llegó a *abrir*, lo que evita hilar códigos de cierre por el contrato de socket neutral de los cuatro runtimes. Los reintentos van al logger **y** al bus como `mesh:boot:retry`, separado de `mesh:disconnect` — ese es un link que estuvo arriba y se cayó; este nunca subió. 437 vitest / 12 Deno / 7 Bun / edge / JSR dry run.
chrnx added 1 commit 2026-08-18 18:01:39 +00:00
feat(mesh): give boot a grace period for a slow teapot, and fail for an absent one
CI / dco (pull_request) Successful in 4s
CI / build (pull_request) Successful in 24s
CI / runtimes (deno) (pull_request) Successful in 18s
CI / runtimes (edge) (pull_request) Successful in 13s
CI / runtimes (bun) (pull_request) Successful in 16m11s
1975a7c03f
A teapot that is thirty seconds behind and a teapot that does not exist look
identical for the first thirty seconds, and only one of them should stop a
deploy. bootTimeoutMs is that grace: retries with backoff until it passes.

It still fails after that, deliberately. A provider the graph depends on is
not optional, and booting without it would only move the failure to the first
request, where it is a caller's 503 rather than the deploy's error.

The full battery caught what the first cut got wrong: a bad secret was being
retried. That is not a transient failure — it is the teapot's decision, and it
will be the same decision in thirty seconds, so retrying only spends the
deploy's patience to arrive at the identical error. Refusals now fail at once.

Telling them apart without threading close codes through the neutral socket
contract of four runtimes: a peer that accepted the connection and then hung
up before answering rejected us on purpose; one that never accepted it may
simply not be listening yet. That is exactly the distinction needed here.

Retries are logged and emitted as mesh:boot:retry, kept separate from
mesh:disconnect — that one is a link that was up and went away, this one never
came up, and a deploy watching for trouble wants to tell those apart.

437 vitest / 12 Deno / 7 Bun / edge / JSR dry run.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx merged commit cd4f47486f into develop 2026-08-18 18:18:24 +00:00
Sign in to join this conversation.