Skip to content

Conversation

@insipx
Copy link
Contributor

@insipx insipx commented Dec 10, 2025

related to #2790

@insipx
Copy link
Contributor Author

insipx commented Dec 10, 2025

@claude
Copy link

claude bot commented Dec 10, 2025

Claude finished @insipx's task —— View job


Code Review Complete

Reviewed on: December 15, 2025 at 20:17 UTC

Overall, this is a well-implemented stream utility with good test coverage. The code is clean and follows Rust best practices. Here are a few observations:

Code Quality ✓

  • Clean abstraction using pin_project_lite for proper pinning
  • Good use of existing traits (TryStream, Paged)
  • Proper error propagation with generic S::Error: From<EnvelopeError>

Minor Issues

  1. Typo in documentation (xmtp_api_d14n/src/queries/stream/flattened.rs:16)

    • "whos" should be "whose" (appears twice: lines 16 and 21)
  2. Documentation clarity (xmtp_api_d14n/src/queries/stream/flattened.rs:1)

    • Module-level doc says "whos items" - should be "whose items"
  3. Test coverage gap (xmtp_api_d14n/src/queries/stream/flattened.rs:82-128)

    • The test only covers the happy path. Consider adding:
      • A test case with error propagation to verify S::Error handling
      • A test with an empty stream
      • A test with empty Vec items from Paged::messages()

Performance ✓

No concerns - the implementation efficiently wraps the inner stream with minimal overhead using map_ok.

Security ✓

No concerns - straightforward stream transformation with no unsafe code.


@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Dec 10, 2025

Add flattened stream adapter and de-duplicate orphan handling by switching InMemoryCursorStore.icebox to HashSet

Introduce FlattenedStream with flattened() to yield paged message batches, change InMemoryCursorStore.icebox to HashSet<OrphanedEnvelope> with recursive child resolution, and define stable Eq/Hash for OrphanedEnvelope that ignore payload bytes. Update ordering tests and minor display/iterator utilities. See xmtp_api_d14n/src/queries/stream/flattened.rs and xmtp_api_d14n/src/protocol/in_memory_cursor_store.rs.

📍Where to Start

Start with the Stream impl for FlattenedStream in xmtp_api_d14n/src/queries/stream/flattened.rs, then review InMemoryCursorStore changes and resolve_children_inner in xmtp_api_d14n/src/protocol/in_memory_cursor_store.rs.


Macroscope summarized 1340914.

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 93.93939% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.77%. Comparing base (7f5684f) to head (1340914).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
..._api_d14n/src/protocol/utils/test/test_envelope.rs 76.47% 8 Missing ⚠️
xmtp_api_d14n/src/protocol/order.rs 96.96% 3 Missing ⚠️
xmtp_api_d14n/src/queries/stream/flattened.rs 93.47% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2931      +/-   ##
==========================================
+ Coverage   73.59%   73.77%   +0.18%     
==========================================
  Files         405      406       +1     
  Lines       51710    51929     +219     
==========================================
+ Hits        38057    38312     +255     
+ Misses      13653    13617      -36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@insipx insipx force-pushed the insipx/paged-stream branch from 4e9d006 to 46e175d Compare December 10, 2025 18:45
@insipx insipx force-pushed the insipx/seal-cursor branch from 2e74327 to b01135d Compare December 10, 2025 19:42
@insipx insipx force-pushed the insipx/paged-stream branch 3 times, most recently from 95a95c7 to a8ba978 Compare December 10, 2025 20:12
@insipx insipx force-pushed the insipx/seal-cursor branch 2 times, most recently from 559757c to 5ba7ec8 Compare December 10, 2025 20:19
@insipx insipx force-pushed the insipx/paged-stream branch from a8ba978 to 0cc1b60 Compare December 10, 2025 20:19
@insipx insipx force-pushed the insipx/seal-cursor branch from 5ba7ec8 to ccc6ba0 Compare December 10, 2025 20:35
@insipx insipx force-pushed the insipx/paged-stream branch from 0cc1b60 to 344c1e7 Compare December 10, 2025 20:35
@insipx insipx force-pushed the insipx/seal-cursor branch from ccc6ba0 to b45f5b4 Compare December 10, 2025 20:37
@insipx insipx force-pushed the insipx/paged-stream branch 2 times, most recently from 306a2ad to 5fa8828 Compare December 10, 2025 20:38
@insipx insipx force-pushed the insipx/seal-cursor branch 2 times, most recently from 8018725 to 419a3b5 Compare December 10, 2025 20:56
@insipx insipx force-pushed the insipx/paged-stream branch from fde3fb2 to add22c2 Compare December 11, 2025 19:43
@insipx insipx force-pushed the insipx/seal-cursor branch 2 times, most recently from c61636b to 5f7751f Compare December 11, 2025 19:46
Base automatically changed from insipx/seal-cursor to main December 11, 2025 20:10
@insipx insipx force-pushed the insipx/paged-stream branch from add22c2 to 50803e3 Compare December 11, 2025 20:42
@insipx insipx changed the base branch from main to insipx/test-ordering December 11, 2025 20:43
@insipx insipx force-pushed the insipx/paged-stream branch from 50803e3 to 8c483c4 Compare December 11, 2025 21:02
@insipx insipx force-pushed the insipx/test-ordering branch from 13e19c2 to 7eec7fa Compare December 11, 2025 21:02
@insipx insipx force-pushed the insipx/test-ordering branch from 7eec7fa to 93c4fb2 Compare December 15, 2025 17:18
@insipx insipx force-pushed the insipx/paged-stream branch from 8c483c4 to 77f864f Compare December 15, 2025 17:18
@insipx insipx force-pushed the insipx/paged-stream branch from 77f864f to 63b60a9 Compare December 15, 2025 17:53
@insipx insipx force-pushed the insipx/test-ordering branch 2 times, most recently from 00361b4 to ecdd510 Compare December 15, 2025 19:08
@insipx insipx force-pushed the insipx/paged-stream branch from 63b60a9 to 501ea00 Compare December 15, 2025 19:08
@insipx insipx force-pushed the insipx/test-ordering branch from ecdd510 to 74be9b4 Compare December 15, 2025 19:27
@insipx insipx force-pushed the insipx/paged-stream branch from 501ea00 to 786d35a Compare December 15, 2025 19:27
@insipx insipx force-pushed the insipx/test-ordering branch from 74be9b4 to 7d5e9ae Compare December 15, 2025 19:27
@insipx insipx force-pushed the insipx/paged-stream branch from 786d35a to 98a9a23 Compare December 15, 2025 19:27
@insipx insipx force-pushed the insipx/test-ordering branch from 7d5e9ae to d9096ee Compare December 15, 2025 19:27
@insipx insipx force-pushed the insipx/paged-stream branch from 98a9a23 to 62346bb Compare December 15, 2025 19:27
@insipx insipx force-pushed the insipx/test-ordering branch from d9096ee to 92a59ae Compare December 15, 2025 20:15
@insipx insipx force-pushed the insipx/paged-stream branch from 62346bb to 1340914 Compare December 15, 2025 20:15
Base automatically changed from insipx/test-ordering to main December 15, 2025 20:27
@insipx insipx merged commit c2ea3b8 into main Dec 15, 2025
28 checks passed
@insipx insipx deleted the insipx/paged-stream branch December 15, 2025 20:49
rygine pushed a commit that referenced this pull request Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants