Skip to content

Add ObjectData json type and UNKNOWN enum sentinels to objects spec#495

Open
sacOO7 wants to merge 1 commit into
mainfrom
fix/liveobjects-spec-objectdata-json-type
Open

Add ObjectData json type and UNKNOWN enum sentinels to objects spec#495
sacOO7 wants to merge 1 commit into
mainfrom
fix/liveobjects-spec-objectdata-json-type

Conversation

@sacOO7

@sacOO7 sacOO7 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Extends the LiveObjects wire types in features.md with a new json value type for ObjectData, plus UNKNOWN forward-compatibility sentinels on two wire enums.

Changes

ObjectData.json value field (OD2g)

  • Adds a json field holding a JSON object or array leaf value in the object graph.
  • Sent to / received from the server as a JSON-encoded string when using the JSON protocol.
  • OD2cOD2f updated so json is included in the set of mutually-exclusive value fields (boolean, bytes, number, string, json).
  • Added to the IDL as json: String?.

ObjectData size calculation (OD3a, OD3g)

  • OD3a updated to include json in the summed properties.
  • New OD3g: the size of a json property is the byte length of its JSON-encoded string representation.
  • Matches both reference implementations (ably-js _getObjectDataSizedataSizeBytes(data.json); ably-java ObjectData.size()json.toString().byteSize).

UNKNOWN enum sentinels (OOP2a, OMP2a)

  • Adds a client-side UNKNOWN value to both ObjectOperationAction and ObjectsMapSemantics.
  • It has no wire value and is never encoded or sent.
  • When decoding, an action/semantics value that doesn't map to a known member must decode to UNKNOWN rather than failing.
  • This gives clients a defined way to detect operations/maps they don't understand (e.g. introduced by a newer protocol version) so an ObjectOperation with an UNKNOWN action can be safely ignored and not applied.
  • Both reflected in the IDL.

Validation

  • Spec linter passes (npm run lint) — no duplicate spec IDs.

🤖 Generated with Claude Code

@github-actions github-actions Bot temporarily deployed to staging/pull/495 June 18, 2026 11:09 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/495 June 18, 2026 11:12 Inactive
@sacOO7 sacOO7 force-pushed the fix/liveobjects-spec-objectdata-json-type branch from d85dcf3 to a829907 Compare June 18, 2026 11:16
@github-actions github-actions Bot temporarily deployed to staging/pull/495 June 18, 2026 11:16 Inactive
Extend the LiveObjects wire types in features.md:

- OD2g: add a `json` value field to `ObjectData`, holding a JSON object or
  array leaf value, sent/received as a JSON-encoded string over the JSON
  protocol. Update OD2c-OD2f so `json` is listed among the mutually-exclusive
  value fields, and add the field to the IDL.
- OD3a / OD3g: include `json` in the `ObjectData` size calculation; its size
  is the byte length of its JSON-encoded string representation. This matches
  both reference implementations (ably-js _getObjectDataSize and ably-java
  ObjectData.size()).
- OOP2a / OMP2a: add a client-side `UNKNOWN` sentinel to the
  `ObjectOperationAction` and `ObjectsMapSemantics` enums. It has no wire
  value and is never encoded or sent; decoding an unrecognised action or
  semantics value yields `UNKNOWN` instead of failing, giving clients a
  defined way to detect and safely ignore operations they do not understand
  (e.g. introduced by a newer protocol version). Reflected in the IDL.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

- `(OOP1)` An `ObjectOperation` describes an operation to be applied to an object on a channel
- `(OOP2)` `ObjectOperationAction` enum has the following values in order from zero: `MAP_CREATE`, `MAP_SET`, `MAP_REMOVE`, `COUNTER_CREATE`, `COUNTER_INC`, `OBJECT_DELETE`, `MAP_CLEAR`
- `(OOP2a)` The enum additionally has an `UNKNOWN` value, which has no wire representation. When decoding, an `action` that does not map to any of the wire-ordered members above must be decoded as `UNKNOWN` rather than failing. The client library must never encode or send `UNKNOWN`, and must ignore (not apply) any `ObjectOperation` whose `action` is `UNKNOWN`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it can be implemented differently (for example, as a nullable field). The main point is that if we receive an unknown value, we shouldn’t fail. Anyway, we agreed that we don’t want to add spec points that contradict the js implementation.

- `(OD2d)` `bytes` binary \| string - a primitive binary leaf value in the object graph. It is sent to and received from the server as a Base64-encoded string when using the JSON protocol. Only one of the value fields - `boolean`, `bytes`, `number` or `string` - must be set at a time
- `(OD2e)` `number` number - a primitive number leaf value in the object graph. Only one of the value fields - `boolean`, `bytes`, `number` or `string` - must be set at a time
- `(OD2f)` `string` string - a primitive string leaf value in the object graph. Only one of the value fields - `boolean`, `bytes`, `number` or `string` - must be set at a time
- `(OD2c)` `boolean` boolean - a primitive boolean leaf value in the object graph. Only one of the value fields - `boolean`, `bytes`, `number`, `string` or `json` - must be set at a time

@ttypic ttypic Jun 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, don't see any changes to the (OD2c-f), if it's just trailing spaces could we revert them to keep the git history cleaner?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants