Subject: [Jmap] Re: GroupedAddresses suggests grouping consecutive addresses into own group, is this correct?
From: "Neil Jenkins" <[email-masked]>
To: "IETF JMAP Mailing List" <[email-masked]>
Date: Tue, 20 May 2025 14:10:02 +1000
List-Id: JSON Message Access Protocol <jmap.ietf.org>

On Tue, 20 May 2025, at 06:19, Craven wrote:
> RFC8621 holds the following statement:
> "Consecutive "mailbox" values that are not part of a group are still collected under an EmailAddressGroup object to provide a uniform type."
> 
> IIUC this means that after parsing both "To: <[email-masked]>, group: <[email-masked]>;, <[email-masked]>" and "To: <[email-masked]>, <[email-masked]>, group: <[email-masked]>;" this will result in two parse trees that are not simply a reordering of each other.

That's right. Just to confirm we're on the same page:
To: <[email-masked]>, group: <[email-masked]>; <[email-masked]>
would be parsed as:
[
 { "name": null, "addresses": [
   { "name": null "email": "[email-masked]" }
 ]},
 { "name": "group", "addresses": [
   { "name": null "email": "[email-masked]" }
 ]},
 { "name": null, "addresses": [
   { "name": null "email": "[email-masked]" }
 ]}
]
while 
To: <[email-masked]>, <[email-masked]>, group: <[email-masked]>;
would be parsed as:
[
 { "name": null, "addresses": [
   { "name": null "email": "[email-masked]" },
   { "name": null "email": "[email-masked]" }
 ]},
 { "name": "group", "addresses": [
   { "name": null "email": "[email-masked]" }
 ]}
]

> This is surprising because the text makes reference to RFC5322 for which the parse trees as addr-list would be equivalent up to reordering. 

Again, just to make sure we're on the same page, the relevant bits of ABNF:
address-list    =   (address *("," address)) / obs-addr-list
address         =   mailbox / group

So you would end up with `[mailbox, group, mailbox]`  for the first example, and `[group, mailbox, mailbox]`  for the second.

> Interpreting the addr-list as suggested by RFC8621 goes from being equivalent up to ordering to non-equivalent under reordering. Is this intended?

Yes. I mean, as stated in RFC8621, it deliberately wraps the `mailbox`  entries in the same group structure so you have a uniform type, but you can see from the `null` group name that these were originally just bare `mailbox`es if you want to decompose again for some reason.

Cheers,
Neil.