-
Notifications
You must be signed in to change notification settings - Fork 74
more information to icebox table #2857
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 12 bookmarks:
Created with jj-stack |
|
Claude finished @insipx's task —— View job PR Review - December 10, 2025 21:27 UTCI've reviewed this PR focusing on areas not already covered by other reviewers. Here are my findings: 🔴 Critical Issues1. Empty Input Handling (xmtp_db/src/encrypted_store/icebox.rs:270-285) The fn ice(&self, orphans: Vec<OrphanedEnvelope>) -> Result<usize, crate::ConnectionError> {
self.raw_query_write(|conn| {
let dependencies = orphans.iter().flat_map(|o| o.deps()).collect::<Vec<_>>();
// Will fail if orphans is empty
let envelopes = diesel::insert_into(dsl::icebox)
.values(orphans.into_iter().map(Icebox::from).collect::<Vec<_>>())
.execute(conn)?;Recommendation: Add early return when
|
9404cc7 to
5a25a04
Compare
f75026a to
e59f976
Compare
5a25a04 to
a637ff8
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2857 +/- ##
==========================================
+ Coverage 73.88% 73.94% +0.06%
==========================================
Files 397 398 +1
Lines 50634 50905 +271
==========================================
+ Hits 37410 37644 +234
- Misses 13224 13261 +37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a637ff8 to
9ef1201
Compare
e59f976 to
05ff62f
Compare
9ef1201 to
5895dcb
Compare
xmtp_db/migrations/2025-11-25-213223-0000_make_icebox_depending_fields_non_null/up.sql
Show resolved
Hide resolved
05ff62f to
30a3f6b
Compare
5895dcb to
40377cf
Compare
40377cf to
25263b8
Compare
25263b8 to
0c31f49
Compare
0c31f49 to
fb4c2e6
Compare
302503e to
3a8a1e7
Compare
4b1f577 to
a955b5b
Compare
xmtp_db/migrations/2025-11-25-213223-0000_make_icebox_depending_fields_non_null/down.sql
Outdated
Show resolved
Hide resolved
xmtp_db/migrations/2025-11-25-213223-0000_make_icebox_depending_fields_non_null/up.sql
Outdated
Show resolved
Hide resolved
a955b5b to
1714b36
Compare
xmtp_db/migrations/2025-11-25-213223-0000_make_icebox_depending_fields_non_null/up.sql
Outdated
Show resolved
Hide resolved
1714b36 to
4d796c8
Compare
| let dep_chain = conn.past_dependants(41, 1)?; | ||
| assert_eq!(dep_chain.len(), 3); | ||
|
|
||
| let dep_chain = Icebox::backward_dep_chain(conn, 41, 1)?; | ||
| assert_eq!(dep_chain, ice); | ||
| assert_eq!(orphans[0].depends_on[&1], 40); | ||
| assert_eq!(orphans[1].depends_on[&2], 39); | ||
| assert_eq!(orphans[2].depends_on[&2], 38); | ||
|
|
||
| let dep_chain = Icebox::forward_dep_chain(conn, 39, 2)?; | ||
| assert_eq!(dep_chain, ice.into_iter().rev().collect::<Vec<_>>()); | ||
| // future_dependants returns only envelopes that depend on (39, 2) | ||
| let mut dep_chain = conn.future_dependants(39, 2)?; |
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.
I would like to see a test where past/future dependents is queried for sequence 40 and returns the proper values as well. These tests could pass by just returning all the rows.
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.
| impl<'a> Extend<(&'a OriginatorId, &'a SequenceId)> for GlobalCursor { | ||
| fn extend<T: IntoIterator<Item = (&'a OriginatorId, &'a SequenceId)>>(&mut self, iter: T) { | ||
| self.inner.extend(iter) | ||
| } | ||
| } | ||
|
|
||
| impl Extend<(OriginatorId, SequenceId)> for GlobalCursor { | ||
| fn extend<T: IntoIterator<Item = (OriginatorId, SequenceId)>>(&mut self, iter: T) { | ||
| self.inner.extend(iter) | ||
| } | ||
| } | ||
|
|
||
| impl Extend<super::Cursor> for GlobalCursor { | ||
| fn extend<T: IntoIterator<Item = super::Cursor>>(&mut self, iter: T) { | ||
| self.inner | ||
| .extend(iter.into_iter().map(|c| (c.originator_id, c.sequence_id))) | ||
| } | ||
| } | ||
|
|
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.
Can these be impl<T: Into<Cursor>> Extend<T> for GlobalCursor ...
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.
worked: 525a0d7
4d796c8 to
9383c61
Compare
9383c61 to
f3f9562
Compare
<!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will post its summary as a comment. --> ### Add more information to the icebox by migrating to a group-scoped schema with multi-dependency support and updating query/insert APIs in `xmtp_db` and `xmtp_proto` Replace single in-row dependency with `icebox_dependencies`, require `group_id` on `icebox`, and add `QueryIcebox` for inserting and querying dependants; apply destructive migrations and update types and schema bindings. #### 📍Where to Start Start with the `QueryIcebox` trait and its `DbConnection` implementation in [icebox.rs](https://github.com/xmtp/libxmtp/pull/2857/files#diff-015edee4b874f40f0db8cdb344e1cd3bccf7d162977a16c5d1a0b740365416d0), then review the schema changes in the migrations in [up.sql](https://github.com/xmtp/libxmtp/pull/2857/files#diff-195fca113b520a99ac76f113de0413ad16c60fae52169c53ce37d21b78e88f2a) and [down.sql](https://github.com/xmtp/libxmtp/pull/2857/files#diff-90cdd5fc2dffcd969887be165293765efd0c1f003e7c99d439d6ee067348127a). ---- <!-- Macroscope's review summary starts here --> <a href="https://app.macroscope.com">Macroscope</a> summarized f3f9562. <!-- Macroscope's review summary ends here --> <!-- macroscope-ui-refresh --> <!-- Macroscope's pull request summary ends here -->
Add more information to the icebox by migrating to a group-scoped schema with multi-dependency support and updating query/insert APIs in
xmtp_dbandxmtp_protoReplace single in-row dependency with
icebox_dependencies, requiregroup_idonicebox, and addQueryIceboxfor inserting and querying dependants; apply destructive migrations and update types and schema bindings.📍Where to Start
Start with the
QueryIceboxtrait and itsDbConnectionimplementation in icebox.rs, then review the schema changes in the migrations in up.sql and down.sql.Macroscope summarized f3f9562.