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.
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 develop2026-09-19 17:34:36 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Three things Diego flagged reading the published docs.
1. The root README still advertised one package, three releases in.
rate-limitandmetricsadded 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
@Stepthat providesuser, so the handler asks foruserand never forjwt, 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:
subgraphForbuilds each route's closure backwards from the handler'sneeds, 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 teststill 60/60.Separately, and not in this PR: the jwt README's note that you must
await app.boot()beforeDeno.serve/Bun.servedescribes a real gap in core, not a thing to document better.listen()awaitsbootApp()itself (src/app/index.ts:328);serveDenoandserveBundo 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.