Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for develop-devlovers ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe QA cache time-to-live constant was extended from 30 minutes to 30 days, allowing cached QA entries to persist significantly longer before expiration in the frontend caching layer. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/lib/cache/qa.ts (1)
55-66:⚠️ Potential issue | 🟠 MajorCategory invalidation won’t match versioned keys.
buildQaCacheKeyprefixes keys withqa:${QA_CACHE_VERSION}:…, butinvalidateQaCacheByCategoryscansqa:category:…. This likely leaves cache entries undeleted; with the new 30‑day TTL, stale data can linger much longer.🛠️ Suggested fix
- const prefix = `qa:category:${category.toLowerCase()}:`; + const prefix = `qa:${QA_CACHE_VERSION}:category:${category.toLowerCase()}:`;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/lib/cache/qa.ts` around lines 55 - 66, invalidateQaCacheByCategory is scanning for keys starting with "qa:category:…" but buildQaCacheKey and stored keys include the version prefix (QA_CACHE_VERSION) so the scan misses entries; update invalidateQaCacheByCategory to construct the scan match with the same versioned prefix (e.g. include QA_CACHE_VERSION) or use buildQaCacheKey to derive the prefix (qa:${QA_CACHE_VERSION}:category:${category.toLowerCase()}:) so the redis.scan match targets the exact versioned keys and deleted count correctly removes stale cache entries; keep using getRedisClient and the same scan loop logic.
🧹 Nitpick comments (1)
frontend/lib/cache/qa.ts (1)
4-4: Consider making the 30‑day TTL configurable.
Hardcoding such a long TTL makes operational tuning harder (e.g., during incident response or A/B testing). Prefer an env override with a safe default.♻️ Suggested tweak
-const QA_CACHE_TTL_SECONDS = 60 * 60 * 24 * 30; +const QA_CACHE_TTL_SECONDS = + Number(process.env.QA_CACHE_TTL_SECONDS ?? 60 * 60 * 24 * 30);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/lib/cache/qa.ts` at line 4, Replace the hardcoded QA_CACHE_TTL_SECONDS constant with a configurable value sourced from an environment variable (e.g., QA_CACHE_TTL_SECONDS) and fall back to the current 30-day default if the env var is missing or invalid; update the declaration of QA_CACHE_TTL_SECONDS to parse and validate the env value (using Number/parseInt and a NaN check or safe default) so runtime/ops can override TTL for QA cache without code changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@frontend/lib/cache/qa.ts`:
- Around line 55-66: invalidateQaCacheByCategory is scanning for keys starting
with "qa:category:…" but buildQaCacheKey and stored keys include the version
prefix (QA_CACHE_VERSION) so the scan misses entries; update
invalidateQaCacheByCategory to construct the scan match with the same versioned
prefix (e.g. include QA_CACHE_VERSION) or use buildQaCacheKey to derive the
prefix (qa:${QA_CACHE_VERSION}:category:${category.toLowerCase()}:) so the
redis.scan match targets the exact versioned keys and deleted count correctly
removes stale cache entries; keep using getRedisClient and the same scan loop
logic.
---
Nitpick comments:
In `@frontend/lib/cache/qa.ts`:
- Line 4: Replace the hardcoded QA_CACHE_TTL_SECONDS constant with a
configurable value sourced from an environment variable (e.g.,
QA_CACHE_TTL_SECONDS) and fall back to the current 30-day default if the env var
is missing or invalid; update the declaration of QA_CACHE_TTL_SECONDS to parse
and validate the env value (using Number/parseInt and a NaN check or safe
default) so runtime/ops can override TTL for QA cache without code changes.
Summary by CodeRabbit
Release Notes