2.6 KiB
2.6 KiB
id, epic, title, type, status, feature, depends-on, blocks, created, updated
| id | epic | title | type | status | feature | depends-on | blocks | created | updated | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 03-no-undeclared-rate-limit-eslint-rule | security-headers-rate-limit-sbom | `no-undeclared-rate-limit` ESLint rule | technical-story | done | core-eslint |
|
|
2026-05-20T00:00:00Z | 2026-05-20T08:45:03.170Z |
Goal
Add the no-undeclared-rate-limit ESLint rule (warn severity) that catches rateLimit.consume("X", _) calls where "X" is not declared in the manifest's rateLimit array, and declared budget names that are never consumed in the use-case body — giving AI agents and developers lint-time enforcement of rate-limit drift.
Why
Without a lint rule, an agent could add a consume("foo", ...) call that has no corresponding manifest declaration, or declare a budget that silently goes unused. The ESLint rule closes this gap at the same latency as the existing no-undeclared-audit and no-undeclared-consent-check rules, making the rate-limit channel structurally consistent with the rest of the conformance system.
Done when
packages/core-eslint/rules/no-undeclared-rate-limit.jsis registered at warn severity inplugin.js+base.js.packages/core-eslint/rules/_manifest-ast.jsparser extracts therateLimitfield from a feature manifest.- RuleTester fixtures cover: matching
budgetNamein call and manifest (pass),budgetNamein call absent from manifest (warn), declared budget never consumed in use-case body (warn), non-use-case file (no-op). - Prior-art shape mirrors
no-undeclared-audit.jsandno-undeclared-consent-check.js. pnpm typecheck && pnpm lint && pnpm test && pnpm conformance && pnpm fallow:audit && pnpm coverage:diffall pass.
In scope
no-undeclared-rate-limit.jsrule implementation._manifest-ast.jsextension forrateLimitfield extraction.- Rule registration in
plugin.js+base.jsat warn severity. - RuleTester fixtures (declared/undeclared/unused/non-use-case).
Out of scope
- CLAUDE.md +
conformance-quickref.mdrule-count bump (12 → 13) — Story 11. withRateLimitwrapper — Story 04.- Auth backfill applying the rule — Story 05.
Tasks
- Add
no-undeclared-rate-limitrule inpackages/core-eslint/rules/no-undeclared-rate-limit.js(warn severity); extendpackages/core-eslint/rules/_manifest-ast.jsto extract therateLimitfield; register the rule inplugin.js+base.js; add RuleTester fixtures: declared budget + matching call (pass), undeclared budget name in call (warn), declared budget never consumed (warn), non-use-case file (no-op); all gates pass.