The 26.9.0-beta.1 post, and a way in for Deno readers #14
No files matched your search
@@ -1,133 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Green Tea 26.8.0-beta.1: you can see what it's doing"
|
|
||||||
description: "A correlated event stream and an injectable logger, shutdown as an extension point instead of a SIGTERM handler you write yourself, and one routing behaviour change that ends a difference between runtimes."
|
|
||||||
pubDate: 2026-08-19
|
|
||||||
author: "Diego Reséndez"
|
|
||||||
tags: ["green-tea", "release", "observability", "shutdown"]
|
|
||||||
draft: true
|
|
||||||
---
|
|
||||||
|
|
||||||
The last release made the router stop guessing. This one makes the framework stop being quiet.
|
|
||||||
|
|
||||||
Green Tea `26.8.0-beta.1` closes the gap a team hits in week one of a real evaluation: until now you could run an
|
|
||||||
application on this framework and have no idea what it was doing. That was written down as a known gap. It isn't one
|
|
||||||
any more.
|
|
||||||
|
|
||||||
## Every request has an identity, and every event carries it
|
|
||||||
|
|
||||||
Core emits a correlated lifecycle event stream. Each request gets an id — if a gateway already sent an
|
|
||||||
`x-request-id`, that one is adopted rather than replaced — and every event of that request carries it, alongside the
|
|
||||||
matched route **pattern** rather than the concrete URL, so `/users/:id` aggregates instead of exploding into a
|
|
||||||
million distinct strings. Each step reports its own duration.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const app = createApp({ modules: [AppModule], logger: myLogger, logRequests: true });
|
|
||||||
```
|
|
||||||
|
|
||||||
The logger is any object with `debug`, `info`, `warn` and `error`. Given none, the default writes JSON, or a
|
|
||||||
readable line when it is attached to a TTY. **Nothing in core writes to `console`** — that is enforced by a lint rule
|
|
||||||
over the whole source tree, not by intention — so every diagnostic the framework produces is something your
|
|
||||||
application can redirect.
|
|
||||||
|
|
||||||
What is deliberately *not* here: no metrics registry, no OpenTelemetry exporter. Core keeps one runtime dependency,
|
|
||||||
and an exporter is a package, not a framework feature. A `traceparent` header is carried through untouched for one
|
|
||||||
to read. Green Tea ships an observability contract, not an observability integration.
|
|
||||||
|
|
||||||
The cost was measured rather than assumed: about 7% of the framework's own per-request work, which is roughly 2%
|
|
||||||
once a real socket is involved.
|
|
||||||
|
|
||||||
## Shutdown is somewhere you can hook into
|
|
||||||
|
|
||||||
Closing what your application opened no longer means writing `process.on('SIGTERM', …)` yourself.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
@Provider({ provides: 'db' })
|
|
||||||
class Db {
|
|
||||||
provide() { return { db: this.#pool }; }
|
|
||||||
async dispose() { await this.#pool.end(); }
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
A provider that opened a pool closes it in `dispose()`. A plugin registers `onShutdown`. An application that wants
|
|
||||||
neither passes `createApp({ hooks })`. All three land in one registry, all three are **awaited** — unlike a bus
|
|
||||||
listener, which is fire-and-forget — and they run in reverse boot order, so a `cache` that needs `db` closes before
|
|
||||||
the `db` does. A failure is logged and the rest still run, because one broken teardown must not leave a process up.
|
|
||||||
|
|
||||||
It happens inside `close()`'s deadline, so a slow teardown cannot hold a deploy open, and
|
|
||||||
`createApp({ teardownTimeoutMs })` reserves part of that budget when a connection has to get its chance. On the edge
|
|
||||||
none of it applies — workerd has no shutdown to hook, and saying so is better than pretending otherwise.
|
|
||||||
|
|
||||||
## One behaviour change worth reading before you upgrade
|
|
||||||
|
|
||||||
**`.` and `..` in a request path now resolve instead of returning 404.** `GET /public/../admin` reaches a route
|
|
||||||
declared as `/admin`, and `%2e` counts as a dot.
|
|
||||||
|
|
||||||
This changes Node only, and it exists to end a difference rather than to be lenient. Deno, Bun and Workers resolve
|
|
||||||
dot segments inside the `Request` constructor, before the framework sees anything — so the same bytes on the wire
|
|
||||||
were already reaching different routes depending on where you deployed. Rejecting instead was not implementable on
|
|
||||||
three of the four runtimes, so Node converged on resolving.
|
|
||||||
|
|
||||||
If a proxy or WAF in front of your application matches on the literal path, it now sees something different from
|
|
||||||
what the application routes. That is worth ten minutes of your attention before you deploy this.
|
|
||||||
|
|
||||||
## Smaller things you may have been waiting for
|
|
||||||
|
|
||||||
- **`createApp({ shutdownTimeoutMs })`** sets the shutdown deadline app-wide, for when `close()` is reached from a
|
|
||||||
signal handler you do not own.
|
|
||||||
- **`limits.maxConnections`** caps concurrent sockets on Node, which was previously unbounded. Non-positive values
|
|
||||||
leave it unlimited.
|
|
||||||
- **A bounded `close()` on the Deno and Bun adapters.** One difference the deadline cannot hide: Node and Bun force
|
|
||||||
the remainder shut, Deno cannot — there the deadline bounds how long `close()` waits, not when connections die.
|
|
||||||
- **The documentation moved to its own repository**, so a docs fix no longer waits on a framework release.
|
|
||||||
|
|
||||||
## Mesh got a hard look, and stays alpha
|
|
||||||
|
|
||||||
Mesh — resolving a dependency that physically lives on another node — is the part of green-tea
|
|
||||||
nothing else has. It is also the part nobody has run in anger, so this release went looking for what
|
|
||||||
that meant in practice. It found plenty.
|
|
||||||
|
|
||||||
**A dropped link never came back.** There was no reconnection at all: once a teapot went away, that
|
|
||||||
link was dead for the life of the process, so deploying a teapot forced a restart of every teacup
|
|
||||||
depending on it and boot order became load-bearing. Links now reconnect with backoff, and a teapot
|
|
||||||
that returns exporting *less* than the graph was validated against is refused rather than adopted —
|
|
||||||
serving against a manifest that no longer backs your graph produces a 500 that looks like your code.
|
|
||||||
|
|
||||||
**A request lost its identity at the process boundary.** The observability work above gives every
|
|
||||||
request an id; the moment it crossed to another node, the far side opened a new one. It now carries
|
|
||||||
across, and the teapot adopts it, so one request that spans two machines is one trace.
|
|
||||||
|
|
||||||
**Exporting a database connection answered `200` with `{}`.** The wire is JSON, so a value with
|
|
||||||
methods lost everything but its shape, arrived truthy and empty, and failed as
|
|
||||||
`db.query is not a function` somewhere else entirely. A teapot now refuses to send one, naming what
|
|
||||||
sat where. The rule this makes explicit was never written down: **a mesh export carries data, never
|
|
||||||
behaviour** — export what a handle produces, not the handle.
|
|
||||||
|
|
||||||
Also: the boot now waits out a teapot that is merely slow to start, and the control channel bounds
|
|
||||||
what an unauthenticated peer can do — it had neither a handshake deadline nor a limit on the size of
|
|
||||||
a frame it would parse.
|
|
||||||
|
|
||||||
**None of that moves mesh out of alpha, and finding it is the reason.** The label is not a statement
|
|
||||||
about the code — the protocol is versioned, the secret is compared in constant time, ambiguous routes
|
|
||||||
fail the boot. It is a statement about how much we know, and what a day of looking added to that was
|
|
||||||
mostly *here is another thing distributed systems do*. It stays behind `experimental: true` until
|
|
||||||
somebody runs it with two real services and tells us what broke.
|
|
||||||
|
|
||||||
## Thank you
|
|
||||||
|
|
||||||
Two people shipped code in this release.
|
|
||||||
|
|
||||||
**[@YxnnXriel](https://github.com/YxnnXriel)** contributed the timeout on `app.close()`. Every shutdown deadline
|
|
||||||
above is built on it — the app-wide option, the bounded adapters, the teardown budget. Before it, one stuck handler
|
|
||||||
could hold a deploy open indefinitely.
|
|
||||||
|
|
||||||
**[@hgshreyas](https://github.com/hgshreyas)** contributed the concurrent connection limit. Node's socket count was
|
|
||||||
unbounded, which meant the framework had no answer at all to load it could not serve.
|
|
||||||
|
|
||||||
There is more on this in a longer post, because "thanks to our contributors" is worth nothing next to a sentence
|
|
||||||
someone can point at.
|
|
||||||
|
|
||||||
## Still beta
|
|
||||||
|
|
||||||
The API can still change before stable, mesh is still alpha, and the plugin ecosystem is still one person. The
|
|
||||||
freeze belongs to the release candidate — and freezing the API before observability landed would have frozen a
|
|
||||||
framework still missing its contract.
|
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
---
|
||||||
|
title: "The release where I found out what I had shipped"
|
||||||
|
description: "A second registry I announced that did not work, three ways your own code could take the process down, and the two improvements my benchmark was too small to see."
|
||||||
|
pubDate: 2026-09-04
|
||||||
|
author: "Diego Reséndez"
|
||||||
|
tags: ["green-tea", "release", "performance", "reliability"]
|
||||||
|
draft: false
|
||||||
|
---
|
||||||
|
|
||||||
|
The last release gave green-tea a way to say what it was doing. This one is mostly about what I saw once it could.
|
||||||
|
|
||||||
|
`26.9.0-beta.1` is out on npm and JSR. It has one contributed feature, a handful of things you may have been
|
||||||
|
waiting for, and four corrections that exist because looking properly turned up problems that announcing loudly had
|
||||||
|
not.
|
||||||
|
|
||||||
|
## The second registry I announced did not work
|
||||||
|
|
||||||
|
In August I wrote that green-tea now publishes to JSR as well as npm. That was true. What I did not check is
|
||||||
|
whether anyone could use it.
|
||||||
|
|
||||||
|
JSR serves `src/` rather than the tsup build. My ESM build had extensionless relative imports — fine for a bundler,
|
||||||
|
fine for Node's resolution of a built package, and not something Deno will resolve. So `jsr:@green-tea/core`
|
||||||
|
installed and then failed on the first import. The npm package was fine the whole time, which is exactly why I did
|
||||||
|
not notice: every test I ran, and every runtime suite in CI, went through the built artifact.
|
||||||
|
|
||||||
|
It works now, and what actually fixed it was not the import rewrite. It was adding `deno publish --dry-run` to the
|
||||||
|
release workflow, before the npm publish, so JSR's checks — slow types, module analysis, things npm never looks at —
|
||||||
|
run while there is still something to do about them. Learning about them after npm has published leaves a version
|
||||||
|
half-shipped, and JSR versions are permanent.
|
||||||
|
|
||||||
|
I would rather tell you the registry was broken for two weeks than have you discover it in an evaluation.
|
||||||
|
|
||||||
|
## Three ways your own code could take the process down
|
||||||
|
|
||||||
|
The lifecycle stream from the last release is what made these findable. All three are the same shape: green-tea
|
||||||
|
called something you gave it, and did not consider that it might throw.
|
||||||
|
|
||||||
|
A `cors.origins` predicate runs per request. If yours threw — a malformed header, a regex on a value you did not
|
||||||
|
expect — the exception escaped into the request pipeline and the process went with it. A custom `onError` had the
|
||||||
|
same problem, and worse timing: the handler you wrote to keep a bad request from becoming an outage was itself an
|
||||||
|
outage. It now falls back to the built-in renderer and reports the failure, rather than losing the response.
|
||||||
|
|
||||||
|
The third is Node's connection cap. Reaching `maxConnections` destroyed the socket with no HTTP response and said
|
||||||
|
nothing at all, which from the client's side is indistinguishable from a network fault. It logs a warning naming
|
||||||
|
the dropped peer now, rate-limited to one a minute.
|
||||||
|
|
||||||
|
None of these were reported. They came from reading the code with a specific question, which is the same way the
|
||||||
|
mesh defects turned up in August. I am starting to think that is the only way I find anything.
|
||||||
|
|
||||||
|
## Your app boots in its longest chain, not the sum of it
|
||||||
|
|
||||||
|
Boot walked the topological order one provider at a time. Three providers that need nothing from each other, 200 ms
|
||||||
|
of work each, took **616 ms** — the sum. They now boot concurrently and take **210 ms**, which is the longest one
|
||||||
|
plus overhead.
|
||||||
|
|
||||||
|
The framework already computed the dependency graph. Booting the independent nodes together was not a new idea so
|
||||||
|
much as noticing that the information had been sitting there since the beginning. That is the second release in a
|
||||||
|
row where the fix was using something the graph already knew, and I do not think that is a coincidence: I keep
|
||||||
|
building the structure and then forgetting to ask what else it can answer.
|
||||||
|
|
||||||
|
The saving scales with how wide your graph is, so a small application will see very little, and an application with
|
||||||
|
a dozen independent providers will see most of its boot time disappear.
|
||||||
|
|
||||||
|
## The two improvements my benchmark was too small to see
|
||||||
|
|
||||||
|
Route matching is a linear scan. I have said so in the README for months, and three separate attempts to improve it
|
||||||
|
measured as *nothing*.
|
||||||
|
|
||||||
|
They measured as nothing because the benchmark used **six routes**. Every matcher cost scales with how many
|
||||||
|
candidates a request walks past, and at six there is nothing to walk past. Specificity ranking, a per-candidate
|
||||||
|
`decodeURIComponent`, settling the ranking at build time — all three were real, and all three sat below the
|
||||||
|
resolution of the instrument I was using to judge them.
|
||||||
|
|
||||||
|
`npm run bench:compare` now carries 50- and 200-route cases. The same change that measured as noise measures as
|
||||||
|
this:
|
||||||
|
|
||||||
|
| route table | Δ |
|
||||||
|
|---|---|
|
||||||
|
| 6 routes | nothing — every row overlaps |
|
||||||
|
| 50 routes | +3.3%, +3.5% across two runs |
|
||||||
|
| 200 routes | **+14.9%, +12.0%** — twelve rounds, not one crossing sample |
|
||||||
|
|
||||||
|
Route ranking is now settled when the route table is built rather than recomputed per request, and security and
|
||||||
|
CORS headers are computed once instead of twice. Neither is visible on a six-route table either.
|
||||||
|
|
||||||
|
The lesson I actually take from this is not about the router. It is that I spent months believing an optimisation
|
||||||
|
did not matter because I could not measure it, when what I could not measure was my own test.
|
||||||
|
|
||||||
|
## A budget, not a cap
|
||||||
|
|
||||||
|
`createApp({ limits: { maxConcurrentRequests } })` bounds how many handlers run at once, per server and per Fetch
|
||||||
|
adapter. Over the budget a request gets `503` with `Retry-After: 1` rather than queueing behind whatever is already
|
||||||
|
running.
|
||||||
|
|
||||||
|
It counts *executing handlers*, not open connections — so a long-lived SSE stream or a WebSocket upgrade does not
|
||||||
|
hold a slot for its lifetime, and on Node a client disconnect releases one early. A handler that never returns keeps
|
||||||
|
its slot forever, which is the honest behaviour for a budget of this shape rather than a bug I am hiding in a
|
||||||
|
paragraph.
|
||||||
|
|
||||||
|
This one is not mine. [@hgshreyas](https://github.com/hgshreyas) wrote it, across two issues and two pull requests,
|
||||||
|
on a project with no stars and no promise that anyone would review it. The second most useful thing in this release
|
||||||
|
was written by someone who did not have to.
|
||||||
|
|
||||||
|
## Smaller things you may have been waiting for
|
||||||
|
|
||||||
|
`createApp({ handleSignals: true })` registers `SIGINT` and `SIGTERM` to close and exit. Off by default, and that is
|
||||||
|
the design rather than caution — a library that installs process-wide handlers without being asked is a library
|
||||||
|
that fights your process manager.
|
||||||
|
|
||||||
|
`@Sse` can emit an `id:`, so an `EventSource` reconnect has a `Last-Event-ID` to resume from. Without it every
|
||||||
|
automatic reconnect rebuilt the stream from the start and lost the gap silently, which removes most of the reason to
|
||||||
|
choose SSE over a raw WebSocket.
|
||||||
|
|
||||||
|
The extension-point *types* are exported now, not just the extension points. `TransformerFn` could not be imported,
|
||||||
|
so a custom transformer had its shape redeclared inline or borrowed off a value with `typeof`. Checking the barrel
|
||||||
|
for the same oversight found four more: `PluginApi`, `ScopeApi`, `ScopeNode`, `Hooks` and `TeardownFn`.
|
||||||
|
|
||||||
|
And every `request:end` is now preceded by a `request:start` carrying the same `requestId`, which is what makes the
|
||||||
|
stream something you can build a collector on rather than something you can only log.
|
||||||
|
|
||||||
|
## Where this leaves the beta
|
||||||
|
|
||||||
|
The graph is settled. `createApp`'s options and the plugin API still move — and the plugin API is where I am going
|
||||||
|
next, because it is public, documented, and has exactly zero plugins written against it. Mesh is still alpha and
|
||||||
|
still frozen.
|
||||||
|
|
||||||
|
I am not freezing the API in a release whose main lesson was that I could not see what I had shipped.
|
||||||
|
|
||||||
|
## Try it
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install @green-tea/core@beta reflect-metadata
|
||||||
|
```
|
||||||
|
|
||||||
|
Everything above, as a list rather than a story, is on the
|
||||||
|
[`26.9.0-beta.1` release](https://github.com/Expressive-Tea/green-tea/releases/tag/v26.9.0-beta.1).
|
||||||
|
|
||||||
|
That's the tea. 🍵
|
||||||
Reference in new issue
Block a user