-
Notifications
You must be signed in to change notification settings - Fork 74
xmtp_db: query to find last commit in a group from payload hash #2843
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
Conversation
|
This PR is part of a stack of 3 bookmarks:
Created with jj-stack |
How to use the Graphite Merge QueueAdd the label mergequeue 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. |
a8c6d99 to
8fa0624
Compare
8fa0624 to
157f868
Compare
|
Claude finished @insipx's task —— View job Code Review — December 1, 2025, 15:05 UTCReviewed the dependency query implementation in Critical Issues1. Error handling logic issue (xmtp_db/src/encrypted_store/group_intent.rs:558-571) The code checks if d.len() > 1 {
return Err(GroupIntentError::MoreThanOneDependency { ... });
}
let dep = d.pop().ok_or_else(|| GroupIntentError::NoDependencyFound { ... })?;If
2. RetryableError semantics incorrect (xmtp_db/src/encrypted_store/group_intent/error.rs:23-30) Both
These should return Performance & Correctness3. Missing empty input guard (xmtp_db/src/encrypted_store/group_intent.rs:525) Already flagged by Macroscope but worth emphasizing: empty if payload_hashes.is_empty() {
return Ok(HashMap::new());
}Code Quality4. Documentation inconsistency (xmtp_db/src/encrypted_store/group_intent.rs:512) Comment says "Returns a map from payload hash to a vector of dependencies" but signature returns 5. CursorList Display without delimiter (xmtp_proto/src/types/cursor_list.rs:34-40) Multiple cursors will be concatenated without separation: write!(f, "{}", self.inner.iter().map(|c| c.to_string()).collect::<Vec<_>>().join(", "))Test CoveragePositive: Test at line 1019 covers the happy path with multiple payload hashes. Missing coverage (per codecov):
Minor6. Type naming (xmtp_db/src/encrypted_store/group_intent/types.rs:21)
Summary
The SQL query implementation is efficient and well-structured. Main concerns are around error handling semantics and edge case handling. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2843 +/- ##
==========================================
- Coverage 73.95% 73.93% -0.02%
==========================================
Files 387 390 +3
Lines 49681 49841 +160
==========================================
+ Hits 36741 36851 +110
- Misses 12940 12990 +50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
03917e5 to
344089e
Compare
344089e to
f415cf8
Compare
f415cf8 to
5713910
Compare
5713910 to
a139392
Compare
| use super::schema::refresh_state; | ||
| use crate::encrypted_store::refresh_state::EntityKind; | ||
|
|
||
| let hashes = payload_hashes |
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.
Empty payload_hashes leads to eq_any([]) → IN () on SQLite, causing a runtime error. Consider returning an empty map early when payload_hashes is empty.
+ if payload_hashes.is_empty() {
+ return Ok(HashMap::new());
+ }
🚀 Reply to ask Macroscope to explain or update this suggestion.
👍 Helpful? React to give us feedback.
Add
xmtp_db::group_intent::QueryGroupIntent::find_dependant_commitsto query the last commit in a group by payload hashIntroduce dependency resolution for intent payload hashes in
xmtp_db, addGroupIntentErrorandIntentDependency, updateStorageErrorto wrap group intent errors, and rename WASM text encode/decode exports.📍Where to Start
Start with the
find_dependant_commitsimplementation in group_intent.rs, then review error types in error.rs and dependency structs in types.rs.📊 Macroscope summarized a139392. 7 files reviewed, 3 issues evaluated, 2 issues filtered, 1 comment posted
🗂️ Filtered Issues
xmtp_db/src/encrypted_store/group_intent.rs — 1 comment posted, 3 evaluated, 2 filtered
Result<HashMap<PayloadHash, IntentDependency>, StorageError>and collapses multiple dependencies by erroring ond.len() > 1. This contradicts the stated behavior and creates uncertainty about the intended contract. [ Low confidence ]into_iter().map(...), never checking which inputpayload_hasheshad no dependency. Therefore some inputs may not reach a defined outcome (neither a returned dependency nor an explicit error), violating the function’s stated intent to find dependencies for each payload hash. [ Already posted ]