Skip to content

fix(reliability): keep normalized TTL and rate limits positive - #369

Closed
seonghobae wants to merge 4 commits into
mainfrom
fix/cache-ttl-subunit-006d7
Closed

fix(reliability): keep normalized TTL and rate limits positive#369
seonghobae wants to merge 4 commits into
mainfrom
fix/cache-ttl-subunit-006d7

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Purpose

Advance #84 with a bounded measured-production slice while fixing two normalization defects on current protected main 006d7bccb7f2e8b5a59b517df660888ff9cadafd.

configuredTtlMs() accepted any finite positive value and then floored it, so a sub-unit value such as 0.5 normalized to 0ms and silently disabled OIDC JWKS or installation-id caching. configuredRateLimit() had the same post-validation defect: 0.5 passed the positivity check and then normalized to 0, causing the second request from the same client to be rate-limited even though invalid/non-positive configuration otherwise falls back to the reviewed default. Both boundaries now revalidate after integer normalization.

Test-first lineage

  • e7efa4714c2a5d5f56bb02ee6f764991682cb47e — RED source contract adds configuredTtlMs to the deterministic rule that rejects broad V8 exclusion of owned operational helpers; the exact parent still hid that helper.
  • caa20675553107c992678a3aed760e4824140098 — GREEN extracts configuredTtlMs to measured production source and makes sub-unit normalization fail safe to the reviewed default while preserving floor/cap semantics for valid values.
  • 514b695ee98fd743536e8a2434e08965cc49f1de — RED runtime case proves NOEMA_RATE_LIMIT_PER_MINUTE=0.5 must follow the same safe-default behavior as invalid/non-positive configuration.
  • d5e125f1baa72d696938c2f94a6c871ade89c9d9 — GREEN revalidates the floored rate limit before returning it.

Focused realistic cases cover unset, non-finite, non-positive, sub-unit positive, positive fractional, and over-cap TTL configuration plus absent/invalid/sub-unit/positive-fractional rate-limit behavior and retry guidance.

The exact current direct-main delta is five paths: src/cache-ttl.ts, src/index.ts, test/cache-ttl.test.ts, test/configured-rate-limit-coverage.test.ts, and test/coverage-ignore-operational-helpers.test.ts. src/index.ts adds the cache-TTL import, removes the formerly ignored local TTL helper, and adds only the post-floor positivity guard to the already measured rate-limit configuration helper.

Evidence boundary

No predecessor CI/review/scanner/coverage evidence transfers after the latest source head. Keep Draft until unchanged exact head d5e125f1baa72d696938c2f94a6c871ade89c9d9 receives fresh terminal-success application ci, reviewer-ci, protected-base central Security Scan, exact configured 100% owned-production statements/branches/functions/lines, and zero valid unresolved findings. Pending, queued, skipped, absent, neutral, failed, cancelled, stale, predecessor, status-only, model-only, or rate-limited evidence is non-passing.

No force update, gate weakening, secret/reviewer invention, release/deployment/KPI/legal-rights claim, or credential-core broadening is introduced.

Related: #84.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3144f462-4cbf-46a8-b5cd-43637833f0ff

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae changed the title fix(reliability): keep cache TTL normalization positive fix(reliability): keep normalized TTL and rate limits positive Aug 15, 2026
@seonghobae seonghobae closed this Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant