feat(chat-list): distinguish whether the local account left or was removed from each group#766
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (16)
WalkthroughThis PR replaces boolean self-membership handling with a ChangesSelfMembership Enum Migration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Ready to review this PR? Stage has broken it down into 6 individual chapters for you: Chapters generated by Stage for commit d44677c on Jun 30, 2026 9:52pm UTC. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
crates/marmot-uniffi/src/conversions/common.rs (1)
8-28: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider deriving
PartialEq/EqonSelfMembershipFfi.The new
self_membership_ffi_preserves_each_varianttest inmod.rsusesmatches!instead ofassert_eq!, likely becauseSelfMembershipFfidoesn't derivePartialEq. Adding it would simplify call-site comparisons (tests and any FFI-consuming Rust code) without any downside.♻️ Proposed derive addition
-#[derive(Clone, Copy, Debug, uniffi::Enum)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, uniffi::Enum)] pub enum SelfMembershipFfi {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/marmot-uniffi/src/conversions/common.rs` around lines 8 - 28, Add PartialEq and Eq to SelfMembershipFfi so Rust callers can compare variants directly instead of relying on matches! in tests like self_membership_ffi_preserves_each_variant. Update the enum declaration in common.rs where SelfMembershipFfi is defined, keeping the existing Clone, Copy, Debug, and uniffi::Enum derives unchanged. This will make equality assertions and other call-site comparisons simpler across the FFI boundary.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/storage-sqlite/src/account_projection.rs`:
- Around line 469-479: `set_group_self_membership` currently updates only
`account_groups`, leaving the denormalized `chat_list_rows.self_membership`
stale. Update the same storage transaction to also write the new membership into
`chat_list_rows` for the matching `group_id_hex`, using the existing
`self.lock()`/`execute` flow so chat list reads stay consistent after
leave/remove changes.
In `@crates/storage-sqlite/src/chat_list.rs`:
- Line 364: The completeness check in chat list synchronization is comparing the
raw self_membership storage values instead of the normalized membership used
elsewhere, so future unknown values can keep rows looking stale. Update the
comparison in the chat list query logic around the membership check to use the
same normalization path as the rest of the code (the membership mapping used by
chat_list_rows/account_groups processing), so both sides compare normalized
Member values before deciding whether a rebuild is needed.
---
Nitpick comments:
In `@crates/marmot-uniffi/src/conversions/common.rs`:
- Around line 8-28: Add PartialEq and Eq to SelfMembershipFfi so Rust callers
can compare variants directly instead of relying on matches! in tests like
self_membership_ffi_preserves_each_variant. Update the enum declaration in
common.rs where SelfMembershipFfi is defined, keeping the existing Clone, Copy,
Debug, and uniffi::Enum derives unchanged. This will make equality assertions
and other call-site comparisons simpler across the FFI boundary.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8d1d2233-20b3-4aa8-872b-d47a24e22bda
📒 Files selected for processing (18)
crates/marmot-app/src/client/mod.rscrates/marmot-app/src/client/sync.rscrates/marmot-app/src/conversions.rscrates/marmot-app/src/groups.rscrates/marmot-app/src/lib.rscrates/marmot-app/src/runtime/tests.rscrates/marmot-app/tests/relay_runtime.rscrates/marmot-uniffi/src/conversions/chat_list.rscrates/marmot-uniffi/src/conversions/common.rscrates/marmot-uniffi/src/conversions/group.rscrates/marmot-uniffi/src/conversions/mod.rscrates/storage-sqlite/src/account_projection.rscrates/storage-sqlite/src/account_projection/tests.rscrates/storage-sqlite/src/chat_list.rscrates/storage-sqlite/src/chat_list/tests.rscrates/storage-sqlite/src/lib.rscrates/storage-sqlite/src/migrations.rscrates/storage-sqlite/src/migrations/0022_chat_list_self_membership.rs
…moved from each group
77432b9 to
d44677c
Compare
Summary by CodeRabbit
New Features
Bug Fixes