Commit Graph
21 Commits
Author SHA1 Message Date
chrnx 9d95260706 chore(test): nest the close({ timeoutMs }) case inside its describe block
CI / dco (push) Has been skipped
CI / dco (pull_request) Successful in 4s
CI / build (push) Successful in 35s
CI / build (pull_request) Successful in 34s
The test landed one line below the closing brace of describe('graceful
shutdown'), so it ran at the top level instead of under the block it
belongs to. Placement only; the assertions are untouched.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-08-12 13:34:07 -05:00
ServeurGoat 3dcf784159 fix: add timeout to app.close()
Signed-off-by: YxnnXriel <yannariel13@gmail.com>
2026-08-12 13:33:10 -05:00
chrnx 8e38fffd77 fix(router): reject invalid and ambiguous paths
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-08-02 20:39:09 -05:00
chrnx 9886e53747 feat(app): add app.ready() so introspection works on any app
inspect()/graph()/explain() are synchronous, but a mesh graph is not knowable
until its teapots have been asked, so on a mesh app they threw and the caller had
no way to fix it. Code holding an `App` could not tell which kind it had — the
Liskov complaint from the audit, and the last of it: fetch/upgrade stopped
throwing when the boot moved into the gate.

app.ready() resolves the graph and returns. On a mesh app it connects the
teapots; on every other app it is a no-op. So one shape works for both:

    await app.ready();
    app.graph();

which is what actually restores substitutability — a uniform protocol, not a type
that describes the asymmetry.

Deliberately not a full boot: it does not run provider factories. Resolving the
graph and being ready to serve are different things, and a devtool drawing a
diagram should not open your database connections. Serving boots them too and
shares the same memoized step, so ready() then fetch() resolves the graph once.

The guards stay — sync code cannot await network I/O — but the message names the
fix instead of describing the trap.

createApp hit 26 on the complexity gate with ready() added. Both boot stages had
their own copy of the same memoisation, so it collapses into one `once` helper
used by both, which is a smaller createApp than before this change.

Refs .specs/2026-07-15-green-tea-solid-audit (App/Mesh LSP)

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-15 23:00:14 -05:00
chrnx df13a62d93 fix(app): serve /__graph__ and /__openapi__ over app.fetch (dev tools on all runtimes)
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-10 00:10:54 -05:00
chrnx 27a984f070 feat(graph): interactive Cytoscape viewer for /__graph__
CI / build (push) Has been cancelled
Mermaid's static diagram overlaps badly as the graph grows. Replace the
/__graph__ HTML with an interactive Cytoscape.js + dagre viewer (both loaded
from a CDN, so no runtime dependency is added — the one-dep pitch holds).

Clicking a route lights up its real transitive slice and dims the rest;
clicking a provider/step shows its blast radius. Edges are colour-coded by
kind (needs vs feeds-endpoint), provider/step/endpoint nodes are visually
distinct, and nodes are draggable. toMermaid()/toDOT() and the text/plain
path are unchanged.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-09 10:44:03 -05:00
chrnx 2db5de6858 feat: per-route body limits, custom error rendering, OpenAPI generation
CI / build (push) Has been cancelled
Three capabilities that share the same request/route metadata:

- **Per-route upload limits** — `@Post('/x', { maxBodyBytes, maxParts })`
  overrides the server-wide `limits` for one route (falls back to the
  global default), mirroring the existing per-route `duplicates`.

- **Custom error rendering** — `createApp({ onError })` takes over how any
  error becomes a response (HTML, RFC 7807, content-negotiated), covering
  the whole surface: handler/step throws, 404, 405, 413, 400. Returns a
  response or undefined to fall back to the default JSON. Also wires the
  previously-unused `HttpError` `body` field so `throw new HttpError(409,
  'conflict', { code })` renders a structured payload. Default behavior is
  unchanged when no hook is set.

- **OpenAPI 3.1** — `app.openapi(info?)` projects the route graph into a
  structural spec (paths, methods, path/query/header params, request-body
  presence, systematic error responses); opt-in `GET /__openapi__` via
  `devOpenapi`. Body/response schemas stay generic (Standard Schema exposes
  no JSON Schema) — the full `@Produce` mode is post-beta.

Docs: new error-handling and OpenAPI guides, plus reference updates.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-08 08:29:17 -05:00
chrnx d6c5cee0ee feat: beta-hardening — routing, degradation, mesh gate, uploads, @header
Restructure first: split the two oversized files by cohesion (http.ts 449
→ http/{router,request,stream,ws,server,types}; app.ts 556 → app/{types,
introspect,index}), rename cryptic locals, JSDoc the public API, and
extract helpers so no function exceeds the complexity gate (createApp
187 → <15, listen 113 → 6). Public import paths are unchanged (barrels).

On that structure, five features that close the biggest gaps vs
Express/Fastify/Nest for a comparable beta:

- routing: `:name*` catch-all, specificity precedence (static ▸ param ▸
  catch-all, not registration order), and 405 + Allow when a path exists
  under a different method (was 404)
- visible degradation: optional providers that fail boot are summarized on
  listen() and queryable via app.degraded(), instead of a silent warn
- mesh is alpha — gated behind `experimental: true`; createApp throws if
  `mesh` is configured without it
- multipart moves to the optional `busboy` peer dependency (clear 501 when
  absent), keeping the core at one runtime dependency
- `@header('name')` as a singular alias of `@headers`

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-07-07 12:00:15 -05:00
chrnx 6171e5e6bd feat: rooms broadcast-hub primitive, auto-provided to handlers
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-28 13:23:54 -05:00
chrnx 9d8088d0a9 feat: 'did you mean' boot hint, flow compile-time type-test, and demos
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-28 02:36:37 -05:00
chrnx cc0044ba6a feat: createApp overrides — swap any provider/step by token in one line
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-28 02:33:52 -05:00
chrnx 73cd874cae feat: opt-in GET /__graph__ dev endpoint rendering the live graph
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-28 02:31:52 -05:00
chrnx f5136e35d0 feat: app.graph/explain/toMermaid/toDOT — inspect the dependency graph
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-28 02:30:22 -05:00
chrnx a25c9752a2 fix: always-run observer steps receive their declared needs under slicing
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-28 01:14:20 -05:00
chrnx df01bbfc41 feat: per-route subgraph slicing — routes run only their needed providers/steps
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-28 01:09:47 -05:00
chrnx 68caca2cc1 feat: graceful shutdown via app.close() force-closing streams and connections
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-28 01:07:42 -05:00
chrnx 04688ab621 feat: wire SSE/WS routes through the graph with stream lifecycle events
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-06-27 15:32:17 -05:00
chrnx ccaacb9a02 fix: stream errors -> 500, guard non-object body picks, test @query e2e 2026-06-26 01:51:02 -05:00
chrnx 7114bf685e feat: handlers declare deps via arg decorators, graph-validated at boot 2026-06-26 01:44:57 -05:00
chrnx 97faff4c06 fix: guard handler errors, dedupe runner names, export flow core, test optional provider 2026-06-26 01:11:26 -05:00
chrnx 62eb6587ea feat: boot orchestrator, app, inspect, fail-fast providers
Wires all modules together into createApp(): topo-ordered providers run
at boot (fail-fast for required), pipeline runs per request, inspect()
returns the ordered chain, plugins observe via Bus without mutating state.
2026-06-26 00:55:02 -05:00