fix(books): invalidate stale attributed:false cache when wallets become eligible#160
Merged
Merged
Conversation
…me eligible Cache staleness only checked dbCached.attributed === true, so a cached attributed:false result was served forever even after wallets were fixed and became eligible. Add the inverse condition so the cache is treated as stale when wallets are now eligible but the cached result says false. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RjpGP3kYKnQuQAUoK6RZky
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fix(books): Cache staleness check in
buildAgentBooksonly handled the case wheredbCached.attributed === true— a cachedattributed:falseresult was served forever, even after wallets were fixed and became eligible. Added the inverse condition: if the cached result isfalsebut wallets are now eligible, treat the cache as stale and recompute.debug: Temporary
GET /api/admin/debug-books-eligibility?slug=<slug>endpoint — returns raw wallet eligibility data from the DB. Used to diagnose the AEON books issue. Can be deleted after this is confirmed working.Root cause
Every time the books snapshot ran and skipped AEON, it re-saved
attributed:falsetoagent_books_cache. On the next run, the cache was served immediately without recomputation. The fix makesattributed:false+eligibleCount > 0a staleness signal.Post-merge steps
Generated by Claude Code