6 Commits
Author SHA1 Message Date
chrnx a2f905fa30 docs(changelog): static revalidation is a breaking change (CARD-15, D12)
CI / dco (pull_request) Successful in 4s
CI / runtimes (bun) (pull_request) Successful in 19s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 19s
CI / runtimes (deno) (pull_request) Successful in 33s
Every static file now goes out with `Cache-Control: no-cache`, where
before it sent no Cache-Control at all. A browser or proxy that reused
static files for a lifetime guessed from `Last-Modified` now revalidates
each one, and keeping the old behaviour needs a config change (`static:
{ cacheControl }`). That is a breaking change, so the entry moves from
`### Changed` to `### Breaking`, word for word.

D12 had filed it under `### Changed`. CARD-22's gate table already said
a breaking entry was due if the default turned on, and it did. The
pre-freeze review flagged the mismatch.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 14:08:37 -05:00
chrnx bb3d759f3a Merge pull request 'fix(http): a handler-set ETag array is still the handler's (CARD-15)' (#151) from fix/etag-array-header into develop
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 19s
CI / build (push) Successful in 29s
CI / runtimes (edge) (push) Successful in 18s
CI / runtimes (deno) (push) Successful in 32s
Promote → GitHub / push-github (push) Successful in 6s
2026-10-24 19:08:27 +00:00
chrnx d1abc4951a Merge pull request 'chore: clear the dependency advisories blocking CI' (#150) from chore/npm-audit-2026-10-24 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 19s
CI / runtimes (deno) (push) Successful in 32s
Promote → GitHub / push-github (push) Successful in 6s
2026-10-24 19:06:54 +00:00
chrnx 0017093626 chore: mirror the new overrides in deno.lock
CI / dco (pull_request) Successful in 4s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 29s
CI / runtimes (edge) (pull_request) Successful in 18s
CI / runtimes (deno) (pull_request) Successful in 33s
deno.lock records package.json's overrides, so the runtimes (deno) job's
publish dry-run found it out of date after the bump and aborted.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 13:59:25 -05:00
chrnx 3efe049bb5 fix(http): a handler-set ETag array is still the handler's (CARD-15)
CI / dco (pull_request) Successful in 4s
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 33s
With `etag: true`, `tagged()` only recognised a handler ETag given as a
string. Given as an array, it compared If-None-Match against the body's
computed tag while sending the handler's array, so a client revalidating
with the tag it was sent got a 200 instead of a 304, and two ETag values
went on the wire.

ETag is single-valued, so the last value of an array wins, as a repeated
`setHeader` would. It is sent alone and drives the comparison.

Found in the pre-freeze integrated review.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 13:55:06 -05:00
chrnx 74dbbe0b1a chore: clear the dependency advisories blocking CI
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / runtimes (edge) (pull_request) Successful in 19s
CI / build (pull_request) Successful in 29s
CI / runtimes (deno) (pull_request) Failing after 33s
`npm audit --audit-level=moderate` fails on develop: six advisories, all
in devDependencies, none in what ships.

- body-parser (high) and fast-uri (moderate): a plain `npm audit fix`.
- undici (high): the existing override pinned 7.29.1, now inside the
  advisory range. Move it to 7.30.1. `--force` wanted a miniflare
  downgrade instead.
- multer (high): reached through @nestjs/platform-express, the bench's
  Nest comparison. 2.5.0 carries the fix. `--force` wanted a Nest
  downgrade, so add an override like the others.

Verified: audit reports 0 vulnerabilities; lint, typecheck, `npm test`
(1149), test:edge (exercises miniflare on the new undici), test:bun,
test:deno and build all pass.

test/mesh/large-body.test.ts T2 fails about 1 run in 10 with EPIPE. That
rate is the same with and without this change (2/20 each), and Node's
fetch uses its bundled undici, not this one. Tracked separately.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-24 13:53:51 -05:00
6 changed files with 55 additions and 36 deletions

No files matched your search

+7 -6
View File
@@ -99,6 +99,13 @@ npm treats versions as semver and semver forbids leading zeros.
`app.upgrade` already did. An app with no `@Ws`/`@Stream` routes and no mesh attaches no upgrade `app.upgrade` already did. An app with no `@Ws`/`@Stream` routes and no mesh attaches no upgrade
listener on Node, as before, so there the request still reaches the HTTP route table. listener on Node, as before, so there the request still reaches the HTTP route table.
- **Static files are revalidated, not re-downloaded** (#114, D12). Every static hit carries a weak
`ETag` (`W/"<size>-<mtime>"`), `Last-Modified` and `Cache-Control: no-cache`. A matching
`If-None-Match`, or `If-Modified-Since` when there is no `If-None-Match`, answers `304` from the
file's `stat` without reading it. A `HEAD` no longer reads the file either. `no-cache` stops
browsers from reusing a file for a lifetime they guessed from `Last-Modified`. To keep the old
behaviour, set `static: { cacheControl }` to whatever your proxy expects.
### Added ### Added
- **Health probes: `createApp({ health: true })`** (#115). Off by default. `GET`/`HEAD /__live__` - **Health probes: `createApp({ health: true })`** (#115). Off by default. `GET`/`HEAD /__live__`
@@ -177,12 +184,6 @@ npm treats versions as semver and semver forbids leading zeros.
### Changed ### Changed
- **Static files are revalidated, not re-downloaded** (#114, D12). Every static hit carries a weak
`ETag` (`W/"<size>-<mtime>"`), `Last-Modified` and `Cache-Control: no-cache`. A matching
`If-None-Match`, or `If-Modified-Since` when there is no `If-None-Match`, answers `304` from the
file's `stat` without reading it. A `HEAD` no longer reads the file either. `no-cache` stops
browsers from reusing a file for a lifetime they guessed from `Last-Modified`. To keep the old
behaviour, set `static: { cacheControl }` to whatever your proxy expects.
- **Every `304` is bodiless** (#114). A `304` has no body and no `content-*` headers on any adapter, - **Every `304` is bodiless** (#114). A `304` has no body and no `content-*` headers on any adapter,
including one from `throw new NotModified()`, which used to go out with the default JSON including one from `throw new NotModified()`, which used to go out with the default JSON
envelope's `content-type`. envelope's `content-type`.
Generated
+3 -2
View File
@@ -56,9 +56,10 @@
"uuid": "11.1.1" "uuid": "11.1.1"
} }
}, },
"undici": "7.29.1", "undici": "7.30.1",
"sharp": "0.35.5", "sharp": "0.35.5",
"fastify": "$fastify" "fastify": "$fastify",
"multer": "2.5.0"
} }
} }
} }
+24 -24
View File
@@ -1814,9 +1814,9 @@
} }
}, },
"node_modules/@nestjs/platform-express": { "node_modules/@nestjs/platform-express": {
"version": "11.2.7", "version": "11.2.8",
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-11.2.7.tgz", "resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-11.2.8.tgz",
"integrity": "sha512-+F0hV/4yJM+D/Qwyo5XmKMe6YGEb+ssT2jFWrgdFe1obumXCUeC1GNob/kNeXyzAXm7dcxZVUtmcoqaF6z36jA==", "integrity": "sha512-aSAAz8E31qv+sDsL0s7Cw/HoXmeM0TVf35ny17BjLL10c2PgFDp2vunycL7muVyp3/IP5TStMb3Ia4B/RTNHZA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -3164,19 +3164,19 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/body-parser": { "node_modules/body-parser": {
"version": "2.3.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz",
"integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==", "integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"bytes": "^3.1.2", "bytes": "^3.1.2",
"content-type": "^2.0.0", "content-type": "^2.1.0",
"debug": "^4.4.3", "debug": "^4.4.3",
"http-errors": "^2.0.1", "http-errors": "^2.0.1",
"iconv-lite": "^0.7.2", "iconv-lite": "^0.7.3",
"on-finished": "^2.4.1", "on-finished": "^2.4.1",
"qs": "^6.15.2", "qs": "^6.16.1",
"raw-body": "^3.0.2", "raw-body": "^3.0.2",
"type-is": "^2.1.0" "type-is": "^2.1.0"
}, },
@@ -3189,9 +3189,9 @@
} }
}, },
"node_modules/body-parser/node_modules/content-type": { "node_modules/body-parser/node_modules/content-type": {
"version": "2.0.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz", "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz",
"integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==", "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -4267,9 +4267,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/fast-uri": { "node_modules/fast-uri": {
"version": "3.1.8", "version": "3.1.9",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz", "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz",
"integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==", "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -5545,9 +5545,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/multer": { "node_modules/multer": {
"version": "2.4.0", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/multer/-/multer-2.4.0.tgz", "resolved": "https://registry.npmjs.org/multer/-/multer-2.5.0.tgz",
"integrity": "sha512-7dqa0ZcFfzbefdTuIkzOSMvZWC0J7FLqBOjJUZvDCXShIURWKxAyTT1wHhnE5q19c7jOJf43IYYKjBmZVZmvhg==", "integrity": "sha512-BsqOzYGVq49JcW2IzoSAxeKYRevb+dGGPPWleOR8Lrlk4igwxu1/9pwSXlByhCb7MVZDrNJFC0IBP5/O5nLYRw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -6196,9 +6196,9 @@
} }
}, },
"node_modules/qs": { "node_modules/qs": {
"version": "6.16.0", "version": "6.16.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.1.tgz",
"integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==", "integrity": "sha512-5Px6J7rfHBAGUhNQ3es4YzcOdBBw0SDcVtThJml4RdnKw4tKs2epA0kPZ+K8X+WiHktT93RHVcQ/3ym5aTCgtg==",
"dev": true, "dev": true,
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"dependencies": { "dependencies": {
@@ -7808,9 +7808,9 @@
} }
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "7.29.1", "version": "7.30.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.29.1.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz",
"integrity": "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==", "integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
+3 -2
View File
@@ -130,9 +130,10 @@
"uuid": "11.1.1" "uuid": "11.1.1"
} }
}, },
"undici": "7.29.1", "undici": "7.30.1",
"sharp": "0.35.5", "sharp": "0.35.5",
"fastify": "$fastify" "fastify": "$fastify",
"multer": "2.5.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.39.5", "@eslint/js": "^9.39.5",
+4 -2
View File
@@ -191,8 +191,10 @@ function tagged(
): Buffered { ): Buffered {
const key = findHeader(result.headers, 'etag'); const key = findHeader(result.headers, 'etag');
const existing = key === undefined ? undefined : result.headers[key]; const existing = key === undefined ? undefined : result.headers[key];
const etag = typeof existing === 'string' ? existing : bodyEtag(result.body); // ETag is single-valued: from an array, the last value wins, as a repeated `setHeader` would.
const headers = key === undefined ? { ...result.headers, etag } : result.headers; const own = Array.isArray(existing) ? existing[existing.length - 1] : existing;
const etag = own ?? bodyEtag(result.body);
const headers = { ...result.headers, [key ?? 'etag']: etag };
if (isNotModified(req.headers, etag)) return bodyless({ kind: 'buffered', status: 304, headers, body: '' }); if (isNotModified(req.headers, etag)) return bodyless({ kind: 'buffered', status: 304, headers, body: '' });
+14
View File
@@ -29,6 +29,12 @@ class Handlers {
return null; return null;
} }
@Get('/own-list')
@Transformer(() => ({ headers: { ETag: ['"v6"', '"v7"'] }, body: 'v7' }))
ownList() {
return null;
}
@Post('/post') @Post('/post')
post() { post() {
return { n: 1 }; return { n: 1 };
@@ -182,6 +188,14 @@ describe('handlers (etag: true)', () => {
expect(res.headers.get('etag')).toBe('"v7"'); expect(res.headers.get('etag')).toBe('"v7"');
}); });
it("T6: a handler-set ETag array is still the handler's: the last value is sent and compared", async () => {
const first = await req(etagApp, '/h/own-list');
expect(first.headers.get('etag')).toBe('"v7"');
const res = await req(etagApp, '/h/own-list', { headers: { 'if-none-match': '"v7"' } });
expect(res.status).toBe(304);
expect(res.headers.get('etag')).toBe('"v7"');
});
it('T7/T8: a list containing the tag, and *', async () => { it('T7/T8: a list containing the tag, and *', async () => {
const etag = (await req(etagApp, '/h/json')).headers.get('etag')!; const etag = (await req(etagApp, '/h/json')).headers.get('etag')!;
const list = await req(etagApp, '/h/json', { headers: { 'if-none-match': `"a", ${etag}, "c"` } }); const list = await req(etagApp, '/h/json', { headers: { 'if-none-match': `"a", ${etag}, "c"` } });