fix: restore Redis usage timestamps - #741
Conversation
|
Warning Review limit reached
More reviews will be available in 38 minutes and 15 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (11)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
📊 Benchmark Results❌ Some benchmarks failed
Updated: 2026-06-14T21:01:19.295Z · Commit: 56c5f2e |
ee5d952 to
de1f9d2
Compare
Summary
Fixes #705.
RedisUsageStorage.fetchUsageRecords()now restores each usage record timestamp from the Redis sorted-set score instead of substituting the read time. The Redis client contract exposes the existing RedisWITHSCORESpath, and the Upstash adapter maps that tozrange(..., { byScore: true, withScores: true }).변경 사항
UsageRecord.timestampfrom those scores.WITHSCORESresponses as explicit Redis read errors instead of falling back tonew Date().@croco/metering-coreand@croco/metering-upstash.@croco/testingAPI-doc baseline so docs drift checks remain stable.Verification
pnpm --filter @croco/metering-core exec vitest run src/tests/RedisUsageStorage.spec.ts- 23 tests passed.pnpm --filter @croco/metering-upstash exec vitest run src/tests/UpstashRedisClient.spec.ts- 10 tests passed.pnpm --filter @croco/metering-core test- 155 tests passed.pnpm --filter @croco/metering-upstash test- 10 tests passed.pnpm --filter @croco/metering-core typecheck- passed.pnpm --filter @croco/metering-upstash typecheck- passed.pnpm --filter @croco/metering-core build- passed.pnpm --filter @croco/metering-upstash build- passed.pnpm docs:catalog:check- passed.pnpm turbo run docs:build --force && git diff --exit-code -- packages/docs/src/content/docs/api/ && git diff --check- passed.pnpm check- passed.pnpm test- 197/197 tasks successful.pnpm typecheck- 196/196 tasks successful.Self-review
[], and missing scores throwRedisProblem.RedisClient.zrangebyscorekeeps the existing three-argument member-only call and adds the Redis-compatibleWITHSCORESoverload; Upstash implements the new path; no dependencies, secrets, or lockfile entries changed; patch changesets cover the publishable behavior.Risk
Low. No live Redis or Upstash service was run locally; validation uses the repository adapter contract and the installed Upstash SDK implementation/types for the
withScoresoption shape.