-
Notifications
You must be signed in to change notification settings - Fork 134
fix(actor-kv): fix listing keys #3484
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
base: 11-18-fix_guard_handle_actor_stopped_during_ws_req
Are you sure you want to change the base?
fix(actor-kv): fix listing keys #3484
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Code Review: Fix listing keys in actor-kvOverall, this is a solid PR that addresses a critical bug in the KV list operation. The implementation is well-tested and the fix is logical. StrengthsExcellent Test Coverage
Clear Documentation
Correct Bug Fix
Issues and Concerns1. Potential Bug in Prefix Query (lib.rs:336-354)The prefix query assumes tuple encoding adds a trailing 0 byte: if let Some(&0) = start.last() {
start.pop();
}This assumption should be verified with tests that check the encoded bytes directly. 2. 0xFF Byte HandlingTest acknowledges but doesn't fix the issue where keys with 0xFF bytes may not match prefixes correctly. This should either be:
3. Import Style Violation (lib.rs:3)
4. Test AssertionsCould include actual values in assertion messages for easier debugging. RecommendationsMust fix:
Should fix: Nice to have: This is a good PR that fixes an important bug. After addressing the glob import and clarifying the 0xFF behavior, it will be ready to merge! |
4e7d4d5 to
fa4f976
Compare
Code ReviewSummaryThis PR fixes a critical bug in the actor-kv package's key listing functionality and adds comprehensive test coverage. The changes address issues with prefix queries and list limiting behavior. ✅ Positive Aspects
🐛 Potential IssuesCritical: Prefix Query Logic May Be IncorrectIn let mut start = subspace.pack(&ListKeyWrapper(prefix.key.clone()));
// Remove the trailing 0 byte that tuple encoding adds to strings
if let Some(&0) = start.last() {
start.pop();
}
let mut end = start.clone();
end.push(0xFF);Problem: This assumes tuple encoding always adds a trailing 0 byte, but:
Recommendation:
The test at line 253 in Medium: Comment Inconsistency in entry.rsLine 63 in Ok((&input[0..0], v))This returns an empty slice by taking a zero-length slice from the input. While this works, it's unusual and may be confusing. The comment "Parses key in first position, ignores the rest" doesn't clearly explain why we return an empty remaining slice. Consider adding a comment explaining this is intentional to consume all remaining input. 🔍 Security Considerations
⚡ Performance Considerations
🧪 TestingStrengths:
Suggestions:
📝 Style & Convention NotesPer CLAUDE.md:
🎯 RecommendationsMust Fix Before Merge:
Nice to Have:
Overall AssessmentThis is a high-quality PR that fixes an important bug and adds excellent test coverage. The main concern is the prefix query implementation which needs verification/clarification. Once that's addressed, this should be ready to merge. Approval Status: Approve with minor concerns (pending verification of prefix query logic) Review generated by Claude Code |
Code ReviewOverviewThis PR fixes a critical bug in the actor KV store's list operation where the limit was not being enforced correctly, and adds comprehensive test coverage. The changes are well-structured and address real issues with prefix queries and limit handling. ✅ Strengths
🔍 Issues & ConcernsCritical: Potential Prefix Query BugLocation: engine/packages/actor-kv/src/lib.rs:336-355 The prefix query implementation has concerning logic where it attempts to remove a trailing 0 byte from the packed key. This is problematic because:
Recommendation:
Minor Issues
📊 Summary
Overall: Approve with recommendations. The core bug fix is correct and the test coverage is excellent. However, the prefix query implementation should be reviewed carefully before merging. |

No description provided.