fix(reliability): keep normalized TTL and rate limits positive - #369
Closed
seonghobae wants to merge 4 commits into
Closed
fix(reliability): keep normalized TTL and rate limits positive#369seonghobae wants to merge 4 commits into
seonghobae wants to merge 4 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Advance #84 with a bounded measured-production slice while fixing two normalization defects on current protected
main006d7bccb7f2e8b5a59b517df660888ff9cadafd.configuredTtlMs()accepted any finite positive value and then floored it, so a sub-unit value such as0.5normalized to0msand silently disabled OIDC JWKS or installation-id caching.configuredRateLimit()had the same post-validation defect:0.5passed the positivity check and then normalized to0, 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 addsconfiguredTtlMsto the deterministic rule that rejects broad V8 exclusion of owned operational helpers; the exact parent still hid that helper.caa20675553107c992678a3aed760e4824140098— GREEN extractsconfiguredTtlMsto 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 provesNOEMA_RATE_LIMIT_PER_MINUTE=0.5must 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, andtest/coverage-ignore-operational-helpers.test.ts.src/index.tsadds 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
d5e125f1baa72d696938c2f94a6c871ade89c9d9receives fresh terminal-success applicationci,reviewer-ci, protected-base centralSecurity 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.