edit message core functionality#3344
Conversation
|
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 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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Claude finished @mchenani's task —— View job Code Review CompleteReview Date: March 18, 2026 06:11 UTC SummaryThe edit message implementation is generally well-designed with strong authorization, validation, and error handling. The code follows good patterns established in the codebase (similar to delete message functionality). However, there are a few areas that could use attention: Key Findings1. Potential Content Type Validation Issue (Medium Priority)Location: The let edited_type_id = edited_content
.r#type
.as_ref()
.map(|t| t.type_id.as_str()) // Only comparing type_id
.unwrap_or("unknown");
let original_type_str = message.content_type.to_string();
if edited_type_id != original_type_str {
// rejection logic
}The Also seen in: 2. Missing Content Type Validation in
|
ApprovabilityVerdict: Needs human review This PR introduces a new core feature (message editing) with substantial new runtime behavior including authorization logic, network message processing, enrichment, and event streaming. Despite the author owning all files and having strong tenure, new feature capabilities of this scope warrant human review to ensure the design aligns with product requirements. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## mc/edit-message-db #3344 +/- ##
======================================================
+ Coverage 82.86% 83.12% +0.25%
======================================================
Files 378 378
Lines 51365 52034 +669
======================================================
+ Hits 42566 43254 +688
+ Misses 8799 8780 -19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

TL;DR
Adds message editing functionality to XMTP MLS groups, allowing users to edit their own messages with proper validation, authorization, and event streaming.
What changed?
EditMessageErrorenum with validation cases (unauthorized, non-editable, deleted message, content type mismatch, empty content)edit_message()method on groups that validates sender authorization, message editability, and content type consistencyprocess_edit_message()for handling incoming edit messages from the network with graceful error handlingStoredMessageEdit,QueryMessageEdit)Editabletrait to mark which content types and message kinds can be edited (text, markdown, replies, attachments are editable; reactions, system messages are not)stream_message_edits()for real-time edit notificationsHow to test?
group.edit_message(message_id, new_content)to edit the messagefind_enriched_messages()with edit metadatastream_message_edits()Why make this change?
Message editing is a core messaging feature that users expect. This implementation ensures:
Note
Add edit message core functionality to MLS groups
MlsGroup::edit_messagein groups/mod.rs to validate, encode, send, and persist message edits, emitting aLocalEvents::MessageEditedevent on success.process_edit_messagein mls_sync.rs to handle incoming edit messages during sync, storing valid edits and ignoring invalid/unauthorized ones without breaking sync.DecodedMessagewith aneditedfield populated byenrich_messagesin enrichment.rs, which validates edits, applies them to replies'in_reply_to, and suppresses edit metadata for deleted messages.stream_message_edits_with_callbackonClientand aMessageEditedvariant onLocalEventsfor real-time edit notifications.EditMessageErrorcovers all failure cases (not authorized, not found, content type mismatch, already deleted, etc.) and are non-retryable.Macroscope summarized ae2387b.