Skip to content

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

Merged
sacOO7 merged 3 commits into
mainfrom
fix/liveobjects-spec-objectdata-json-type
Jun 24, 2026
Merged

Add ObjectData json type and UNKNOWN enum sentinels to objects spec#495
sacOO7 merged 3 commits 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>
@sacOO7 sacOO7 force-pushed the fix/liveobjects-spec-objectdata-json-type branch from a829907 to 5ddc271 Compare June 18, 2026 11:21
@github-actions github-actions Bot temporarily deployed to staging/pull/495 June 18, 2026 11:22 Inactive
Comment thread specifications/features.md Outdated
Comment thread specifications/features.md Outdated
- `(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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

They weren't just trailing spaces — each line was adding json to the "only one set at a time" list. Rather than repeat that across all five value fields, I've hoisted the exclusivity rule into the parent OD2 clause and removed the per-line duplication, so OD2c–OD2g are now back to a single descriptive sentence each and future value fields won't churn every line. Done in 1230e2c.

@github-actions github-actions Bot temporarily deployed to staging/pull/495 June 22, 2026 08:37 Inactive
@sacOO7 sacOO7 requested a review from ttypic June 22, 2026 08:39
…jectData value-field exclusivity

- OOP2a/OMP2a: specify the decode-without-failing behaviour for
  unrecognised action/semantics rather than mandating an UNKNOWN enum
  member; leave the representation to the implementation. Removes the
  UNKNOWN members from the wire-ordered enums in the IDL, which
  contradicted the reference (ably-js) wire enums.
- OD2: hoist the "at most one value field set at a time" rule into the
  parent clause and drop the duplicated sentence from OD2c-OD2g.
@sacOO7 sacOO7 force-pushed the fix/liveobjects-spec-objectdata-json-type branch from 1230e2c to d18b126 Compare June 24, 2026 09:55
@github-actions github-actions Bot temporarily deployed to staging/pull/495 June 24, 2026 09:56 Inactive

@ttypic ttypic left a comment

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.

LGTM

@sacOO7 sacOO7 merged commit 6dc3ac9 into main Jun 24, 2026
2 checks passed
@sacOO7 sacOO7 deleted the fix/liveobjects-spec-objectdata-json-type branch June 24, 2026 10:03
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