Repository navigation
Commit b3f3298
fix(plugin-auth): degraded rate-limit warning names the cache registration that boots (#25434)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuACdPWFJTLDcTrByFCHLzqb)_
Fixes #25329
Clause-②: no
Metadata-protocol: none
## What changed
With no `cache` service registered, `createLazyCounterStore`
(plugin-auth `rate-limit-storage.ts`) falls back to a per-process store
and warns once. That warning told a multi-node deployment to use "Redis
via @objectstack/service-cache". `CacheServicePlugin.init` throws when
`adapter: 'redis'` is set ("Redis cache adapter is not yet
implemented"), so an operator who followed the warning got a boot
failure.
The warning now names the path that boots today, and promises no bundled
adapter, so it cannot go stale when one ships:
> a multi-node deployment needs a shared cache — an ICacheService backed
by a store every node reaches, registered as the `cache` service
(ctx.registerService('cache', impl)) — or each node enforces the limit
independently (ADR-0069 D2)
The ADR-0069 D2 reference and the per-caller `degradedImpact` suffix are
unchanged. This is fix option (a) of the card. Option (b), implementing
the Redis adapter in `service-cache`, is not taken here.
Every caller of `createLazyCounterStore` prints this text: better-auth's
rate limit, the per-number OTP send budget, the SMS quotas, and the
runtime's inbound and endpoint limiters.
## Files
- `packages/plugins/plugin-auth/src/rate-limit-storage.ts`: the warning
text.
- `packages/plugins/plugin-auth/src/rate-limit-storage.test.ts`: new
pin. The warning names the `cache` registration, does not name
`@objectstack/service-cache`, does not say Redis, and keeps `(ADR-0069
D2)`.
- `packages/runtime/src/security/inbound-rate-limit.test.ts`: this pin
quoted the old remedy (`/Redis via @objectstack\/service-cache/`). It is
flipped to the new one plus a negative on `@objectstack/service-cache`.
- `packages/plugins/plugin-auth/src/otp-send-guard.ts`: a doc comment
that repeated the same Redis-via-service-cache claim.
- `.changeset/25329-rate-limit-cache-warning-remedy.md`:
`@objectstack/plugin-auth` patch.
Out-of-bounds files were not touched: `auth-manager.ts` and
`packages/spec`. PR #25328 (docs for the same thread) is merged and
edits only `content/docs/api/wire-format.mdx`,
`content/docs/deployment/production-readiness.mdx` and
`docs/HARDENING.md`, so it does not overlap.
## Verification (head ff4e36d)
- Built the closure `@objectstack/runtime^...` plus
`@objectstack/plugin-auth` under the verify lock: VERDICT command-exit
0. `dist/rate-limit-storage.js` carries the new text, and no file in
plugin-auth `dist/` carries the old text.
- `pnpm --filter @objectstack/plugin-auth test`: Test Files 189 passed
(189), Tests 3580 passed, 10 skipped.
- `pnpm --filter @objectstack/plugin-auth typecheck`: exit 0,
check:test-typecheck OK.
- `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2
src/security/inbound-rate-limit.test.ts`: 25/25 passed. Runtime reads
plugin-auth through its `exports`, so this ran against the rebuilt
`dist`.
- `pnpm --filter @objectstack/runtime typecheck`: exit 0.
- Ablation, one time, through `scripts/ablation-replace.mjs`: the src
remedy was put back to "(Redis via @objectstack/service-cache)". The
anchor went 1 to 0 and the blob changed.
`src/rate-limit-storage.test.ts` went red, 1 failed / 19 passed, on the
new `toContain` assertion. The file was then restored, blob equal to
HEAD and `git diff HEAD` empty.
## Acceptance notes
These are not filed here, because they are read-only text drift, not a
reproduced defect at a public door:
- `README.md:415` lists `@objectstack/service-cache` as "Cache —
in-memory and Redis".
- `content/docs/kernel/services-checklist.mdx:522` and `:543` advertise
a Redis adapter in the same package.
- `content/docs/kernel/services.mdx:130` and
`content/docs/kernel/cluster.mdx:720` already say that the Redis adapter
is a skeleton.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_016g7nYP9wdNx1GDa5XDr7Uy
Co-authored-by: Claude <noreply@anthropic.com>1 parent b9c7a8f commit b3f3298
5 files changed
Lines changed: 27 additions & 4 deletions
File tree
- .changeset
- packages
- plugins/plugin-auth/src
- runtime/src/security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
315 | 318 | | |
316 | 319 | | |
317 | 320 | | |
| |||
0 commit comments