Skip to content

UTS: correct presence action wire encoding (issue #526) - #535

Open
owenpearson wants to merge 2 commits into
mainfrom
fix/uts-presence-wire-actions
Open

owenpearson wants to merge 2 commits into
mainfrom
fix/uts-presence-wire-actions

Conversation

@owenpearson

@owenpearson owenpearson commented Sep 21, 2026

Copy link
Copy Markdown
Member

Summary (Defect 1)

Corrects incoming presence wire-action decoding in uts/rest/unit/presence/rest_presence.md. The presence action is encoded on the wire as its enum ordinal per specifications/protocol.md (Presence Message): ABSENT=0, PRESENT=1, ENTER=2, LEAVE=3, UPDATE=4.

The file previously fed wire action 4 and asserted PresenceAction.leave, contradicting the protocol (and itself — elsewhere it correctly maps 4 to UPDATE and 3 to 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 the PresenceAction.leave assertion at :1396 is 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 to specifications/protocol.md.

Files changed

  • uts/rest/unit/presence/rest_presence.md

Summary (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 = 2 per specifications/protocol.md), not the string name. Fixes the wire-format errors in uts/rest/unit/types/presence_message_types.md.

Changes

  • types/presence_message_types.md:262, :283 — the two outgoing toJson() assertions json_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 that toJson()/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.md
  • uts/docs/writing-test-specs.md

Merge 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

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>
@owenpearson owenpearson changed the title UTS: correct presence wire-action decoding assertions (issue #526 Defect 1) UTS: correct presence action wire encoding (issue #526) Sep 22, 2026

This branch was successfully deployed

1 active deployment
staging/pull/535 a1c8b8f7 Deployed Sep 22, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant