Repository navigation
feat(bindings_wasm): expose the app data change callback and update guard - #4014
Conversation
|
Claude finished @tylerhawkes's task —— View job Code ReviewReview Date: 2026-08-19T20:38:00Z Overall AssessmentThe implementation is well-designed and follows established patterns in the codebase. The code quality is high, with proper error handling and clear documentation. The changes are additive and opt-in, minimizing risk. Key Observations✅ Strengths:
Minor Observations
Security & Performance
VerdictThis PR is ready to merge. The implementation is solid, follows established patterns, and includes appropriate safeguards. The only enhancement would be adding an integration test for the callback, but the existing test coverage showing no regressions is sufficient for an opt-in feature. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR introduces new user-facing capabilities: app data change callbacks and compare-and-swap guards. It adds new intent states, error types, and callback infrastructure across mobile/wasm/Android SDKs. The scope and complexity of this new feature warrants human review. This assessment was made without Macroscope's correctness findings, which could not be posted. Not approved because:
You can add or adjust custom eligibility rules. Learn more. |
6f021d2 to
b76a2e4
Compare
a92b803 to
5731d8d
Compare
Dismissing prior approval to re-evaluate 5731d8d
b76a2e4 to
ac76516
Compare
5731d8d to
55cefed
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4014 +/- ##
=======================================
Coverage 85.88% 85.88%
=======================================
Files 419 419
Lines 68348 68348
=======================================
Hits 58700 58700
Misses 9648 9648 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
55cefed to
b364f55
Compare
ac76516 to
342b782
Compare
b364f55 to
69ad642
Compare
342b782 to
615d16b
Compare
Dismissing prior approval to re-evaluate 69ad642
615d16b to
bec4f9c
Compare
69ad642 to
a8f796e
Compare
Dismissing prior approval to re-evaluate a8f796e
be58d1c to
1b61a68
Compare
a8f796e to
4de6dfa
Compare
1b61a68 to
c625372
Compare
4de6dfa to
48fc69c
Compare
48fc69c to
d7b4a09
Compare
Dismissing prior approval to re-evaluate d7b4a09
Dismissing prior approval to re-evaluate d7b4a09
Stack
Merge bottom-up — each PR is based on its parent below.
Android is the priority path: #4019 → #4011 → #4012 → #4016.
IntentState::Superseded(base:main)Already merged: #4018 (proto regen). Related follow-up, independent of this stack: #4020.
Exposes the unstable app-data change callback to the wasm bindings.
Shape
AppDataChangeCallbackis anextern "C"JS object with an asynconAppDataChangedmethod — the same pattern asAuthCallbackinclient/gateway_auth.rs.UnstableChangeCallbacksis a#[wasm_bindgen]object with a setter per callback, mirroringBackendBuilder::authCallback, so handlers for the other mutable fields are added as further setters.group_idis hex-encoded on this boundary, matching the rest of the wasm surface.A host callback that rejects is logged and swallowed: the commit is already durable by the time it runs, so there is nothing to roll back, and aborting message processing over a host-side bug would be worse than letting the next change re-trigger the merge.
Registration
A trailing
changeCallbacksparameter oncreateClientandcreateClientWithBackend.browser-sdk is deliberately not wired up here
The browser SDK runs the client inside a Web Worker and passes client options across a structured clone, which cannot carry a function. Exposing this there needs a worker→main reverse-RPC that does not exist yet — today the worker only sends responses and stream events, never requests.
There is also a design question worth settling before building it: the callback is awaited from inside the worker's message-processing loop, so a slow or blocked main thread would stall sync for that client. That trade-off should be decided deliberately rather than inherited. Filed as a follow-up.
Anyone driving
@xmtp/wasm-bindingsdirectly can use this today.🤖 Generated with Claude Code
https://claude.ai/code/session_01AdY7WKkNbJmdzpmUWvW1my
Note
Expose app data change callbacks and guarded update support to WASM, mobile, and Node bindings
AppDataChangeCallbacktrait andUnstableChangeCallbacksregistry in the MLS core so hosts can receive async notifications when groupapp_datachanges after commit.update_app_data: callers can pass anexpected_value; mismatches fail fast locally or surface asAppDataSupersededafter an epoch race.IntentState::SupersededDB state for guarded intents that lose a race, marked non-retryable and distinct fromError.UnstableChangeCallbacksJS class,onAppDataChangedextern), mobile UniFFI (FfiUnstableChangeCallbacks,FfiAppDataChangeCallback), Node (update_app_datapassesNoneguard), and Android SDK (Group.updateAppDatawith optionalexpectedAppData).AppDataChangeCallbackand associated types are marked unstable; delivery semantics and API shape may change.📊 Macroscope summarized d7b4a09. 19 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.