Repository navigation
Description
Revised after the review by @maximmaxim345. The proposal is now smaller: it unifies the mechanical rules, and it keeps the difference in the minimum content.
Problem
Three messages carry a state update: client/state, server/state and group/update. Each message gives its own merge rules.
client/state |
server/state |
group/update |
|
|---|---|---|---|
| Merge | the server MUST merge, and keeps absent fields | the client "will merge" | the client "should merge" |
null clears |
not defined | a null leaf clears the field, a null role object clears the role | not defined |
| Merge depth | not defined | shallow, a nested object is replaced in full | not defined |
| First full message | the first message, and the full role state when a role becomes active | the first message for each role, and the first message after the role becomes active again | the first message on a connection |
| Minimum content | MAY send only changed fields, MAY send the full state | "Only include fields that have changed" | "only the changed fields" |
The first four rows are the same procedure with three descriptions. Only the last row is a true difference.
The spec says that the difference is intentional: "The asymmetry with client/state is deliberate". But it does not give the reason.
Change
Give the mechanical rules one time, in the Communication section of messaging.md. Keep the difference in the minimum content, and give the reason for it.
State-carrying messages (
client/state,server/state,group/update) are delta updates. The first message for a scope MUST carry that scope's full state: the initialclient/stateon a connection and a role's full state when it becomes active inactive_roles; the firstserver/statefor a role on a connection and the first after the role is re-added toactive_roles; the firstgroup/updateon a connection. Subsequent messages carry the fields that have changed; the receiver MUST merge each message into existing state, retaining the last value of any absent field. The merge is shallow: a nested object is replaced or cleared as a whole, never deep-merged, so nested objects are always sent complete. Where a field or role object is clearable (typed| null), setting it tonullclears it; a role object set tonullclears all of that role's state. A role's definition MAY defer when a merge is applied (see scheduled updates).Servers SHOULD send only the fields that have changed. Clients MAY instead resend unchanged fields, up to their full state: the server is the more capable side, so a client may keep its implementation simple.
Then each message keeps one sentence and its field list. Remove the note about the intentional difference, because the new rule gives the reason.
The note in server/activate and the note in roles/player/v1.md already point to these rules. Change the anchors only.
Effect on behavior
None. The rule keeps the current minimum-content requirement for each direction.
Open point: the metadata timestamp
@maximmaxim345 found a problem in the first version of this proposal. It permitted the server to resend unchanged fields. That is not safe for the metadata role.
A metadata client calculates the position from the timestamp and the progress of the last message with a progress object. Thus an unchanged progress under a new timestamp moves the calculated position.
The revised rule prevents this, because the server keeps the minimum-content requirement. But PR #135 makes the server resend the fields of a scheduled message. Thus the two rules meet in that case.
Select one solution:
- A resent value keeps its original timestamp.
- The
metadatarole keeps its own rule, because itstimestampgives the fields a different function.
Solution 2 is possibly better, because the problem comes from the role, not from the merge procedure.
Correction to make at the same time
The controller object in server/state has mandatory leaves without the type | null. Thus the general null rule and the schema do not fully agree today. The new rule must say that the field type controls this behavior.
Sequence with PR #135
PR #135 changes the same server/state paragraphs. It adds scheduled updates: a future timestamp delays the merge, a null role object removes a pending update, and the first message for a role must have a past or present timestamp.
These rules apply to one role. They are not merge rules. Thus they stay with server/state and the role files, and they use the sentence "A role's definition MAY defer when a merge is applied".
Merge PR #135 first. Then apply this change on top of it.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
maximmaxim345 commentedon Aug 18, 2026
I think we just have to try this wording change. I'm not fully convinced yet, but if it stays understandable without a pile of per-message exceptions and overriding of the merge rules, it might be for the better.
The rules do slightly differ in a couple of places:
metadatais not idempotent because of the progress calculation: position comes from the timestamp and progress of the last message that includedprogress, so resendingprogressunchanged under a freshtimestampshifts the computed position. If resending unchanged fields becomes allowed, the rule has to say a resent value keeps its original timestamp.metadata/colorroles.balloob commentedon Aug 18, 2026
Your first two points change the proposal. I made it smaller.
The metadata timestamp. You found an error in the first version. That version let the server resend unchanged fields. A metadata client calculates the position from the
timestampand theprogressof the last message with aprogressobject. Thus an unchangedprogressunder a newtimestampmoves the position.The reason for the asymmetry. I did not know it. If the reason is a simple client implementation, the asymmetry is correct, and the spec must give the reason.
Both points have the same solution: unify the mechanical rules only, and keep the minimum-content rule per direction.
The mechanical rules are the merge itself, the null value, the shallow depth, and the first full message. These four are one procedure with three descriptions today.
The minimum content stays different, with your reason in the text:
This also keeps the metadata role safe, because the server keeps the minimum-content rule.
One case stays open. PR #135 makes the server resend the fields of a scheduled message, thus the two rules meet there. Select one solution:
metadatarole keeps its own rule, because itstimestampgives the fields a different function.I prefer 2. The problem comes from the role, not from the merge procedure.
Your third point is in the issue. The rule has the sentence "A role's definition MAY defer when a merge is applied", and PR #135 uses it. Merge #135 first.
Generated by Claude Code
maximmaxim345 commentedon Aug 19, 2026
We need to just simplify the protocol, we just drop diff messages.
Then we don't need this overcomplicated diffing rule.
This also simplifies #135