Keep develop free to accept concurrent changes while Verdaccio validates an immutable release candidate. Audit dependencies and reject stable versions before publishing.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
A beta/alpha/rc version must not become 'latest' on npmjs (else npm install serves a prerelease). Derive the dist-tag from the version: 26.7.0-beta.0 -> beta, stable -> latest.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Replaces the NPM_AUTH secret on the prod path with npm Trusted Publishing: id-token: write + npm>=11.5.1, npm exchanges the OIDC token for a short-lived publish token and attaches provenance. Requires a trusted publisher configured on npmjs (Expressive-Tea/green-tea, release.yml).
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The staging registry (npm.svc.zoit.services) does not allow overwriting an existing version, so re-publishing the same prerelease on each main merge failed. Unpublish the version first (tolerant --force, no-op when absent) then publish fresh.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
One secret name across forges: Gitea's NPM_AUTH (org-level) = the Verdaccio token for staging; GitHub's NPM_AUTH = the npmjs token for production. Each forge supplies its own value.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
stage.yml (Gitea-only): publish package to Verdaccio under 'stg' tag on main merge. promote.yml (Gitea-only): mirror only main + version tags to GitHub. release.yml (GitHub-only): publish stable to npmjs on a v* tag. Forge is detected via github.server_url; secrets: VERDACCIO_TOKEN (Gitea), GH_PROMOTE_TOKEN (Gitea, set), NPM_TOKEN (GitHub, pending).
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
GitHub Actions only reads .github/workflows; Gitea reads both. Relocating (content unchanged) makes the one gate portable across both forges — the foundation for the Gitea(stg)+GitHub(prod) pipeline.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Fastify and the Nest adapters bound 127.0.0.1, unreachable from a separate load generator; bind 0.0.0.0 so two-machine benchmarks work.
Adds scale-{green-tea,express} (step-vs-middleware depth sweeps that surfaced the O(n^2)) and green-tea-{bun,deno} (the same app served via serveBun/serveDeno, to benchmark across runtimes).
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
A route whose need-closure resolves to more than 20 steps is almost always a modeling smell -- a step doing too much, or work that belongs in a provider. Per-request cost is linear, so this is a design nudge, not a perf guard (and a warning, not an error).
Tunable and silenceable via createApp({ warnGraphDepth }): a number sets the threshold, false quiets it. Default 20.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
runSteps rebuilt the whole request context every step with { ...context, ...output }, so an N-step route paid 1+2+...+N = O(N^2) property copies plus N throwaway objects. At 100 chained steps that measured ~250us/req vs ~100us after the fix (2.5x throughput); per-step cost drops from superlinear to a flat ~0.5us/step.
Mutate one accumulator in place with Object.assign -- O(N). The returned context is now the same object every step observes. Adds a regression guard that fails if a per-step copy is reintroduced; full suite green (322 tests).
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The parity suite compares Node's listener against app.fetch inside Node
('Node is truth') — it does not exercise all four runtimes. Saying 'every
runtime ... enforced by a parity test suite' overstates it; the honest
version is that the others share the same app.fetch/app.upgrade core and
each has its own smoke tests. Also fixed the line crediting Node's
WebSocket support to serveDeno/serveBun — Node does it through listen().
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The site hangs off the expressive-tea.io cPanel as green-tea.expressive-tea.io.
A four-level docs.green-tea.expressive-tea.io subdomain reads badly and would
need its own AutoSSL cert (the *.expressive-tea.io wildcard stops one level
up). A /docs subfolder needs no extra host, DNS, or cert — it's a path — and
is what most projects do.
So the docs site now builds with base: '/docs' (its dist/ contents drop into
the subdomain's docs/ folder in cPanel), the 77 hard-coded content links are
prefixed, and the two hero actions Starlight doesn't rewrite are fixed by
hand. Verified: /docs/ serves, / 404s, no unprefixed internal href remains.
README points at the new docs URL.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The streaming guide argued with itself: the table said a plain return
streams by Accept while the section below it, added with the
explicit-transport change, said that same return is a 500. The prose got
swept, the table didn't.
Getting started said green-tea targets Node — true when written, wrong
since the Deno/Bun/edge adapters landed — and led with a manual install
even though matcha scaffolds a live app in two commands. matcha had no
page at all, so the CLI was invisible to anyone reading the docs.
site: pointed at green-tea.dev, which is the marketing site's domain; the
docs deploy to docs.green-tea.dev.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The README claimed green-tea was Node-only with Deno/Bun/edge "on the
roadmap, not built" — all four have shipped. It also taught that a plain
return of an AsyncIterable streams by Accept, which the explicit-transport
change turned into a 500 TransportMismatchError: the one thing a README
must never do is document behavior that now throws.
docs/ had been frozen since the Starlight site replaced it; nothing but
the README referenced those two files, so they were a second copy to keep
in sync and had already drifted. Point at the site instead.
Also adds what shipped unmentioned (@Html/views/static, the four runtimes,
matcha) and fixes the CHANGELOG's YY.MM.PATCH, which contradicted the
README's correct explanation of why the month is not zero-padded.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Link health for mesh: say what is actually wrong, and notice it without waiting
for a user to find out.
Writing the tests for the status codes turned up three bugs. A teapot with a live
control channel could never shut down — control connections were the one kind of
long-lived socket nobody registered for force-close, so server.close() waited on
a teacup that had no reason to hang up. A downed teapot answered 500 after a full
30s timeout, having queued the frame on a closed socket to wait out a verdict
already known; it now answers 503 at once, and a live-but-slow teapot answers 504.
And the heartbeat's first close code, 1011, silently did nothing: a client may
only send 1000 or 3000-4999, so it threw `invalid code` into a catch that swallows
throws, leaving the link open while looking closed.
Ping/pong are mesh frames, not WebSocket protocol pings, because Deno's and Bun's
platform WebSocket does not expose ws.ping(). They land in v1 while the wire has
no deployed peers to break.
Reconnect, and reconciling app-scope values that outlive their teapot from cache,
stay out — post-beta, on their own spec.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Three bugs, found by writing the tests for the status codes.
A teapot with a live control channel could never shut down. Control connections
were never registered with the stream registry, so server.close() sat waiting on
a connected teacup that had no reason to hang up, and app.close() never resolved.
Every other long-lived socket was already tracked; the control channel was the
one that skipped it.
A downed teapot answered 500 — after 30 seconds. sendRpc queued the frame on a
closed socket and waited out the full timeout for a verdict already known. It now
rejects immediately with 503: a dead upstream is not "this service broke", and the
status is what tells a caller it may retry and an operator where to look. An RPC
that times out on a *live* link is 504 — a slow teapot and a gone one are
different stories.
Heartbeat: each teacup pings its teapots (`mesh.heartbeatMs`, default 15s) and
closes a link after two unanswered rounds. This is what catches a half-open
connection, where the socket looks open with nobody home — otherwise a teacup only
learns on the next request. Ping/pong are mesh frames rather than WebSocket
protocol pings because Deno's and Bun's platform WebSocket does not expose
ws.ping(), so a protocol-level heartbeat could not work everywhere mesh runs.
Added to v1 while the wire still has no deployed peers; later it would be a
version bump that refuses every old peer.
The heartbeat's first close code was 1011, which silently did nothing: a *client*
may only send 1000 or 3000-4999, so it threw `invalid code` — and our neutral
close swallows throws, so the link stayed open while looking closed. 4011 mirrors
1011's meaning inside the application range.
Reconnect (and reconciling app-scope values, which survive their teapot from
cache) stays out — it is a post-beta spec of its own.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
A SOLID audit that turned into making mesh work off Node.
The audit found the repo already sound on DIP/ISP, and most candidate findings
did not survive verification. Five real ones did, and fixing the observability
gap exposed the rest: steps were run by three hand-rolled loops, only one of
which emitted request:step:enter/leave, so a logging plugin silently saw nothing
on @Ws routes.
Pulling that thread reached mesh, which was Node-only by construction rather
than by decision: only listen() finalized a mesh graph, and listen() builds a
Node http.Server, so app.fetch — the entry Deno/Bun/edge use — threw forever and
told operators to call something they could not call. Mesh now runs on Node, Deno
and Bun, teapot and teacup, in any combination, proven by cross-process interop
tests rather than reasoned about.
Wire protocol is versioned before it has peers to break; duplicate exported
routes fail the boot rather than silently shadowing, since there is no load
balancing to fall back on; local-over-remote precedence now warns instead of
being an accident of merge order; app.ready() resolves the graph without booting
providers, so one protocol works against mesh and non-mesh apps alike.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
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>
Local routes are merged ahead of remote ones, so a local twin wins. That
precedence is worth keeping — your own code beating an imported one is how you
override a teapot — but it was an accident of [...local, ...remote] ordering with
nothing said, so a shadowed export looked like a broken teapot from the outside.
Warn, name the teapot, and leave the call to the developer.
The docs had gone stale in the way that started all of this. runtimes.md claimed
four times that mesh is Node-only; the mesh guide said finalization is deferred to
listen(); the changelog said "WebSocket and mesh remain Node-only". All false now.
The mesh guide gains what was enforced but never written down — which is how the
listen() trap got made in the first place, when the previous plan's "document it"
never landed:
- runs on Node/Deno/Bun, teapot and teacup, any combination; not on edge, and why
- no listen() required: the graph boots on first use
- buffered routes only, and why streams cannot cross an RPC hop
- one teapot per route, local-over-remote precedence, and the protocol version
Refs .specs/2026-07-15-green-tea-mesh-cross-runtime-plan.md Task 9
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Duplicate scope tokens already threw in setRunner, but duplicate routes did not:
both were pushed into remoteRoutes, and matchRoute keeps the first of two
identical patterns (moreSpecific returns 0, not > 0). The second teapot's route
was silently dead. Same collision, two behaviours — one loud, one mute.
Fail the boot instead, naming the route and both teapots, since which pair
clashed is the thing an operator needs. The message says load balancing is not
implemented *yet*: it is a not-yet, not an impossibility.
Throwing now also keeps the door open. "First teapot wins" is a semantic callers
could come to rely on, so shipping it would make balancing a breaking change
later. An error cannot be relied on — turning it into a strategy stays additive.
Scopes keep failing rather than balancing, and should: an app-scope provider is
memoised, so "balancing" a cached value means nothing.
Refs .specs/2026-07-15-green-tea-mesh-cross-runtime-plan.md
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Every mesh test ran on Node and drove listen(); nothing off Node was covered, so
the cross-runtime work was implemented but not demonstrated. vitest excludes
test/{deno,bun,edge}, so `npm test` would not have noticed either way.
Adds, in the real runtimes:
- Deno and Bun, teapot and teacup, served through serveDeno/serveBun. Bun is not a
duplicate of Deno: its socket events land on a server-level handler, so the
control channel reaches app.upgrade by a different path.
- The interop matrix, in separate processes: a Deno teacup consuming a Node teapot
and a Node teacup consuming a Deno teapot. Each asserts the `runtime` field the
*other* process produces, so a peer answering from the wrong side fails the test.
Node serves and connects with the `ws` package; Deno uses its global WebSocket —
same-runtime tests could never have exercised that pairing.
- A hand-rolled v999 peer, refused across the boundary with both versions named.
Verified these tests fail for the right reason: breaking the control-channel
routing in app.upgrade fails the Node-teacup-consumes-Deno-teapot case and only
that case.
test:deno needs --allow-run/--allow-env to spawn the Node peer. The peer lives in
test/interop rather than test/deno because tsconfig excludes test/deno, so tsx
would not apply experimentalDecorators there; vitest ignores it as a non-.test.ts.
Refs .specs/2026-07-15-green-tea-mesh-cross-runtime-plan.md Task 8
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Two halves of the same "mesh off Node" gap; they touch the same file and landed
together.
Control channel (Task 6): meshControl existed only inside listen(), passed to
createHttpServer, so a teapot could only export its scopes from Node. app.upgrade
— the path serveDeno/serveBun drive — had never heard of it, which would have left
"mesh on three runtimes" meaning consume-only. It is now built in the boot gate
(it captures the finalized ordered nodes, so it cannot exist before finalize) and
the reserved path is routed from app.upgrade. Task 3 already made handle() take a
neutral WsSocket and upgrade holds one, so this is a direct call, not a second
implementation. handle() returns the connection's lifetime like runWsConnection,
so upgrade awaits it instead of returning while the peer is still talking. An app
with nothing exported refuses the reserved path explicitly rather than falling
through to "no matching ws route".
Link lifecycle (Task 7): links were reaped by server.on('close'), reachable only
through listen(), so a mesh app booted through app.fetch had links and no server
and leaked every teapot connection at `if (!server) return`. close() now closes
them first either way; that aborts each socket, which rejects its in-flight RPCs.
Also fixes a race the new tests exposed: upgrade awaited the boot *before* handing
the socket to a consumer, but `channel` is fan-out, so frames arriving during the
boot were dropped with no subscriber attached. For the control channel that is
`hello` itself — against a teapot with slow providers the handshake would hang
until timeout. Inbound is now subscribed synchronously on entry and the buffered
iterator handed down, closing the same gap for regular @Ws routes.
Refs .specs/2026-07-15-green-tea-mesh-cross-runtime-plan.md Tasks 6, 7
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Only listen() spliced remote scopes and finalized the graph, and listen() builds
a Node http.Server. Deno/Bun/edge serve through app.fetch and can never call it,
so mesh was Node-only by construction: fetch() threw "unavailable before
listen()" forever on those runtimes, telling operators to call something they
had no way to call. buildAppFetch also hardcoded remoteRoutes to [], so even past
the guard it would not have served a remote route.
Move splice+finalize into the memoized boot gate that fetch, upgrade and listen
already share, ahead of the providers — remote nodes must join before the topo
sort. Await it before building the route table rather than after, since for a
mesh app the table is not knowable until the splice has run. listen() keeps
working by awaiting the same gate; the memoization means a fetch followed by a
listen boots once, and concurrent first requests splice once.
The fetch/upgrade guards are gone rather than reworded: they are now unreachable.
inspect()/graph()/explain() keep theirs — they are synchronous and cannot await
network I/O — but their message no longer claims listen() is the only way in.
test/fetch.test.ts asserted the old contract (fetch throws until listen), i.e.
the trap itself; it now pins that a mesh app serves without listen() and that
listen() afterwards does not re-run provider factories.
Refs .specs/2026-07-15-green-tea-mesh-cross-runtime-plan.md Task 5
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>