Skip to content

Conversation

@sanny-io
Copy link
Member

@sanny-io sanny-io commented Feb 2, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Strengthened cache configuration validation to accept only positive integers for TTL and SWR, preventing fractional or invalid numeric inputs and ensuring consistent cache behavior.

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

The ttl and swr fields in cacheOptionsSchema were changed from z.number().min(1).optional() to z.int().positive().optional(), enforcing positive integer validation while keeping the fields optional.

Changes

Cohort / File(s) Summary
Schema Validation Tightening
packages/cache/src/schemas.ts
Replaced z.number().min(1).optional() with z.int().positive().optional() for ttl and swr, restricting values to positive integers and updating the public schema API.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing number validation with positive integer validation in the cache schema.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/schema-numbers

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/cache/src/schemas.ts`:
- Around line 4-5: The schema fields ttl and swr currently use
z.int().positive().min(1).optional(), which redundantly applies .min(1) after
.positive(); remove the .min(1) call so both fields read
z.int().positive().optional() (leave .optional() intact) to simplify the
validation in the ttl and swr definitions in the schema.

@sanny-io sanny-io merged commit d6b98de into dev Feb 2, 2026
3 checks passed
@sanny-io sanny-io deleted the fix/schema-numbers branch February 2, 2026 08:00
sanny-io added a commit that referenced this pull request Feb 2, 2026
* fix: swap schema numbers for positive integers (#2)

* fix: swap schema numbers for positive integers

* Remove redundant `min` call.

* chore: update repo configuration (#3)

* chore: add in_progress_fortune option to reviews configuration

* chore: update trigger events for build and test workflow

* chore: add keywords to package.json for better discoverability

* chore: update README badges for NPM downloads and Discord channel

* chore: bump version to 1.0.1 (#4)
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.

2 participants