Skip to content

fix(reliability): restack positive TTL and rate-limit normalization on 28af0b - #380

Merged
seonghobae merged 2 commits into
mainfrom
fix/cache-ttl-rate-limit-restack-28af0b
Aug 15, 2026
Merged

fix(reliability): restack positive TTL and rate-limit normalization on 28af0b#380
seonghobae merged 2 commits into
mainfrom
fix/cache-ttl-rate-limit-restack-28af0b

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Purpose

Rebuild the unique reliability delta from #375 directly on protected main 28af0b1c2e76d066a5d41ef1da56157209c89431 after #373 advanced protected truth. No predecessor checks, reviews, scanner results, or coverage evidence transfer.

configuredTtlMs() and configuredRateLimit() must stay positive after integer normalization. Positive sub-unit configuration such as 0.5 previously passed the pre-floor positivity check and could normalize to zero, disabling cache effectiveness or causing the second client request to rate-limit immediately. This keeps the reviewed floor/cap behavior while falling back safely when normalization is non-positive.

Test-first lineage

  • a68360c303f58dfe97f49c489cb2d911025c2727 — RED: realistic TTL/rate-limit cases plus coverage-exclusion guard are installed before the source change.
  • 4f819f0feee3d8da9029bfea71da6be132df266d — GREEN current exact head: bounded positive TTL helper and fail-safe normalized rate limit.

Fresh compare against protected main is exactly two commits ahead, zero behind, changing only 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.

Evidence boundary

Focused 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. This change does not establish release, deployment, production KPI, revenue, legal-rights, or acquisition evidence.

Do not merge until unchanged exact head 4f819f0feee3d8da9029bfea71da6be132df266d has fresh terminal-success application ci, reviewer-ci, eligible protected-base central Security Scan, exact configured 100% owned-production statement/branch/function/line coverage, 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, self-approval, gate weakening, reviewer/secret invention, repair/self-modifying workflow, credential-core broadening, release, or deployment is introduced.

Related: #84. Supersedes #375 and #369.

Summary by CodeRabbit

  • 개선 사항

    • 캐시 TTL 설정값을 더 안정적으로 처리합니다.
    • 잘못되거나 지나치게 작은 값은 기본값으로 대체합니다.
    • 유효한 TTL은 초 단위로 내림 처리하고 최대 허용값을 적용합니다.
    • Rate Limit 설정의 소수 및 유효하지 않은 값은 안전한 기본값으로 처리됩니다.
  • 테스트

    • 캐시 TTL 및 Rate Limit 설정값 검증 범위를 확대했습니다.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 548a355a-f63a-4e60-8687-8a9864ae7f3a

📥 Commits

Reviewing files that changed from the base of the PR and between 28af0b1 and 4f819f0.

📒 Files selected for processing (5)
  • src/cache-ttl.ts
  • src/index.ts
  • test/cache-ttl.test.ts
  • test/configured-rate-limit-coverage.test.ts
  • test/coverage-ignore-operational-helpers.test.ts

📝 Walkthrough

Walkthrough

TTL 계산을 별도 함수로 분리했습니다. TTL과 rate limit 설정값의 유효성 검증을 강화했습니다. 관련 단위 테스트와 커버리지 검사 대상을 갱신했습니다.

Changes

설정값 정규화

Layer / File(s) Summary
TTL 정규화 및 연동
src/cache-ttl.ts, src/index.ts, test/cache-ttl.test.ts, test/coverage-ignore-operational-helpers.test.ts
configuredTtlMs가 TTL을 검증하고 내림 및 최대값 제한을 적용한 뒤 밀리초로 반환합니다. src/index.ts는 새 함수를 사용합니다. TTL 정규화 테스트와 커버리지 검사 대상을 추가했습니다.
Rate limit 유효성 검증
src/index.ts, test/configured-rate-limit-coverage.test.ts
내림한 rate limit이 0 이하이면 기본값 60을 반환합니다. 0.5 입력에 대한 fallback 검증을 추가했습니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 4f819

The change safely normalizes positive TTL and rate-limit settings while preserving bounded fallback behavior; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 TTL 및 rate-limit 정규화를 양수로 유지하는 주요 변경 사항을 명확하게 설명합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cache-ttl-rate-limit-restack-28af0b

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 merged commit c9cf4c4 into main Aug 15, 2026
16 checks passed
@seonghobae
seonghobae deleted the fix/cache-ttl-rate-limit-restack-28af0b branch August 15, 2026 16:01
seonghobae added a commit that referenced this pull request Aug 15, 2026
seonghobae added a commit that referenced this pull request Aug 15, 2026
seonghobae added a commit that referenced this pull request Aug 15, 2026
seonghobae added a commit that referenced this pull request 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