Skip to content

feat: better AppDataUpdate processing API - #2092

Merged
raphaelrobert merged 8 commits into
mainfrom
raphael/better-appdata-processing
Jul 8, 2026
Merged

raphaelrobert merged 8 commits into
mainfrom
raphael/better-appdata-processing

Conversation

@raphaelrobert

Copy link
Copy Markdown
Member

This PR aligns the API introduced in #1930 with the rest of the processing API.

Before: processing a commit with AppDataUpdate proposals required a special three-step flow, separate from the normal process_message path:

  // Unprotect only — returns an UnverifiedMessage (signature NOT yet checked)
  let unverified = group.unprotect_message(provider, message)?;

  // Manually inspect raw proposals: validate each one yourself,
  // resolve by-reference proposals from the proposal store yourself
  for p in unverified.committed_proposals().unwrap() { /* validate, resolve, interpret */ }

  // Finish with the special processing function
  let processed = group.process_unverified_message_with_app_data_updates(
      provider, unverified, updater.changes())?;

Calling process_message on such a commit failed at runtime with FoundAppDataUpdateProposal only if the proposals were inline, by-reference ones slipped past and failed later with a confusing staging error.

After: there is only process_message. When a commit covers AppDataUpdate proposals, it returns a new ProcessedMessageContent variant instead of erroring:

  let processed = group.process_message(provider, message)?;

  if let ProcessedMessageContent::UnresolvedAppDataCommit(unresolved) = processed.into_content() {
      // Signature already verified; references already resolved; sorted by component id
      let mut updater = group.app_data_dictionary_updater();
      for proposal in unresolved.app_data_update_proposals() { /* interpret the diff */ }
      let updates = updater.changes();

      let staged = group.stage_app_data_commit(provider, *unresolved, updates)?;
      group.merge_staged_commit(provider, staged)?;
  }

A nice side-effect is that this requires less code.

@github-actions github-actions Bot added the size/l label Jul 2, 2026
@github-actions github-actions Bot added size/xl and removed size/l labels Jul 2, 2026
@raphaelrobert
raphaelrobert marked this pull request as ready for review July 2, 2026 10:07
@raphaelrobert
raphaelrobert requested a review from a team as a code owner July 2, 2026 10:07

@keks keks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks a lot better than what we had before! I have one question, but it's not super important.

@raphaelrobert
raphaelrobert merged commit 6b743b8 into main Jul 8, 2026
41 checks passed
@raphaelrobert
raphaelrobert deleted the raphael/better-appdata-processing branch July 8, 2026 14:54
kkohbrok added a commit that referenced this pull request Jul 8, 2026
Based on #2092. Adds the same pattern of AppDataUpdate processing for PublicGroups.
dukeh3 pushed a commit to DarkWebDivingClub/openmls that referenced this pull request Jul 18, 2026
Based on openmls#2092. Adds the same pattern of AppDataUpdate processing for PublicGroups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants