Conversation
🤖 My Senior Dev — Analysis Complete👤 For @kaposke📁 Expert in View your contributor analytics → 📊 2 files reviewed • 4 need attention
🚀 Open Interactive Review →The full interface unlocks features not available in GitHub:
💬 Chat here: 📖 View all 12 personas & slash commandsYou can interact with me by mentioning In PR comments or on any line of code:
Slash commands:
AI Personas (mention to get their perspective):
For the best experience, view this PR on myseniordev.com — includes AI chat, file annotations, and interactive reviews. |
TBonnin
left a comment
There was a problem hiding this comment.
can we add/modify tests to check the new behavior
5d3a9b7 to
dc661e9
Compare
| if (entry.isErr()) { | ||
| return Err(entry.error); | ||
| } | ||
| if (entry.value === null || entry.value.revalidateAfter < now.getTime()) { |
There was a problem hiding this comment.
On the first time trying to get it from the cache, when it doesn't exist yet. Down there it defaults to 0, but ideally we take the hint to revalidate.
Ensure
UsageTrackerrevalidates cache entries on read pathsUpdates
packages/account-usage/lib/usage.tsso thatUsageTracker.getandUsageTracker.getAlltriggerrevalidatewhen cached values are missing or theirrevalidateAftertimestamp is in the past, aligning read-path behavior with the existing logic inincr. Extendspackages/account-usage/lib/usage.integration.test.tswithvispies and fake timers to cover null, stale, invalid, and fresh cache scenarios for bothgetandgetAll, ensuring revalidation is invoked (or not) as expected.Key Changes
• Added conditional revalidation in
UsageTracker.getwhenentry.valueisnullor stale (entry.value.revalidateAfter < now)• Mirrored the same revalidation trigger inside
UsageTracker.getAllfor each metric retrieved• Expanded integration tests to spy on
revalidate, simulate stale windows via fake timers, and assert invocation counts/arguments forget,getAll, andincrflowsAffected Areas
•
packages/account-usage/lib/usage.ts•
packages/account-usage/lib/usage.integration.test.tsThis summary was automatically generated by @propel-code-bot