Update metadata spec - #613
Conversation
The errata section at the bottom lists all normative changes. Additionally, the specification was rearranged and copyedited to flow more nicely when read from top-to-bottom. It should (hopefully) be possible to now follow the specification without needing to jump around, and all concepts are (hopefully) introduced before being used in the specification. Some examples were moved inline to help illustrate, although the rather large examples section at the end was maintained in case it was helpful.
- Move CAP to draft/metadata-3 - Add missing change entry that empty values are no longer permitted and are treated as unsetting the key in the Errata list (this was the case in the original version of this PR but was omitted from the Errata listing) - Fix incorrect example citing a `SYNC` target of `*` instead of `*ALL` - Further clarify which CAP tokens should be treated as unlimited if missing from CAP LS 302
| METADATA <Target> SET <Key> [:<Value>] | ||
|
|
||
| If the key is invalid, the server responsds with `FAIL METADATA KEY_INVALID` and fails the request. | ||
| This subcommand sets the key on the target to the given value. If the Value parameter is omitted or is an empty string, the key is removed. If the request is successful, the server carries out the requested change and responds with one `761 RPL_KEYVALUE` event, representing the new value if any, or `766 RPL_KEYNOTSET` if no value is set. This new value MAY differ from the one sent by the client. |
There was a problem hiding this comment.
I get the case for disallowing the empty value, but then what's the case for accepting it here and treating it as a deletion, instead of rejecting it with a FAIL? It seems like a bit of a footgun.
There was a problem hiding this comment.
I originally was going the other direction: making the value param mandatory instead of having the number of parameters vary based on set vs delete. I ended up keeping the syntax as-is for backwards compatibility because I didn't feel there was a strong enough reason to break it.
The advantage of allowing empty string = delete is that it makes it simpler client-side to delete a key. They can just "stupidly" append the key value to "METADATA foo SET key :" and it'll Just Work(tm). No need to detect deletion client-side and send it on the wire in any special format.
- The LIMIT_REACHED FAIL code has gained a new parameter to indicate the subcommand for which the limit was reached, allowing clients to statelessly track whether the limit was reached for SUB vs SET - The RATE_LIMITED FAIL code was removed and the ERR_METADATARATELIMIT error numeric (775) was reintroduced to indicate commands are rate-limited; this allows clients to retry the command without needing stateful tracking as the numeric can pass a useful trailing parameter while standard reply trailing parameters must be for human consumption - RPL_METADATASYNCLATER was renamed to ERR_METADATASYNCLATER; unlike the changes above this is not a breaking change but rather reflects that the command was not successfully executed - Examples were updated to match the changes above
|
FAIL METADATA LIMIT_REACHED isn't documented in METADATA SET subcommand section. I'm not going to block it but for the record, as mentioned in IRC, I would still prefer TOO_MANY_SUBS retained for SUB and LIMIT_REACHED dedicated for SET. The overloaded meaning of the I understand the stylistic desire to abstract these two similar seeming error codes, but I disagree that this is an elegant solution. |
Document LIMIT_REACHED for METADATA SET. Additionally, remove the note about clients deduplicating SYNCLATER in the normative section on postponed synchronization and instead add a paragraph to the non-normative client implementation considerations that matches the original intent of the note (doing a single METADATA *ALL SYNC after automatic joins instead of individual channel syncs). Finally, rework how inline examples are handled so it can render better on the ircv3.net website.
The errata section at the bottom lists all normative changes. Additionally, the specification was rearranged and copyedited to flow more nicely when read from top-to-bottom. It should (hopefully) be possible to now follow the specification without needing to jump around, and all concepts are (hopefully) introduced before being used in the specification. Some examples were moved inline to help illustrate, although the rather large examples section at the end was maintained in case it was helpful.
Addresses issues and discussion from #588
Summary of changes between earlier versions of this PR and the current version
LIMIT_REACHEDFAIL code has gained a new parameter to indicate the subcommand for which the limit was reached, allowing clients to statelessly track whether the limit was reached for SUB vs SETRATE_LIMITEDFAIL code was removed and theERR_METADATARATELIMITerror numeric (775) was reintroduced to indicate commands are rate-limited; this allows clients to retry the command without needing stateful tracking as the numeric can pass a useful trailing parameter while standard reply trailing parameters must be for human consumptionRPL_METADATASYNCLATERwas renamed toERR_METADATASYNCLATER; unlike the changes above this is not a breaking change but rather reflects that the command was not successfully executedSummary of changes between
draft/metadata-2and this PRStandard Replies
WARNandNOTEwhen and where appropriate.FAILis reserved for when the entire command cannot proceed due to an error.WARNis used when a portion of a command cannot proceed but other parts may still proceed.NOTEis used when a portion of a command is fully successful but needs ancillary data.SUBCOMMAND_INVALIDstandard reply code has been removed. The more genericINVALID_PARAMScode should be used in its place.KEY_NOT_SETstandard reply code has been removed. With its removal,METADATA SETis fully idempotent with regards to its replies.TOO_MANY_SUBSstandard reply code has been removed. TheLIMIT_REACHEDstandard reply code should be used in its place.VALUE_INVALIDstandard reply code has been renamed toINVALID_VALUEfor better consistency between this specification and other specifications. It additionally now takes a<Key>parameter.KEY_INVALIDstandard reply code has been renamed toINVALID_KEYfor better consistency between this specification and other specifications.The(now removed)RATE_LIMITEDstandard reply code is now specified for every subcommand.INVALID_PARAMSstandard reply code has been added for all other errors withMETADATAcommand parameters.Server Messages / Numerics
METADATAserver message was removed;761 RPL_KEYVALUEand766 RPL_KEYNOTSETare used in all cases to advertise key values or the lack thereof.metadatabatch or774 RPL_METADATASYNCLATERuponJOIN,730 RPL_MONONLINE, or when a client subscribes to a new key post-registration is no longer optional.<RetryAfter>parameter of774 RPL_METADATASYNCLATERandRATE_LIMITEDis no longer optional and must be a non-negative integer.CAP changes
draft/metadata-3.max-key-bytestoken was added to the CAP value to limit the maximum number of bytes a metadata key may consume.before-connecttoken in the CAP value list was clarified to not have its own value and that clients must ignore any value it carries.max-key-bytes,max-value-bytes,max-keys, andmax-subs) are clarified to be unlimited if those tokens are missing from theCAP LS 302response.Other
*ALLtarget has been specified forMETADATA SYNCto synchronize all visible targets.