1 Commits
Author SHA1 Message Date
chrnx 5e9ca2678b test(rate-limit): give peers on different addresses separate budgets on every runtime
CI / dco (pull_request) Successful in 3s
CI / build (pull_request) Successful in 13s
CI / runtimes (bun) (pull_request) Failing after 10s
CI / runtimes (edge) (pull_request) Successful in 7s
CI / runtimes (deno) (pull_request) Failing after 8s
The default keyOf buckets callers by ctx.ip. serveDeno and serveBun left ctx.ip empty until
core #116 (merged in core #117), so every caller on those runtimes shared the 'unknown' bucket
and the first one to reach max locked out everybody else.

This drives the plugin's default keyOf over a real socket: one dual-stack listener, client A over
127.0.0.1 and client B over ::1, max: 1. A's second request must be 429 and B's first 200, with two
distinct ctx.ip values. Node's listen() path runs the same test as the control and passes on any
core; on Deno and Bun it passes only on a core that carries #116, and fails on 26.9.0-beta.2.
Hosts without an IPv6 loopback fall back to 127.0.0.1 and 127.0.0.2, which only Linux routes.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-10 11:57:43 -05:00
17 changed files with 236 additions and 174 deletions

No files matched your search

+5 -5
View File
@@ -24,7 +24,7 @@ jobs:
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Every commit needs a Signed-off-by - name: Every commit needs a Signed-off-by
@@ -48,8 +48,8 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
- uses: actions/setup-node@v5 - uses: actions/setup-node@v4
with: with:
node-version: '22' node-version: '22'
- run: npm ci - run: npm ci
@@ -71,8 +71,8 @@ jobs:
matrix: matrix:
runtime: [deno, bun, edge] runtime: [deno, bun, edge]
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
- uses: actions/setup-node@v5 - uses: actions/setup-node@v4
with: with:
node-version: '22' node-version: '22'
- run: npm ci - run: npm ci
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
if: ${{ github.server_url != 'https://github.com' }} if: ${{ github.server_url != 'https://github.com' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 # full history for a clean push fetch-depth: 0 # full history for a clean push
- name: Push to GitHub - name: Push to GitHub
+2 -2
View File
@@ -30,8 +30,8 @@ jobs:
id-token: write # OIDC — this is what publishes, and what earns provenance id-token: write # OIDC — this is what publishes, and what earns provenance
contents: write # create the GitHub release for this tag contents: write # create the GitHub release for this tag
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v4
- uses: actions/setup-node@v5 - uses: actions/setup-node@v4
with: with:
node-version: '22' node-version: '22'
- uses: denoland/setup-deno@v2 - uses: denoland/setup-deno@v2
+7 -8
View File
@@ -35,12 +35,11 @@ That works under every package manager: `jsr add` writes one line to `.npmrc` an
Plugins import core as types only, and a type import leaves nothing behind when it compiles — the Plugins import core as types only, and a type import leaves nothing behind when it compiles — the
JavaScript JSR publishes never mentions core. So the core that runs is always your application's, JavaScript JSR publishes never mentions core. So the core that runs is always your application's,
whatever version a plugin was written against. whatever version a plugin was written against, and nothing warns about a version range, which under
CalVer no range can express.
The types still come from somewhere, so each plugin's `deno.json` names a core **range**, That is about *loading*, not about disk. A plugin names an exact core in its `deno.json`, and when
`^26.11.0-rc.2`: the version its tests run against, up to the next year. After core's first stable your version differs by more than the patch, npm places a second copy under the plugin rather than
release only the first release of a year may break, so that range is exactly the set of cores a deduplicating. Measured, on purpose: it is inert, because nothing ever imports it. What it can do
plugin stays compatible with, and your application's core satisfies it without a second copy. A is make `tsc` resolve a plugin's `Plugin` type against that copy instead of yours, which fails
plugin published before this named an exact core, and an application on a newer one could get a loudly at compile time rather than quietly at runtime.
second, older copy under the plugin. It was inert at runtime, but `tsc` could resolve the plugin's
`Plugin` type against it and fail at compile time.
+83 -97
View File
@@ -611,16 +611,16 @@
} }
}, },
"node_modules/@green-tea/core": { "node_modules/@green-tea/core": {
"version": "26.11.0-rc.2", "version": "26.9.0-beta.2",
"resolved": "https://registry.npmjs.org/@green-tea/core/-/core-26.11.0-rc.2.tgz", "resolved": "https://registry.npmjs.org/@green-tea/core/-/core-26.9.0-beta.2.tgz",
"integrity": "sha512-fvpJsK67vRQZ/TidhNclMO8KUXeSxZIbGq6lHHP2fRQVGh5ys8iOzcKE8sXTucUjV00dTe+VjNnWq2BTpndXig==", "integrity": "sha512-HM8FdRgJz5CUiXqQUEa7vA3C+MLm/xe1Gq+5Unzg/3U6pPxqLedac+kUNcokeuwCNU5UE6bqtraTuHMua+xZ7Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"reflect-metadata": "0.2.2" "reflect-metadata": "0.2.2"
}, },
"engines": { "engines": {
"node": ">=22" "node": ">=18"
}, },
"peerDependencies": { "peerDependencies": {
"busboy": "^1.6.0", "busboy": "^1.6.0",
@@ -731,13 +731,6 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/@isaacs/nonrecursive-glob-match": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz",
"integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==",
"dev": true,
"license": "BlueOak-1.0.0"
},
"node_modules/@one-ini/wasm": { "node_modules/@one-ini/wasm": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/@one-ini/wasm/-/wasm-0.1.1.tgz", "resolved": "https://registry.npmjs.org/@one-ini/wasm/-/wasm-0.1.1.tgz",
@@ -802,17 +795,17 @@
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.70.1.tgz",
"integrity": "sha512-z3KXk1+Vm+d82ZRplOoC89ho4Rf1da5ju6sx8//92GnN532U62DGPjECXkkVqtYzIv0zoJlpO39SX2Z9tk6LVw==", "integrity": "sha512-nDNrUQ/4ruSNYbu749TRY7cfrzPtoLHEXSNBI8aaNY32LlZCajixqRf3FqcKC4p5Cam4VOHYx/t+i5+nKXvrqA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.12.2", "@eslint-community/regexpp": "^4.12.2",
"@typescript-eslint/scope-manager": "8.74.0", "@typescript-eslint/scope-manager": "8.70.1",
"@typescript-eslint/type-utils": "8.74.0", "@typescript-eslint/type-utils": "8.70.1",
"@typescript-eslint/utils": "8.74.0", "@typescript-eslint/utils": "8.70.1",
"@typescript-eslint/visitor-keys": "8.74.0", "@typescript-eslint/visitor-keys": "8.70.1",
"ignore": "^7.0.5", "ignore": "^7.0.5",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"ts-api-utils": "^2.5.0" "ts-api-utils": "^2.5.0"
@@ -825,15 +818,15 @@
"url": "https://opencollective.com/typescript-eslint" "url": "https://opencollective.com/typescript-eslint"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/parser": "^8.74.0", "@typescript-eslint/parser": "^8.70.1",
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
"typescript": ">=4.8.4 <6.1.0" "typescript": ">=4.8.4 <6.1.0"
} }
}, },
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
"version": "7.0.16", "version": "7.0.10",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.16.tgz", "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.10.tgz",
"integrity": "sha512-52N+Y4HRMOJmbLmr+DqO4iSRyyB7N52gm7PWCT6h0p978+oKbqHCB7gIJIwZvBUsjlSdWbrBFqUSmIFNZMpn0A==", "integrity": "sha512-HpbUakT7xp5miBUywCHf36ZEuAJNklBJDDsGpUIjMzOSmM8ELSfA9Sa/QDPeNeqeoN31u+UTCkL4klCOVvRm4Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -841,16 +834,16 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.70.1.tgz",
"integrity": "sha512-ecr8AYdig7avVkxaHdQvxHnIJ/mOyliO4Gv/uWF8q69vBew/z3sexqBwHUZX5Vql+Ns0w4sH6gBLkICGbOvJkA==", "integrity": "sha512-nO974WLllwhSFWQXnMLj6nDGa8f0khKEz1JzpPJ1u7Vm/4X1X6ZHajpoknU4bb41vJyMB0HHVyS2GqdhWfIXZw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "8.74.0", "@typescript-eslint/scope-manager": "8.70.1",
"@typescript-eslint/types": "8.74.0", "@typescript-eslint/types": "8.70.1",
"@typescript-eslint/typescript-estree": "8.74.0", "@typescript-eslint/typescript-estree": "8.70.1",
"@typescript-eslint/visitor-keys": "8.74.0", "@typescript-eslint/visitor-keys": "8.70.1",
"debug": "^4.4.3" "debug": "^4.4.3"
}, },
"engines": { "engines": {
@@ -866,14 +859,14 @@
} }
}, },
"node_modules/@typescript-eslint/project-service": { "node_modules/@typescript-eslint/project-service": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.70.1.tgz",
"integrity": "sha512-z/mymuE+JlEeSFIv3Mo70EvgG1Zz74Hl0IDfExfXutARAP834bt+MppTD7mVAwmZO0GdxdOAi0jbTam749eH6g==", "integrity": "sha512-62xOgboPfwc3/IgPSX/W6oQR3ZbF04194FPGUGH8HL8iLFHbt/456/8Ph1wLNUgVF+s94FlHoipBsz+v7+LMnA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.74.0", "@typescript-eslint/tsconfig-utils": "^8.70.1",
"@typescript-eslint/types": "^8.74.0", "@typescript-eslint/types": "^8.70.1",
"debug": "^4.4.3" "debug": "^4.4.3"
}, },
"engines": { "engines": {
@@ -888,14 +881,14 @@
} }
}, },
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.70.1.tgz",
"integrity": "sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ==", "integrity": "sha512-Pa0EeSeAusQc1WbjQMac+YfenewYTBu0KjgYvkUKwhXaHUKbFog23Dm/rp0DX/6tyYOQ3Xl1a+3EcFNZynGHCw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.74.0", "@typescript-eslint/types": "8.70.1",
"@typescript-eslint/visitor-keys": "8.74.0" "@typescript-eslint/visitor-keys": "8.70.1"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -906,9 +899,9 @@
} }
}, },
"node_modules/@typescript-eslint/tsconfig-utils": { "node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.70.1.tgz",
"integrity": "sha512-p07wAuaS6BjCYgOSXKJi4YhvTnAf7fiG37e9THcpnYaQEt2QiTTYZWKwUFNgeRiywiMudazhzgddAirZ0GgHtQ==", "integrity": "sha512-jumze1fPI+sDOaM2TWGQdn39PDxTr7TZGeuyLkAbNyx2vtMT3uRnVKChN0hfht5V2TugphJzF6bYXvBcE09qqg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -923,15 +916,15 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.70.1.tgz",
"integrity": "sha512-CV3Y3la8l3F9ANfxcfpgSSiQgJTe4IeLEoZV4O/gcW86Ugp8X6SKiQ0vm+QegXaRIbbDMokZZSF3A1CgiU/kPw==", "integrity": "sha512-7zKTnyvaVWqzLZHPFQtX1hVHqgkMC+WebPWakNCSyrQVbIP1AM0L0TlBZtACldIRb6PptI8Odk+jyZ5kP3B1VA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.74.0", "@typescript-eslint/types": "8.70.1",
"@typescript-eslint/typescript-estree": "8.74.0", "@typescript-eslint/typescript-estree": "8.70.1",
"@typescript-eslint/utils": "8.74.0", "@typescript-eslint/utils": "8.70.1",
"debug": "^4.4.3", "debug": "^4.4.3",
"ts-api-utils": "^2.5.0" "ts-api-utils": "^2.5.0"
}, },
@@ -948,9 +941,9 @@
} }
}, },
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.70.1.tgz",
"integrity": "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA==", "integrity": "sha512-Dm1ypdhhrGCTyyehxElhgJ6kgk8MVCv5qXdoOVqPr1uqk42jX8KjrZqhROvdShczA8qrDoYiOWn1ykWlx2k81Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -962,18 +955,18 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/typescript-estree": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.70.1.tgz",
"integrity": "sha512-wL348k6l92DNG+kPP5rVpKwNBoz7a3xRZy3TPKc1uymQttd7u7gcMv3eENmcuh4CjC4mO3FTM0DYstFXMyDLuw==", "integrity": "sha512-TU8PwyGN0PQJUcE96mw8eCQ44SmxGdQlJmlWakHaHQ15eIuuvye5yNtmh/i6oS88jzXVQB71xdNkbkB/fMwL0g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/project-service": "8.74.0", "@typescript-eslint/project-service": "8.70.1",
"@typescript-eslint/tsconfig-utils": "8.74.0", "@typescript-eslint/tsconfig-utils": "8.70.1",
"@typescript-eslint/types": "8.74.0", "@typescript-eslint/types": "8.70.1",
"@typescript-eslint/visitor-keys": "8.74.0", "@typescript-eslint/visitor-keys": "8.70.1",
"debug": "^4.4.3", "debug": "^4.4.3",
"minimatch": "^11.0.1", "minimatch": "^10.2.2",
"semver": "^7.7.3", "semver": "^7.7.3",
"tinyglobby": "^0.2.15", "tinyglobby": "^0.2.15",
"ts-api-utils": "^2.5.0" "ts-api-utils": "^2.5.0"
@@ -986,13 +979,7 @@
"url": "https://opencollective.com/typescript-eslint" "url": "https://opencollective.com/typescript-eslint"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev",
"typescript": ">=4.8.4 <6.1.0" "typescript": ">=4.8.4 <6.1.0"
},
"peerDependenciesMeta": {
"@typescript/native": {
"optional": true
}
} }
}, },
"node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": { "node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": {
@@ -1006,9 +993,9 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
"version": "5.1.0", "version": "5.0.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.0.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
"integrity": "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg==", "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -1019,33 +1006,32 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
"version": "11.0.9", "version": "10.2.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz",
"integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==",
"dev": true, "dev": true,
"license": "BlueOak-1.0.0", "license": "BlueOak-1.0.0",
"dependencies": { "dependencies": {
"@isaacs/nonrecursive-glob-match": "^1.1.0", "brace-expansion": "^5.0.8"
"brace-expansion": "^5.0.12"
}, },
"engines": { "engines": {
"node": "20 || >=22" "node": "18 || 20 || >=22"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.70.1.tgz",
"integrity": "sha512-IpWXPxXXomzxyTcvjhZJexgdvtTR1TooLAPpuxzaGqQ8BHll1lf4Ysp/BTE/l0U5TJ+x1j7B4bEM8pLRrvY+XA==", "integrity": "sha512-Esgul8MsnKnRLdYU2Eb2cRV9bS5HJYtKj1ByJnOzzG2M58DGdSUQ1jUuILxipqcpB2h9WLrbD5GijIWUjX/Tqw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.9.1", "@eslint-community/eslint-utils": "^4.9.1",
"@typescript-eslint/scope-manager": "8.74.0", "@typescript-eslint/scope-manager": "8.70.1",
"@typescript-eslint/types": "8.74.0", "@typescript-eslint/types": "8.70.1",
"@typescript-eslint/typescript-estree": "8.74.0" "@typescript-eslint/typescript-estree": "8.70.1"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -1060,13 +1046,13 @@
} }
}, },
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.74.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.70.1.tgz",
"integrity": "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g==", "integrity": "sha512-Vwj9lUIW5Xq3wQ9w6gv3R86g1hMK8f2zNOdGTAgeXUMMXFK78G9ruCjjqutHMNJc0+CH7LYRnHeUB9IT8wFmcw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.74.0", "@typescript-eslint/types": "8.70.1",
"eslint-visitor-keys": "^5.0.0" "eslint-visitor-keys": "^5.0.0"
}, },
"engines": { "engines": {
@@ -2739,16 +2725,16 @@
} }
}, },
"node_modules/typescript-eslint": { "node_modules/typescript-eslint": {
"version": "8.74.0", "version": "8.70.1",
"resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.74.0.tgz", "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.70.1.tgz",
"integrity": "sha512-OsWQlsedt1ZpZXfZZMNK3m4SoQONFFcy4h/uRznsCeRfVuEic3gh4KGUs2pJJ5o0Jj0Jr7keUHQGN1Ns9aDw7Q==", "integrity": "sha512-AcWG7KDjZ2THNXsgwttMaGmzVi0VFRlFYfqFHYQRbDpF3owuYbuiL8c7UUrd2k8s3PoSfIQrWfrGXfcElrWLYA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/eslint-plugin": "8.74.0", "@typescript-eslint/eslint-plugin": "8.70.1",
"@typescript-eslint/parser": "8.74.0", "@typescript-eslint/parser": "8.70.1",
"@typescript-eslint/typescript-estree": "8.74.0", "@typescript-eslint/typescript-estree": "8.70.1",
"@typescript-eslint/utils": "8.74.0" "@typescript-eslint/utils": "8.70.1"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -2945,13 +2931,13 @@
}, },
"packages/jwt": { "packages/jwt": {
"name": "@green-tea/jwt", "name": "@green-tea/jwt",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"jose": "^6.2.12" "jose": "^6.2.12"
}, },
"devDependencies": { "devDependencies": {
"@green-tea/core": "26.11.0-rc.2" "@green-tea/core": "26.9.0-beta.2"
}, },
"engines": { "engines": {
"bun": ">=1.3", "bun": ">=1.3",
@@ -2961,10 +2947,10 @@
}, },
"packages/metrics": { "packages/metrics": {
"name": "@green-tea/metrics", "name": "@green-tea/metrics",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@green-tea/core": "26.11.0-rc.2" "@green-tea/core": "26.9.0-beta.2"
}, },
"engines": { "engines": {
"bun": ">=1.3", "bun": ">=1.3",
@@ -2974,10 +2960,10 @@
}, },
"packages/rate-limit": { "packages/rate-limit": {
"name": "@green-tea/rate-limit", "name": "@green-tea/rate-limit",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@green-tea/core": "26.11.0-rc.2" "@green-tea/core": "26.9.0-beta.2"
}, },
"engines": { "engines": {
"bun": ">=1.3", "bun": ">=1.3",
-14
View File
@@ -1,18 +1,5 @@
# Changelog # Changelog
## [Unreleased]
## [26.11.0-rc.2] - 2026-11-23
### Changed
- **Versions track core.** This release is 26.11.0-rc.2, the core it is tested against.
- **Core is a range, `^26.11.0-rc.2`, not an exact `26.9.0-beta.2`.** JSR consumers resolve the
`@green-tea/core` import in `deno.json`, and the exact pin gave an application on a newer core a
second, older copy whose types `tsc` could pick up. The range starts at the core the tests run
against (26.11.0-rc.2, which fixes nine security advisories reported against rc.1) and stops at
the next year, the only core release that may break.
## [26.9.0-beta.0] - 2026-09-23 ## [26.9.0-beta.0] - 2026-09-23
### Added ### Added
@@ -21,5 +8,4 @@
under `provides` (default `jwt`). `Signer` signs with `iat` and a random `jti`, and verifies issuer under `provides` (default `jwt`). `Signer` signs with `iat` and a random `jti`, and verifies issuer
and audience. `JwtRegistry.publicJwk(name)` returns a key's public half for a JWKS endpoint. and audience. `JwtRegistry.publicJwk(name)` returns a key's public half for a JWKS endpoint.
[26.11.0-rc.2]: https://jsr.io/@green-tea/jwt@26.11.0-rc.2
[26.9.0-beta.0]: https://jsr.io/@green-tea/jwt@26.9.0-beta.0 [26.9.0-beta.0]: https://jsr.io/@green-tea/jwt@26.9.0-beta.0
+2 -2
View File
@@ -1,10 +1,10 @@
{ {
"name": "@green-tea/jwt", "name": "@green-tea/jwt",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"license": "MIT", "license": "MIT",
"exports": "./src/index.ts", "exports": "./src/index.ts",
"imports": { "imports": {
"@green-tea/core": "npm:@green-tea/core@^26.11.0-rc.2", "@green-tea/core": "npm:@green-tea/core@26.9.0-beta.2",
"jose": "npm:jose@^6.2.12" "jose": "npm:jose@^6.2.12"
}, },
"publish": { "publish": {
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@green-tea/jwt", "name": "@green-tea/jwt",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"private": true, "private": true,
"description": "Loads JWT signing keys at boot and publishes a sign/verify registry into the green-tea graph.", "description": "Loads JWT signing keys at boot and publishes a sign/verify registry into the green-tea graph.",
"license": "MIT", "license": "MIT",
@@ -20,6 +20,6 @@
"jose": "^6.2.12" "jose": "^6.2.12"
}, },
"devDependencies": { "devDependencies": {
"@green-tea/core": "26.11.0-rc.2" "@green-tea/core": "26.9.0-beta.2"
} }
} }
-14
View File
@@ -1,18 +1,5 @@
# Changelog # Changelog
## [Unreleased]
## [26.11.0-rc.2] - 2026-11-23
### Changed
- **Versions track core.** This release is 26.11.0-rc.2, the core it is tested against.
- **Core is a range, `^26.11.0-rc.2`, not an exact `26.9.0-beta.2`.** JSR consumers resolve the
`@green-tea/core` import in `deno.json`, and the exact pin gave an application on a newer core a
second, older copy whose types `tsc` could pick up. The range starts at the core the tests run
against (26.11.0-rc.2, which fixes nine security advisories reported against rc.1) and stops at
the next year, the only core release that may break.
## [26.9.0-beta.0] - 2026-09-23 ## [26.9.0-beta.0] - 2026-09-23
### Added ### Added
@@ -22,5 +9,4 @@
bounded `route` rather than on the caller-controlled `name`. `prometheus` is a `TransformerFn` for bounded `route` rather than on the caller-controlled `name`. `prometheus` is a `TransformerFn` for
serving `render()` from a route the application owns. Closes green-tea#68. serving `render()` from a route the application owns. Closes green-tea#68.
[26.11.0-rc.2]: https://jsr.io/@green-tea/metrics@26.11.0-rc.2
[26.9.0-beta.0]: https://jsr.io/@green-tea/metrics@26.9.0-beta.0 [26.9.0-beta.0]: https://jsr.io/@green-tea/metrics@26.9.0-beta.0
+2 -2
View File
@@ -1,10 +1,10 @@
{ {
"name": "@green-tea/metrics", "name": "@green-tea/metrics",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"license": "MIT", "license": "MIT",
"exports": "./src/index.ts", "exports": "./src/index.ts",
"imports": { "imports": {
"@green-tea/core": "npm:@green-tea/core@^26.11.0-rc.2" "@green-tea/core": "npm:@green-tea/core@26.9.0-beta.2"
}, },
"publish": { "publish": {
"include": ["src", "README.md", "CHANGELOG.md", "deno.json"] "include": ["src", "README.md", "CHANGELOG.md", "deno.json"]
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@green-tea/metrics", "name": "@green-tea/metrics",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"private": true, "private": true,
"description": "Counts green-tea's lifecycle events and renders them in the Prometheus text format.", "description": "Counts green-tea's lifecycle events and renders them in the Prometheus text format.",
"license": "MIT", "license": "MIT",
@@ -17,6 +17,6 @@
"bun": ">=1.3" "bun": ">=1.3"
}, },
"devDependencies": { "devDependencies": {
"@green-tea/core": "26.11.0-rc.2" "@green-tea/core": "26.9.0-beta.2"
} }
} }
+1 -2
View File
@@ -88,8 +88,7 @@ test('the transformer serves the text format with the content type Prometheus ex
const rendered = prometheus('green_tea_requests_total{route="/x",method="GET",status="200"} 1\n'); const rendered = prometheus('green_tea_requests_total{route="/x",method="GET",status="200"} 1\n');
assert.equal(rendered.status, 200); assert.equal(rendered.status, 200);
// Core RC.1 widens response header values to `string | string[]` (core #113), so a reader narrows. assert.match(rendered.headers!['content-type'], /text\/plain/);
assert.match(String(rendered.headers!['content-type']), /text\/plain/);
assert.match(rendered.body, /green_tea_requests_total/); assert.match(rendered.body, /green_tea_requests_total/);
}); });
-14
View File
@@ -1,18 +1,5 @@
# Changelog # Changelog
## [Unreleased]
## [26.11.0-rc.2] - 2026-11-23
### Changed
- **Versions track core.** This release is 26.11.0-rc.2, the core it is tested against.
- **Core is a range, `^26.11.0-rc.2`, not an exact `26.9.0-beta.2`.** JSR consumers resolve the
`@green-tea/core` import in `deno.json`, and the exact pin gave an application on a newer core a
second, older copy whose types `tsc` could pick up. The range starts at the core the tests run
against (26.11.0-rc.2, which fixes nine security advisories reported against rc.1) and stops at
the next year, the only core release that may break.
## [26.9.0-beta.0] - 2026-09-23 ## [26.9.0-beta.0] - 2026-09-23
### Added ### Added
@@ -22,5 +9,4 @@
`Retry-After`. The default `MemoryStore` sweeps expired windows on an interval and is released by `Retry-After`. The default `MemoryStore` sweeps expired windows on an interval and is released by
the plugin's `onShutdown`. the plugin's `onShutdown`.
[26.11.0-rc.2]: https://jsr.io/@green-tea/rate-limit@26.11.0-rc.2
[26.9.0-beta.0]: https://jsr.io/@green-tea/rate-limit@26.9.0-beta.0 [26.9.0-beta.0]: https://jsr.io/@green-tea/rate-limit@26.9.0-beta.0
+2 -2
View File
@@ -1,10 +1,10 @@
{ {
"name": "@green-tea/rate-limit", "name": "@green-tea/rate-limit",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"license": "MIT", "license": "MIT",
"exports": "./src/index.ts", "exports": "./src/index.ts",
"imports": { "imports": {
"@green-tea/core": "npm:@green-tea/core@^26.11.0-rc.2" "@green-tea/core": "npm:@green-tea/core@26.9.0-beta.2"
}, },
"publish": { "publish": {
"include": ["src", "README.md", "CHANGELOG.md", "deno.json"] "include": ["src", "README.md", "CHANGELOG.md", "deno.json"]
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@green-tea/rate-limit", "name": "@green-tea/rate-limit",
"version": "26.11.0-rc.2", "version": "26.9.0-beta.0",
"private": true, "private": true,
"description": "A per-request rate limiter published into the green-tea graph, with a branded 429 and a swept in-memory store.", "description": "A per-request rate limiter published into the green-tea graph, with a branded 429 and a swept in-memory store.",
"license": "MIT", "license": "MIT",
@@ -17,6 +17,6 @@
"bun": ">=1.3" "bun": ">=1.3"
}, },
"devDependencies": { "devDependencies": {
"@green-tea/core": "26.11.0-rc.2" "@green-tea/core": "26.9.0-beta.2"
} }
} }
+123
View File
@@ -0,0 +1,123 @@
// The default `keyOf` buckets callers by `ctx.ip`, so it is only as good as the address the serving
// path hands it. Node's `listen()` has always filled `ctx.ip` from the socket. `serveDeno` and
// `serveBun` left it as `''` until core #116 (merged in core #117), which put every caller in the
// one `'unknown'` bucket: the first client to reach `max` locked out everybody else.
//
// So this runs over a real socket on each runtime, with the plugin's default `keyOf`, rather than
// through `app.fetch` with a hand-written one — `app.fetch` has no peer, and a custom `keyOf` would
// test the test. Two clients reach one dual-stack listener, one over IPv4 and one over IPv6, which is
// the cheapest way to get two distinct peer addresses on one host.
//
// Against a core without #116 the Deno and Bun runs fail here, on purpose. Node is the control: its
// path never had the bug and must stay green.
import { strict as assert } from 'node:assert';
import { createServer } from 'node:net';
import type { AddressInfo } from 'node:net';
import { test } from 'node:test';
import { createApp, ctx, Get, Module, needs, Route } from '@green-tea/core';
import type { App } from '@green-tea/core';
import { rateLimit } from '../src/index.ts';
import type { RateLimiter } from '../src/index.ts';
@Route('/')
class Probe {
@Get('/probe')
async probe(@needs('rateLimit') limit: RateLimiter, @ctx() context: { ip?: string }) {
await limit('signin');
return { ip: context.ip };
}
}
@Module({ mountpoint: '/', controllers: [Probe] })
class ProbeModule {}
/** A running server, whichever helper started it. */
interface Served {
port: number;
close(): Promise<void>;
}
interface RuntimeGlobals {
Deno?: unknown;
Bun?: unknown;
}
/**
* Serves `app` on `hostname` through the helper this runtime actually uses in production.
*
* The adapters are imported lazily because each one only works on its own runtime. Node takes no
* hostname: `listen(port)` binds the unspecified address, which is dual-stack wherever IPv6 exists.
*/
async function serve(app: App, hostname: string): Promise<Served> {
const globals = globalThis as RuntimeGlobals;
if (globals.Deno) {
const { serveDeno } = await import('@green-tea/core/deno');
const server = await serveDeno(app, { hostname, port: 0, onListen: () => {} });
const { port } = (server as unknown as { addr: { port: number } }).addr;
return { port, close: () => server.close({ timeoutMs: 1_000 }) };
}
if (globals.Bun) {
const { serveBun } = await import('@green-tea/core/bun');
const server = await serveBun(app, { hostname, port: 0 });
return { port: server.port, close: () => server.close({ timeoutMs: 1_000 }) };
}
const server = await app.listen(0);
return { port: (server.address() as AddressInfo).port, close: () => app.close({ timeoutMs: 1_000 }) };
}
/** Whether this host can bind the IPv6 loopback at all; some CI containers cannot. */
function ipv6Available(): Promise<boolean> {
return new Promise((resolve) => {
const probe = createServer();
probe.once('error', () => resolve(false));
probe.listen(0, '::1', () => probe.close(() => resolve(true)));
});
}
test('two peers on different addresses get separate budgets on the real serving path', async (t) => {
// Without IPv6, the fallback is two IPv4 loopback addresses. Every 127/8 address answers on Linux,
// which is what CI runs; macOS configures only 127.0.0.1, so there the fallback cannot connect.
const ipv6 = await ipv6Available();
const [hostname, a, b] = ipv6 ? ['::', '127.0.0.1', '[::1]'] : ['0.0.0.0', '127.0.0.1', '127.0.0.2'];
if (!ipv6) t.diagnostic('no IPv6 loopback: falling back to 127.0.0.1 and 127.0.0.2 (Linux only)');
const app = createApp({
modules: [ProbeModule],
plugins: [rateLimit({ rules: { signin: { windowMs: 60_000, max: 1, message: 'too many' } } })],
});
const server = await serve(app, hostname);
const hit = (host: string) => fetch(`http://${host}:${server.port}/probe`);
try {
const first = await hit(a);
assert.equal(first.status, 200);
const { ip: ipA } = (await first.json()) as { ip?: string };
assert.equal((await hit(a)).status, 429, 'client A was not limited at max: 1');
const other = await hit(b);
const body = (await other.text()) || '(empty body)';
// Checked before B's status so a regression names its cause: an empty `ctx.ip` is what folds both
// clients into one bucket, and the 429 that follows is only its symptom.
assert.ok(ipA, `ctx.ip was empty for client A on this serving path: ${JSON.stringify(ipA)}`);
assert.equal(other.status, 200, `client B shared client A's bucket (ctx.ip ${JSON.stringify(ipA)}): ${body}`);
const { ip: ipB } = JSON.parse(body) as { ip?: string };
assert.ok(ipB, 'ctx.ip was empty for client B');
assert.notEqual(ipA, ipB, 'both clients reported the same ctx.ip');
} finally {
await server.close();
}
});
+2 -5
View File
@@ -76,11 +76,8 @@ for (const dir of packages) {
assert.equal(pkg.peerDependencies?.['@green-tea/core'], undefined, 'core in peerDependencies'); assert.equal(pkg.peerDependencies?.['@green-tea/core'], undefined, 'core in peerDependencies');
}); });
// A range, not a pin (core #73): JSR consumers resolve this import, and an exact version gave an app test(`${dir}: JSR maps the core version npm installs`, () => {
// on a newer core the plugin's older core types. The floor is the version the tests run against; assert.equal(deno.imports?.['@green-tea/core'], `npm:@green-tea/core@${pkg.devDependencies?.['@green-tea/core']}`);
// `^` stops at the next year, the only release that may break (core's versioning policy).
test(`${dir}: JSR maps a core range whose floor is the version npm installs`, () => {
assert.equal(deno.imports?.['@green-tea/core'], `npm:@green-tea/core@^${pkg.devDependencies?.['@green-tea/core']}`);
}); });
test(`${dir}: engines declares runtimes, and only known ones`, () => { test(`${dir}: engines declares runtimes, and only known ones`, () => {