Commit Graph
585 Commits
Author SHA1 Message Date
chrnx fa788d17da docs(llms): the node and handler contracts are enforced now
CI / dco (pull_request) Successful in 4s
CI / build (pull_request) Successful in 58s
CI / runtimes (bun) (pull_request) Successful in 49s
CI / runtimes (deno) (pull_request) Successful in 1m3s
CI / runtimes (edge) (pull_request) Successful in 54s
Follows core's fix: a provider returning its value bare fails the boot,
and a returned Response fails the request. Merge after that fix.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 20:30:05 -05:00
chrnx 4877ea1754 feat: ship llms.txt, a guide for LLM coding agents, in the npm and JSR packages
green-tea is new, so coding agents have no training data on it and
write Express: app.use, next(), res.status().json(). llms.txt states
what differs: the mental model, a complete app, the decorators and
built-in tokens, how to return responses, the options agents usually
need, common mistakes with the correct form, testing, and how to
inspect an app first.

Every code block was typechecked against src/, and each behavioural
claim was checked with a small probe app.

The file ships inside the package, so it always matches the installed
version. matcha's scaffolded AGENTS.md points at it. Only a packaged
file is added; the API is unchanged.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 20:30:05 -05:00
chrnx 6eaa519059 Merge pull request 'fix(graph)!: enforce the node and handler return contracts instead of failing silently' (#186) from fix/loud-node-and-response-contracts into develop
CI / dco (push) Has been skipped
CI / runtimes (edge) (push) Successful in 54s
CI / runtimes (bun) (push) Successful in 44s
CI / build (push) Successful in 1m22s
CI / runtimes (deno) (push) Successful in 59s
Promote → GitHub / push-github (push) Successful in 7s
2026-10-31 01:29:57 +00:00
chrnx 06869e5f01 perf(graph): test a single provided token directly in the return-contract check
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 49s
CI / build (pull_request) Successful in 1m15s
CI / runtimes (edge) (pull_request) Successful in 49s
CI / runtimes (deno) (pull_request) Successful in 1m3s
A @Provider or @Step provides one token, so the check no longer goes
through every() and its callback. On a 3-step pipeline the 4-round A/B
against the freeze commit showed -4.6% on Deno and -3.2% on Bun, both
outside the noise; with this change and 8 rounds every case overlaps.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 20:27:10 -05:00
chrnx c7f4a35008 docs(changelog): the node and handler return contracts are now enforced
CI / dco (pull_request) Successful in 4s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 31s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 34s
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 11:23:01 -05:00
chrnx 44c783439c fix(graph)!: enforce the node and handler return contracts instead of failing silently
provide() and run() must return an object holding every token the node
provides. A provider that returned its value bare (return client rather
than return { db: client }) booted without complaint: the token was
undefined, and the client's own properties were spread over every
request's context. That now fails, naming the node and the fix:
- providers fail the boot;
- steps fail the request;
- plugin nodes are held to the same rule for each token in provides.

A handler that returned a Fetch Response was JSON-encoded and went out
as 200 {}, with its status, headers and body lost. It now fails the
request with a TypeError that points to a plain value, @Transformer or
HttpError. Sending a Response as is can be added later without
breaking anything; taking it back would not be possible.

The check stays synchronous for a synchronous node, so a plain step
adds no microtask. Fixed health tests whose providers returned {}.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 11:22:10 -05:00
chrnx 2744b225a5 Merge pull request 'test(runtimes): close the 1c exit-gate cells for health and compression on Deno and Bun' (#184) from test/gate-1c-cells into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 21s
CI / build (push) Successful in 31s
CI / runtimes (edge) (push) Successful in 24s
Promote → GitHub / push-github (push) Successful in 7s
CI / runtimes (deno) (push) Successful in 34s
2026-10-30 15:55:00 +00:00
chrnx 86d6954f72 test(runtimes): close the 1c exit-gate cells for health and compression on Deno and Bun
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 31s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 34s
The CARD-22 gate audit found these runtime cells without tests:

- CARD-17 T1-T3 (booting, ok, degraded) existed only on Node. Add them
  on Deno and Bun. T1 goes through app.fetch, because serveDeno and
  serveBun boot before they bind. T2 and T3 go through a real listener
  and assert the response body, not only the status.
- CARD-16 T6 (encodings ['gzip'] with a br-only client gives identity)
  was missing on Deno and Bun.
- CARD-16 T8 on Deno and Bun lacked the handler-set content-encoding
  case and the 204 case.

A negative run of T6 against compression: true fails with 'encoded as
br', so the check can tell the two cases apart.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 10:26:30 -05:00
chrnx fea87b3af4 Merge pull request 'docs: publish the API stability policy (D18) and correct the freeze wording' (#183) from docs/deprecation-policy into develop
CI / dco (push) Has been skipped
CI / build (push) Successful in 32s
CI / runtimes (deno) (push) Successful in 33s
CI / runtimes (edge) (push) Successful in 24s
CI / runtimes (bun) (push) Successful in 20s
Promote → GitHub / push-github (push) Successful in 7s
2026-10-30 15:18:16 +00:00
chrnx 846346b53a docs(mesh): mesh may change in any release, and only within its own surface
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 32s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 33s
CI / dco (pull_request) Successful in 6s
Make the wording consistent: mesh is alpha and may change in any
release. The JSDoc tags said 'a minor release' while the README said
'any'.

State the rule mesh now follows. Its surface is the @experimental
exports, MeshConfig and the mesh:* events. A mesh change stays inside
that surface: it adds no createApp option, App method or decorator, and
it changes no stable type. Mesh adapts to the stable API instead of
moving it.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 10:16:12 -05:00
chrnx ff63fc7c87 docs(pipeline): tag ResponseShape @experimental
CI / dco (pull_request) Successful in 4s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 32s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 33s
ResponseShape reaches the public API only through the mesh signatures
MeshControlDeps and RemoteRoute. The CHANGELOG already lists it with
the mesh types, so tag it like them, which keeps it outside the
freeze.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 09:56:00 -05:00
chrnx 582f6278c1 docs(mesh): mark the newly exported mesh types @experimental
CI / dco (pull_request) Successful in 5s
CI / build (pull_request) Successful in 31s
CI / runtimes (bun) (pull_request) Successful in 21s
CI / runtimes (deno) (pull_request) Successful in 33s
CI / runtimes (edge) (pull_request) Successful in 23s
#181 exported Link, ReconnectOptions, ManifestPolicy, SocketCtor,
EventfulSocket, RouteEntry, RemoteScopeNode, RemoteRoute and
MeshControlDeps without the tag the other mesh exports carry, so they
would have read as part of the frozen API. They are mesh plumbing,
outside the freeze like MeshConfig.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 09:45:25 -05:00
chrnx 5c6ee7d68f docs: publish the API stability policy (D18) and correct the freeze wording
CI / dco (pull_request) Successful in 6s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / runtimes (deno) (pull_request) Successful in 34s
CI / build (pull_request) Successful in 31s
CI / runtimes (edge) (pull_request) Successful in 23s
Add an API stability section to the README with the policy. From RC.1
to stable, releases are fixes only, with no additions and no
deprecations. After stable, a deprecated API gets at least two monthly
releases, JSDoc @deprecated, and a single app.logger warning before it
is removed under ### Breaking. The committed API reports make every
change visible, and mesh stays outside the promise.

Correct the wording added in #181 and #182, which said the API could
still grow until stable. That contradicted D18.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 09:41:19 -05:00
chrnx 56ee10cc23 Merge pull request 'ci(api): commit an API report per entry point and fail CI on drift' (#182) from ci/api-report into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 20s
CI / runtimes (deno) (push) Successful in 33s
Promote → GitHub / push-github (push) Successful in 6s
CI / build (push) Successful in 32s
CI / runtimes (edge) (push) Successful in 23s
2026-10-30 14:39:36 +00:00
chrnx 085e3c01d1 chore(deno): record api-extractor in deno.lock
CI / dco (pull_request) Successful in 6s
CI / runtimes (bun) (pull_request) Successful in 21s
CI / build (pull_request) Successful in 31s
CI / runtimes (deno) (pull_request) Successful in 33s
CI / runtimes (edge) (pull_request) Successful in 24s
Deno lists package.json's dependencies in deno.lock, so the new dev
dependency added a line on the first deno test. CI's deno publish
--dry-run then aborted on the dirty tree.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 09:33:21 -05:00
chrnx 18270779fc ci(api): commit an API report per entry point and fail CI on drift
CI / dco (pull_request) Successful in 6s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 32s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Failing after 34s
CARD-22 / D20. api-extractor 7.59.4 is now a dev dependency.
scripts/api-report.mjs reads the declarations that tsup emits for each
export-map entry (".", "./deno", "./bun", "./edge") and writes
api/<entry>.api.md.

`npm run api` regenerates the reports. `npm run api:check` runs in the
CI build job and fails when a report differs from the build, so a
public type change has to arrive with its regenerated report in the
same PR.

The check also fails on ae-forgotten-export: a public signature that
names a type its entry does not export. In the adapter entries, a root
type such as App or Logger is accepted, because it is importable from
@green-tea/core; any other unexported type still fails. Both failure
paths were verified locally, by adding a field to TlsOptions and by
un-exporting DenoServeOptions.

The reports are not published: npm ships dist/ and JSR ships src/.
CONTRIBUTING documents the check and the additions-only rule.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 09:31:12 -05:00
chrnx 46cfa744a1 Merge pull request 'fix: close the RC.1 API audit gaps (type exports, TLS on Deno/Bun, README)' (#181) from fix/rc1-api-gaps into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 20s
CI / build (push) Successful in 29s
CI / runtimes (edge) (push) Successful in 22s
CI / runtimes (deno) (push) Successful in 32s
Promote → GitHub / push-github (push) Successful in 31s
2026-10-30 14:26:17 +00:00
chrnx ff7001f4be docs: record the RC.1 freeze, the TLS refusal and the new type exports
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 22s
CI / runtimes (deno) (pull_request) Successful in 32s
CI / dco (pull_request) Successful in 6s
The README no longer describes the API as still moving, or the radix
matcher as future work. It also states that native TLS is Node-only.
The CHANGELOG gains a Breaking entry, with migration notes, for the
Deno and Bun TLS refusal, and an Added entry listing the newly
exported types.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 08:53:54 -05:00
chrnx 870cdb25e9 fix(adapters): reject createApp({ tls }) on Deno and Bun
Only Node's listen() reads tls. serveDeno and serveBun serve through
the runtime's own listener, so an app created with tls came up as
plain HTTP without warning, for a caller who had asked for HTTPS.

createApp now marks the app with a symbol, following the MARK_EDGE
pattern. Both adapters throw on that mark before they boot or bind.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 08:53:52 -05:00
chrnx 0261da6fd6 feat(types): export every type a public signature uses
Public declarations named types the entry points did not export, so a
caller could invoke the API but could not name its parameters or
results. The affected types were ModuleOptions, Ctor, BusLike,
ArgSource, GraphNodeView, GraphRouteView, StandardIssue,
StandardResult, the experimental mesh types, and the adapter option
types: DenoServeOptions, BunServeOptions and EdgeCtx.

Export them all. The changes are additive only, and no beta.2 name
moves. Bun's private BunServeShortOptions becomes the exported
BunServeOptions, and the ambient Bun.serve shape is renamed so the two
cannot collide.

channel() had started returning TappableChannel, which leaked the
internal tap symbol into its public return type. Restore the beta.2
return type, Channel<T>. ws-core still finds the tap through the
symbol, not through the signature.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-30 08:53:49 -05:00
chrnx 7c1efa5adc Merge pull request 'docs(bench): regenerate the tables for RC.1 and record the beta.2 gate' (#180) from docs/benchmarks-rc1 into develop
CI / dco (push) Has been skipped
CI / build (push) Successful in 29s
CI / runtimes (bun) (push) Successful in 20s
CI / runtimes (deno) (push) Successful in 33s
CI / runtimes (edge) (push) Successful in 23s
Promote → GitHub / push-github (push) Successful in 7s
2026-10-29 21:41:46 +00:00
chrnx 21fcf45fab docs(bench): regenerate the tables for RC.1 and record the beta.2 gate
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 22s
CI / runtimes (deno) (pull_request) Successful in 34s
Regenerate the cross-framework, step-scaling, runtime and security
tables at 4566f31, unpinned on the same Ryzen box as September so the
ratios stay comparable.

Add the 26.9.0-beta.2 -> RC.1 release gate. It runs fifteen cases on
Node, Deno and Bun, and attributes the Deno drift to the router
trade-off accepted under D4, plus residual per-feature work. The
compression rows get their own table, because beta.2 has no
compression to compare against. A comparison against raw-http shows
where the field moved: green-tea gained on hello, param and pipeline,
and Fastify 5.12 gained on validate.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-29 12:46:13 -05:00
chrnx 4566f319b5 Merge pull request 'perf(compression): stop charging uncompressed responses for compression being on' (#179) from perf/compression-skip-buffer into develop
CI / dco (push) Has been skipped
CI / build (push) Successful in 29s
CI / runtimes (deno) (push) Successful in 33s
CI / runtimes (bun) (push) Successful in 20s
CI / runtimes (edge) (push) Successful in 23s
Promote → GitHub / push-github (push) Successful in 7s
2026-10-29 14:47:36 +00:00
chrnx fe4827ccb3 perf(compression): send no Vary on a body under the threshold
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 30s
CI / runtimes (edge) (pull_request) Successful in 22s
CI / runtimes (deno) (pull_request) Successful in 33s
CI / dco (pull_request) Successful in 5s
A buffered body under the threshold is sent identity whatever the client
accepts, so Accept-Encoding played no part in it and RFC 9110 asks for
no Vary. A cache that stores it for everyone is right to: every client
accepts identity. Responses that are encoded, or that are identity for
a request-side reason (identity client, HEAD), and every 304 keep Vary,
as does every compressible edge response, since Cloudflare encodes
there.

Deno pays about 10% of a small request for the header, Bun about 3%.
The size is also measured with Buffer.byteLength instead of allocating
the bytes, which are now built only when the body is encoded.

Measured on the Mac, hello with compression on against compression off:
Deno -17% -> -2%, Bun -7% -> -3%.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-28 22:39:06 -05:00
chrnx e8842e6e06 perf(compression): decide eligibility in one pass over the headers
eligible() read four headers through findHeader, each an Object.keys and
a toLowerCase per key, then ran two regexes, on every response while
compression is on. It now walks the keys once, keeps the first value of
each name as findHeader did, memoizes the content-type decision for the
last type seen, and tests no-transform only when cache-control is set.

Measured on Deno, hello with compression on (under the threshold): +2-5%.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-28 22:33:54 -05:00
chrnx 1935e8e047 Merge pull request 'perf(app): skip awaiting the boot in app.fetch once it has finished' (#178) from perf/fetch-skip-boot-await into develop
CI / dco (push) Has been skipped
CI / build (push) Successful in 29s
CI / runtimes (edge) (push) Successful in 22s
CI / runtimes (deno) (push) Successful in 33s
Promote → GitHub / push-github (push) Successful in 6s
CI / runtimes (bun) (push) Successful in 20s
2026-10-29 03:06:35 +00:00
chrnx d51ff3bee4 perf(app): skip awaiting the boot in app.fetch once it has finished
CI / dco (pull_request) Successful in 5s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 33s
CI / runtimes (bun) (pull_request) Successful in 21s
trackHealth wraps the memoized boot in an async function, so every
app.fetch request paid a new promise and microtask hops awaiting a boot
that had already settled. A built route table means the boot succeeded,
so the fetch handler now goes straight to it; only requests before the
table exists await the boot. A failed boot still rejects every request,
because the table is never built.

Measured in-process on Deno (app.fetch in a loop, param route): about
+3-6%.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-28 20:31:18 -05:00
chrnx 068614ef11 Merge pull request 'docs: bring the contributor docs and examples in line with the repository' (#177) from docs/repo-docs-refresh into develop
CI / runtimes (bun) (push) Successful in 21s
CI / build (push) Successful in 29s
CI / runtimes (edge) (push) Successful in 23s
Promote → GitHub / push-github (push) Successful in 7s
CI / dco (push) Has been skipped
CI / runtimes (deno) (push) Successful in 34s
2026-10-28 19:37:16 +00:00
chrnx 02f0473bfc docs: bring the contributor docs and examples in line with the repository
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 21s
CI / build (pull_request) Successful in 29s
CI / runtimes (deno) (pull_request) Successful in 33s
CI / runtimes (edge) (pull_request) Successful in 22s
CONTRIBUTING said none of the Deno, Bun or edge suites run in CI. They do:
the runtimes job runs all three on every push and gates a merge. It now
says so, names test:all, and lists the audit step CI runs.

The README's benchmark section quoted a ranking against Fastify that went
stale with the next measurement. It now explains what the harness measures
and why, and leaves every number to BENCHMARKS.md. The install section
states the Node 22 floor and that Node 18 and 20 are not supported.

The PR template asks which runtime suites were run. The example README
pointed at ts-node, which is not a dependency, and a dist path tsup never
builds; it now runs each example with tsx. example/server.ts crashed at
boot because its teacup lacked experimental: true.

docs/plans held agent implementation plans from August and September.
Those belong in .specs/, which is not committed, so they leave the
repository. The three places that linked the mesh degrade plan now
describe the planned expects list instead.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-28 14:35:01 -05:00
chrnx 4e4553cdc8 Merge pull request 'perf(http): resolve ctx.ip on first read instead of on every request' (#176) from perf/lazy-ctx-ip into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 21s
CI / build (push) Successful in 29s
CI / runtimes (deno) (push) Successful in 34s
Promote → GitHub / push-github (push) Successful in 6s
CI / runtimes (edge) (push) Successful in 23s
2026-10-28 19:34:48 +00:00
chrnx b86cd605c4 perf(http): resolve ctx.ip on first read instead of on every request
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 30s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 34s
Every Bun request called server.requestIP() for ctx.ip (#116), a native
call that builds an object, whether anything read the address or not. On
Mac that measured 7-11% of a small request; recording the server in the
peer map instead costs nothing.

The neutral request now carries a resolver rather than an address. The
handler request and the pipeline seed expose ctx.ip as an accessor that
resolves once on first read, and a step may still assign it. runPipeline
uses the seed it is given instead of spreading it, which would have
evaluated the accessor; both callers build the seed fresh per request.

Inside a stream body ctx.ip is '' unless a step or the handler read it
before the stream was returned: the body runs after the response has
started, when the socket may be gone.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-28 14:31:20 -05:00
chrnx 109297ca4c Merge pull request 'perf(http): recover the fetch adapter's per-request cost on Deno and Bun' (#175) from perf/web-headers-fast-path into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 22s
CI / build (push) Successful in 29s
CI / runtimes (edge) (push) Successful in 23s
Promote → GitHub / push-github (push) Successful in 7s
CI / runtimes (deno) (push) Successful in 33s
2026-10-28 19:31:13 +00:00
chrnx 133af8dfe5 perf(http): read a declared-length fetch body with arrayBuffer()
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 32s
CI / dco (pull_request) Successful in 5s
The chunked reader added for the incremental 413 (4d1639f) cut a Bun JSON
POST by more than half: 37.6k -> 11.7k req/s on jarvis. A well-formed
Content-Length inside the limit already bounds the body, because the
runtime frames it by that header, so arrayBuffer() is safe there and native
in Bun, Deno and workerd. byteLength is still checked for a Request built in
user code whose header and body disagree. Chunked uploads keep the bounded
read.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-27 22:35:06 -05:00
chrnx 5b2143fcb7 perf(http): hand plain-string response headers to the fetch Response as a record
toWebHeaders copied every response's headers into a Headers object one by
one, so set-cookie arrays survive. Deno and Bun build native headers from a
record directly, and the JS copy cost 5-8% on every Deno request (bisected to
50010da). A record holding only strings is now returned as it is; anything
else still goes through Headers.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-27 22:35:03 -05:00
chrnx 9648a9d1ed Merge pull request 'perf(http): trim per-request work on the Node path' (#174) from perf/node-request-path into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 20s
CI / build (push) Successful in 29s
CI / runtimes (edge) (push) Successful in 23s
Promote → GitHub / push-github (push) Successful in 7s
CI / runtimes (deno) (push) Successful in 33s
2026-10-27 08:03:09 +00:00
chrnx d626fadbfd docs(changelog): note the bodiless-request fast path
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 30s
CI / runtimes (edge) (pull_request) Successful in 22s
CI / runtimes (deno) (pull_request) Successful in 34s
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-27 00:31:50 -05:00
chrnx 88be9b1cb2 perf(http): skip the body stream for a request without a body
CI / runtimes (bun) (pull_request) Successful in 21s
CI / build (pull_request) Successful in 30s
CI / runtimes (edge) (pull_request) Successful in 24s
CI / runtimes (deno) (pull_request) Successful in 32s
CI / dco (pull_request) Successful in 5s
On Node every request goes through readBody, GET included. Subscribing
listeners to an empty request stream measured ~4% slower than the old
async iterator on an 8 KB GET response, in both orders on jarvis.

A request with no Transfer-Encoding and no or a zero Content-Length has
no body (RFC 9112 6.3), so resolve undefined without touching the
stream. Node drains the unread request when the response ends.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-26 22:48:15 -05:00
chrnx 704622cf65 bench(compare): add compression cases to the A/B harness
CI / dco (pull_request) Successful in 4s
CI / runtimes (bun) (pull_request) Successful in 19s
CI / build (pull_request) Successful in 30s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 34s
The A/B harness had no case with compression on, so a change to the
response write path was measured only on its uncompressed branch. Add an
8 KB JSON response uncompressed, identity-negotiated, gzip and br, plus a
small response under the threshold with compression enabled.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-26 13:24:14 -05:00
chrnx 8b67b1a46c perf(http): trim per-request work on the Node path
CI / dco (pull_request) Successful in 6s
CI / runtimes (bun) (pull_request) Successful in 19s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 32s
CI / build (pull_request) Successful in 28s
Profiling the validate (POST) bench route against 4d1639f showed the
loss since then spread over several small costs on the Node request
path rather than one regression. This removes the ones that do not
change behaviour:

- readBody reads with data/end/error/close listeners instead of
  `for await`, whose async iterator costs a promise and a microtask per
  chunk. It keeps the iterator's semantics: the running total enforces
  the limit, an over-limit body destroys the request as leaving the loop
  did, an error or a close before `end` rejects (the latter with
  ERR_STREAM_PREMATURE_CLOSE), and the declared-length 413 is still a
  rejection rather than a synchronous throw. A single chunk is returned
  without Buffer.concat.
- writeResult is no longer async. A buffered response without
  compression is written synchronously and returns nothing to await;
  only a stream or a compressed body returns a promise, which serve
  awaits, so a failure still reaches failSafe. The compression request
  object is not built when compression is off.
- declaresOverLimit compares the number first and runs its /^\d+$/
  shape test only when the length is over the limit.

The `serve().catch(failSafe)` wrapper stays: it is the #108 guarantee,
and handle() is asynchronous, so there is no synchronous path to skip.

Local A/B against 74faa55 (5 s x 4 rounds, macOS, indicative only):
validate (POST) +4.6%. test/read-body.test.ts pins readBody's
semantics: joining, empty body, 413 with destroy, declared-length 413,
stream error and premature close.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-26 08:02:03 -05:00
chrnx 74faa55f41 Merge pull request 'fix(build): let the npm ESM build load on workerd (#93)' (#173) from fix/edge-esm-no-create-require into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 20s
CI / build (push) Successful in 30s
CI / runtimes (edge) (push) Successful in 23s
CI / runtimes (deno) (push) Successful in 32s
Promote → GitHub / push-github (push) Successful in 6s
2026-10-25 03:54:14 +00:00
chrnx b7a852ac92 fix(build): let the npm ESM build load on workerd (#93)
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 19s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 23s
CI / runtimes (deno) (pull_request) Successful in 33s
tsup.config.ts gives every ESM output a banner that calls
createRequire(import.meta.url) at module scope, so the lazy
require('ws') / require('busboy') resolve. On workerd import.meta.url
is not a file URL: createRequire throws during module evaluation and
the worker fails to start. dist/edge.mjs, and the chunk it shares with
the other entry points, could therefore not be loaded from npm at all.
test/edge/run.ts bundles src/, which has no banner, so it never saw it.

The banner now wraps the call in a try and leaves `require` undefined
when it throws. esbuild's __require shim and src/node-require.ts
already handle an undefined require: the latter falls back to
process.getBuiltinModule, and its callers report a missing module in
their own terms. The static node:module import is kept: edge already
requires nodejs_compat, which provides it, and dropping it for
getBuiltinModule would lose Node 22.0-22.2, which lack that API.
Building edge separately was ruled out because it would duplicate
module state (MARK_EDGE) between @green-tea/core and its /edge entry.

test/edge/dist.ts bundles a worker that imports dist/index.mjs and
dist/edge.mjs, as wrangler does with the installed package, and serves
a request on Miniflare. It fails with the old banner and passes now.
npm run test:edge builds before running it, so CI's edge job covers it.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 22:52:07 -05:00
chrnx dd3a74afcd Merge pull request 'fix(transformers)!: answer 204 when a handler returns undefined (GitHub #38)' (#172) from fix/undefined-return-204 into develop
CI / runtimes (bun) (push) Successful in 20s
CI / build (push) Successful in 32s
CI / runtimes (edge) (push) Successful in 20s
CI / runtimes (deno) (push) Successful in 32s
Promote → GitHub / push-github (push) Successful in 6s
CI / dco (push) Has been skipped
2026-10-25 03:51:58 +00:00
chrnx 40702aef2a fix(transformers)!: answer 204 when a handler returns undefined (GitHub #38)
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 21s
CI / runtimes (deno) (pull_request) Successful in 33s
JsonTransformer passed the handler's value to JSON.stringify, which
returns undefined for undefined, while TransformerFn promises a string
body. The Node server wrote that as an empty 200 with content-type
application/json; the fetch adapter's toBodyInit read `body.buffer` on
it and threw, so Deno, Bun and the edge answered 500 for a handler with
no `return`.

JsonTransformer now returns status 204 and an empty body (no headers)
for undefined. outcomeToResponse already sends a null body for 204 and
the Node server ends with the empty string, so all four runtimes give
the same answer. null is a JSON value and still renders as 200 `null`.
Routes with their own @Transformer are unchanged.

BREAKING CHANGE: a handler with no return value now answers 204 instead
of an empty 200 on Node (and instead of 500 elsewhere). Return a value
to keep a 200.

test/undefined-return.test.ts covers app.fetch and the Node server
(both fail without the fix) and pins null to 200.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 22:49:46 -05:00
chrnx 3fc43eb7ad Merge pull request 'fix(params): match @header names without case (GitHub #37)' (#171) from fix/header-decorator-case into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Failing after 12s
CI / build (push) Successful in 29s
CI / runtimes (deno) (push) Successful in 34s
CI / runtimes (edge) (push) Successful in 18s
Promote → GitHub / push-github (push) Successful in 6s
2026-10-25 03:49:42 +00:00
chrnx bc04330a27 fix(params): match @header names without case (GitHub #37)
CI / dco (pull_request) Successful in 4s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 30s
CI / runtimes (deno) (pull_request) Successful in 34s
CI / runtimes (edge) (pull_request) Successful in 19s
Node's IncomingHttpHeaders and the fetch adapter's headersToRecord
both store request header names lower-cased, but resolveOne looked a
@header/@headers key up exactly as the decorator wrote it. Any name
with a capital letter, such as @header('Content-Type'), therefore
reached the handler as undefined.

resolveOne now lower-cases the key for the headers source before the
lookup. A picked bag (@headers([...])) keeps the names as written, so a
handler reads back the key it asked for; @headers() with no argument
still returns the whole lower-cased bag.

test/params.test.ts covers the single and picked forms on resolveArgs;
test/header-case.test.ts sends a request over app.fetch and the Node
server. All three fail without the fix.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 22:36:18 -05:00
chrnx cf5df70c62 Merge pull request 'fix(multipart): accept exactly maxParts parts (#118)' (#170) from fix/multipart-max-parts-boundary into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 20s
CI / build (push) Successful in 30s
CI / runtimes (deno) (push) Successful in 33s
Promote → GitHub / push-github (push) Successful in 6s
CI / runtimes (edge) (push) Successful in 20s
2026-10-25 03:36:02 +00:00
chrnx 5536093894 fix(multipart): accept exactly maxParts parts (#118)
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 30s
CI / runtimes (edge) (pull_request) Successful in 19s
CI / runtimes (deno) (pull_request) Successful in 34s
CI / dco (pull_request) Successful in 5s
busboy emits `partsLimit` once its part count reaches `limits.parts`,
not when it passes it, and parseMultipart treats that event as a
malformed body. With `maxParts: N` a body of exactly N parts was
therefore rejected with 400 and only N-1 were accepted.

parseMultipart now passes `maxParts + 1` to busboy, the same one-unit
headroom it already gives `fieldSize`. N parts are accepted, N+1 are
rejected. Route-level and server-level maxParts share this path, as do
the Node server and app.fetch.

test/multipart.test.ts adds the exact-N case on parseMultipart;
test/multipart-http.test.ts sends exactly N parts at route and server
level. All three new assertions fail without the fix.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 22:21:10 -05:00
chrnx 87b6e7a4b0 Merge pull request 'fix(multipart): bound a text field by the body limit, not busboy's 1 MiB (GitHub #39)' (#165) from fix/multipart-field-size into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 20s
CI / build (push) Successful in 29s
CI / runtimes (edge) (push) Successful in 18s
CI / runtimes (deno) (push) Successful in 33s
Promote → GitHub / push-github (push) Successful in 7s
2026-10-25 00:48:17 +00:00
chrnx 235e483bfb fix(multipart): bound a text field by the body limit, not busboy's 1 MiB (GitHub #39)
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 19s
CI / runtimes (deno) (pull_request) Successful in 33s
parseMultipart created busboy with `limits: { parts }` only, so
busboy's `fieldSize` default of 1 MiB applied whatever maxBodyBytes
allowed. busboy cuts a field at that size and only sets
`valueTruncated`, which nothing read: with the body limit raised, a
1,100,000-character field reached the handler as 1,048,576 characters.

acquireBody now passes the route's resolved body limit down as
`maxFieldBytes`, and parseMultipart gives it to busboy as `fieldSize`.
busboy flags a field once it reaches `fieldSize`, so it gets one byte
of headroom; otherwise a field of exactly the limit would count as
cut. A field that busboy still reports as truncated rejects with
HttpError 413, which parseRequestBody already renders with that
status, matching how an over-limit body fails. Node and app.fetch
(Deno, Bun, edge) share this path.

test/multipart-http.test.ts sends a 1,100,000-character field to a
route with maxBodyBytes 2,000,000 over both app.fetch and the Node
server. test/multipart.test.ts checks the 413 and the exact-limit
boundary on parseMultipart directly.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 19:29:31 -05:00
chrnx e7f08052f4 Merge pull request 'fix(graph)!: fail boot when a node needs the token it provides (GitHub #43)' (#163) from fix/graph-self-dependency into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 20s
CI / runtimes (edge) (push) Successful in 19s
CI / runtimes (deno) (push) Successful in 32s
Promote → GitHub / push-github (push) Successful in 6s
CI / build (push) Successful in 29s
2026-10-24 23:58:26 +00:00