-
Notifications
You must be signed in to change notification settings - Fork 0
Phase 2: Fix WAL dump to use operation log instead of raw cache #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
05e1d38
Fix WAL dump to use operation log instead of raw cache
akeenkarkare 9dccec7
Fix critical DELETE validation and INCREMENT replay bugs
akeenkarkare f5dcd79
Document DELETE validation and INCREMENT replay fixes in plan
akeenkarkare 37d2235
Fix list type conversion to preserve nested types
akeenkarkare 35b0a8b
Document list type conversion fix in plan
akeenkarkare a983600
Add cache debug endpoint and fix duel ID mismatch
akeenkarkare 2b6ce84
Address CodeRabbit review feedback on admin endpoints and WAL dump
akeenkarkare 8abe72b
Fix critical checkpoint skip and race condition bugs in WAL dump
akeenkarkare 5fd690e
Fix INCREMENT double-apply bug by stopping on first failure
akeenkarkare 1cb2a12
Add cache viewer tab to log viewer HTML
akeenkarkare 3b36ff8
Delete CACHE_FIX_PLAN.md
akeenkarkare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Overall WAL replay + checkpoint design looks correct and addresses prior data issues.
Using WAL entries (with
last_applied_sequencecheckpoints) instead of raw cache dumps fixes the original “wrapped cache shapes” bug and makes INCREMENT idempotent across retries. Per-entry stats and only clearing WAL/marking cache synced whentotal_failed == 0are good safety improvements.Once the unknown-op + concurrency edge cases above are addressed, this should be a much more robust foundation for cache persistence.
Also applies to: 288-314
🏁 Script executed:
Length of output: 4560
I need to inspect the full implementation of
dump_cache_to_db()and the code at lines 288–314 to verify the edge cases mentioned in the review.🏁 Script executed:
Length of output: 5478
🏁 Script executed:
Length of output: 6742
I need to check the exception handler and verify concurrency protections in the WAL manager.
🏁 Script executed:
Length of output: 2964
Address silent handling of unknown WAL operation types and add concurrency protection for non-scheduler callers.
The implementation leaves two unresolved edge cases from the review:
Unknown operations silently fail: If a WAL entry has an operation type other than UPDATE, PUT, DELETE, or INCREMENT, the code validates it passes but then skips the DynamoDB call without explicit error handling or warning. The operation silently doesn't increment
total_synced.Concurrency race on non-scheduler callers: While the scheduler job has
max_instances=1,dump_cache_to_db()is also callable from:bounties.py(admin endpoint, line 126)main.pyshutdown handler (line 92)main.pymanual trigger (line 180)Between
wal_manager.get_last_applied_sequence()andwal_manager.get_entries_since(), concurrent calls can read the same checkpoint and fetch identical entries, causing duplicate DynamoDB operations and violating the idempotence assumption.The WALManager itself has proper locking, but
dump_cache_to_db()needs atomic checkpoint + fetch semantics and explicit handling for unknown operation types.🤖 Prompt for AI Agents