UTS: correct presence action wire encoding (issue #526) - #535
Open
owenpearson wants to merge 2 commits into
Open
owenpearson wants to merge 2 commits into
owenpearson wants to merge 2 commits into
Conversation
Fixes assertions in rest_presence.md that mapped wire action 4 to LEAVE; the wire ordinals are ABSENT=0, PRESENT=1, ENTER=2, LEAVE=3, UPDATE=4. Also corrects the accompanying explanatory note. Addresses #526 (Defect 1). Defect 2 (outgoing toJson encoding) is deferred pending a maintainer ruling and is not included here. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ect 2) Under the convention that toJson()/fromJson() operate on the wire body, presence actions are the enum ordinal (protocol.md:332). Corrects the two outgoing toJson() assertions from "enter" to 2, converts nine inbound string-action fixtures to their ordinals, and records the wire-body convention in writing-test-specs.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary (Defect 1)
Corrects incoming presence wire-action decoding in
uts/rest/unit/presence/rest_presence.md. The presenceactionis encoded on the wire as its enum ordinal perspecifications/protocol.md(Presence Message):ABSENT=0, PRESENT=1, ENTER=2, LEAVE=3, UPDATE=4.The file previously fed wire action
4and assertedPresenceAction.leave, contradicting the protocol (and itself — elsewhere it correctly maps4to UPDATE and3to LEAVE). A closing note also falsely claimed the leave/update ordinals are SDK-dependent, which is what invited the error.Changes
rest_presence.md:1379— fixture"action": 4→"action": 3, so thePresenceAction.leaveassertion at:1396is now satisfiable by a conforming SDK.rest_presence.md:435— fixture"action": 4(payload"left") →"action": 3, so the wire value matches the LEAVE payload (no assertion depended on it; corrected for consistency).rest_presence.md:1676-1683— deleted the false "action values may vary by SDK" note and replaced it with a pointer tospecifications/protocol.md.Files changed
uts/rest/unit/presence/rest_presence.mdSummary (Defect 2)
Ruling: Reading A — a
toJson()assertion is made against the wire body, so a presence action is asserted as its enum ordinal (ENTER = 2perspecifications/protocol.md), not the string name. Fixes the wire-format errors inuts/rest/unit/types/presence_message_types.md.Changes
types/presence_message_types.md:262,:283— the two outgoingtoJson()assertionsjson_data["action"] == "enter"→== 2.types/presence_message_types.md(nine inbound fixtures at:122,:146,:147,:171,:191,:231,:305,:320,:321) — string"action": "enter"→ ordinal"action": 2, so the corpus teaches a single wire encoding. No assertion in those sections depends on the action being a string.uts/docs/writing-test-specs.md— records the standing convention thattoJson()/fromJson()operate on the wire body, so actions are asserted as their enum ordinal rather than the string name.Files changed
uts/rest/unit/types/presence_message_types.mduts/docs/writing-test-specs.mdMerge order
PR 5 of 7. Merge after the broken-fixtures PR #536, as it shares
presence/rest_presence.md.Closes #526
🤖 Generated with Claude Code