Skip to content

docs(api): single-source the /usage rate limit and unify cutover caveats - #109

Merged
sre-helmcode merged 1 commit into
mainfrom
feat/usage-docs-followups
Sep 27, 2026
Merged

sre-helmcode merged 1 commit into
mainfrom
feat/usage-docs-followups

Conversation

@sre-helmcode

Copy link
Copy Markdown
Contributor

Tracking issue

#102 (follow-ups of the shipped /v1/usage docs)

Summary

  • The /usage budget (30 requests per minute per member) now has a single source: USAGE_REQUESTS_PER_MINUTE in rateLimits.ts (mirroring the cloud-api keyedLimiter value), rendered into info.description through a new {{USAGE_RATE_LIMIT}} placeholder — same mechanism as {{RATE_LIMITS}}; rendered text byte-identical.
  • All four api_requests descriptions use the exact same cutover sentence; the caveat test asserts the full sentence on every schema.
  • The /usage endpoint description and its 429 stay static (the contract) and are now pinned by test against the shared constant.

Changes

File Change
src/lib/rateLimits.ts Exported USAGE_REQUESTS_PER_MINUTE = 30 with doc comment
src/lib/apiDoc.ts {{USAGE_RATE_LIMIT}} placeholder resolution in resolveSpec
src/data/openapi.json Placeholder swap in info.description; UsageAllTime.api_requests sentence unified
src/lib/openapiSpec.test.ts 3 new single-source tests; strengthened caveat assertions

Test plan

  • npm test — 66 files / 1308 tests green (RED observed first for all new assertions)
  • npm run build green; canonicalParity + docsNav confirm bot text and navigation unchanged
  • Independently verified: diff limited to the 4 authorized files; rendered output byte-identical

Deploy notes

  • Cloudflare Pages deploys on merge; no config changes.

Follow-ups from the blocking reviews of the /v1/usage docs:

- The usage budget (30 requests per minute per member) now lives once,
  in rateLimits.ts (USAGE_REQUESTS_PER_MINUTE, mirroring the cloud-api
  keyedLimiter value), and reaches info.description through a new
  {{USAGE_RATE_LIMIT}} placeholder resolved in resolveSpec — same
  mechanism as {{RATE_LIMITS}}; rendered text is byte-identical. The
  /usage endpoint description and its 429 stay static (the contract)
  and are pinned by test against the shared constant.
- All four api_requests descriptions now use the exact same cutover
  sentence; the caveat test asserts the full sentence on every schema.

Tests: 3 new single-source tests + strengthened caveat assertions;
vitest 66 files / 1308 tests green; npm run build green.
@sre-helmcode sre-helmcode added the documentation Improvements or additions to documentation label Sep 27, 2026
@sre-helmcode
sre-helmcode merged commit cd34fe6 into main Sep 27, 2026
2 checks passed
@sre-helmcode
sre-helmcode deleted the feat/usage-docs-followups branch September 27, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants