docs: list every package, and show the graph doing the work #4

Merged
chrnx merged 1 commits from docs/steps-and-index into develop 2026-09-19 17:34:36 +00:00
Owner

Three things Diego flagged reading the published docs.

1. The root README still advertised one package, three releases in. rate-limit and metrics added to the table.

2. jwt and rate-limit demonstrated themselves from inside a handler, which reads as a middleware chain with extra steps.

For jwt the split is real: signing belongs in the handler — it is the response to that one request — but verifying is a precondition shared by every protected route, and its result is what those routes are actually asking for. Now shown as a @Step that provides user, so the handler asks for user and never for jwt, and green-tea runs the step only for the routes that name it.

rate-limit gets the same treatment, plus the constraint that makes it work at all:

The step has to provide something the handler asks for.

subgraphFor builds each route's closure backwards from the handler's needs, so a step providing a token nobody names is not in the closure and never runs — the limit would silently not apply. That is the worst way for a rate limiter to fail, and it is not obvious from the outside, so the README says it rather than leaving it to be discovered. A second example folds the limit into a step that already provides something real, which is the better shape when a route has one. The inline call is kept as the smaller option, with what it costs stated.

3. metrics is left alone. Rendering a scrape really is a route's job — the path, the auth and whether the endpoint exists at all are the application's decisions.

No code changed; npm test still 60/60.


Separately, and not in this PR: the jwt README's note that you must await app.boot() before Deno.serve / Bun.serve describes a real gap in core, not a thing to document better. listen() awaits bootApp() itself (src/app/index.ts:328); serveDeno and serveBun do not, so a bad key becomes a 500 on every request instead of a startup failure. Those are core's own helpers, so they should boot too. Tracking that separately.

Three things Diego flagged reading the published docs. **1. The root README still advertised one package**, three releases in. `rate-limit` and `metrics` added to the table. **2. jwt and rate-limit demonstrated themselves from inside a handler**, which reads as a middleware chain with extra steps. For jwt the split is real: **signing** belongs in the handler — it is the response to that one request — but **verifying** is a precondition shared by every protected route, and its result is what those routes are actually asking for. Now shown as a `@Step` that provides `user`, so the handler asks for `user` and never for `jwt`, and green-tea runs the step only for the routes that name it. rate-limit gets the same treatment, plus the constraint that makes it work at all: > The step has to provide something the handler asks for. `subgraphFor` builds each route's closure backwards from the handler's `needs`, so a step providing a token nobody names is not in the closure and **never runs** — the limit would silently not apply. That is the worst way for a rate limiter to fail, and it is not obvious from the outside, so the README says it rather than leaving it to be discovered. A second example folds the limit into a step that already provides something real, which is the better shape when a route has one. The inline call is kept as the smaller option, with what it costs stated. **3. metrics is left alone.** Rendering a scrape really is a route's job — the path, the auth and whether the endpoint exists at all are the application's decisions. No code changed; `npm test` still 60/60. --- Separately, and **not** in this PR: the jwt README's note that you must `await app.boot()` before `Deno.serve` / `Bun.serve` describes a real gap in core, not a thing to document better. `listen()` awaits `bootApp()` itself (`src/app/index.ts:328`); `serveDeno` and `serveBun` do not, so a bad key becomes a 500 on every request instead of a startup failure. Those are core's own helpers, so they should boot too. Tracking that separately.
chrnx added 1 commit 2026-09-19 17:24:38 +00:00
docs: list every package, and show the graph doing the work
CI / dco (pull_request) Successful in 3s
CI / runtimes (bun) (pull_request) Successful in 10s
CI / build (pull_request) Successful in 18s
CI / runtimes (deno) (pull_request) Successful in 11s
CI / runtimes (edge) (pull_request) Successful in 10s
772f4d11a9
The root README still advertised one package, three releases in.

jwt and rate-limit both demonstrated themselves from inside a handler, which
reads as a middleware chain with extra steps. Signing does belong there — it is
the response to that one request — but verifying is a precondition shared by
every protected route, and its result is what those routes are actually asking
for. Shown as a `@Step` that provides `user`, so the handler asks for `user` and
never for `jwt`.

rate-limit gains the same treatment plus the constraint that makes it work:
the step must provide a token the handler names. `subgraphFor` builds each
route's closure backwards from the handler's `needs`, so a step providing
something nobody asks for is not in the closure and never runs — the limit
would silently not apply, which is the worst way for a rate limiter to fail.
The inline call is kept as the smaller option, with what it costs.

metrics is left alone: rendering a scrape really is a route's job.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx merged commit 3e8707034c into develop 2026-09-19 17:34:36 +00:00
Sign in to join this conversation.