Skip to content

[AIT-1138] Deprecate RTPO8d: PathObject#instance wraps primitives (RTPO8f)#504

Open
sacOO7 wants to merge 1 commit into
uts-liveobjectsfrom
fix/rtpo8-instance-wraps-primitives
Open

[AIT-1138] Deprecate RTPO8d: PathObject#instance wraps primitives (RTPO8f)#504
sacOO7 wants to merge 1 commit into
uts-liveobjectsfrom
fix/rtpo8-instance-wraps-primitives

Conversation

@sacOO7

@sacOO7 sacOO7 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What

PathObject#instance previously returned undefined/null when the path resolved to a primitive value (RTPO8d). This PR deprecates that clause and replaces it with RTPO8f: a primitive resolution now returns a new Instance wrapping the primitive value. The corresponding UTS test spec is updated to match.

Why

The primitive-null behaviour was the odd one out in the Instance model:

  • RTINS1 already defines Instance as "a direct-reference view of a LiveObject or primitive value".
  • Primitives already surface as Instances through Instance#get (RTINS5c), so a map entry read via an Instance produced a primitive Instance, while the same entry read via PathObject#instance produced nothing.
  • RTINS3b (primitives have no object id) and RTINS4c (Instance#value returns the primitive directly) already specify how a primitive-wrapping Instance behaves — RTPO8d was just blocking the one entry point.

Making instance() total over resolved values gives callers a single, uniform way to capture a point-in-time reference to whatever sits at a path.

Changes

specifications/objects-features.md

  • RTPO8d — marked as replaced by RTPO8f, following the existing deprecation convention.
  • RTPO8f (new) — a primitive resolution returns a new Instance (RTINS1) wrapping the primitive value.
  • RTPO8c (LiveObject → Instance) and RTPO8e (resolution failure → undefined/null) are unchanged.

uts/objects/unit/path_object.md

  • objects/unit/RTPO8c/instance-primitive-null-0 becomes objects/unit/RTPO8f/instance-primitive-wrapped-0: asserts the returned Instance exists, has no object id (RTINS3b), and exposes the primitive via value() (RTINS4c).

SDK adoption

Both SDK implementations and their derived UTS tests have been updated to this behaviour and are pending on their respective branches:

  • ably-js: _resolveInstance wraps any resolved value; batch() retains its explicit LiveObject check so the 92007 non-LiveObject error is unaffected.
  • ably-java: DefaultPathObject.instance() returns the typed Instance for any resolved value; primitive instances remain anonymous (no id member) per the typed-SDK contract.

Follow-up (separate PR)

The typed-SDK spec section (RTTS6e / RTTS3b, #491) still states that instance() on primitive PathObject sub-classes returns null or throws 92007 — that premise is removed by this change and will be reconciled in an individual PR against that branch.

Previously PathObject#instance returned undefined/null when the path
resolved to a primitive (RTPO8d). This is inconsistent with the Instance
model itself: RTINS1 defines Instance as a view of "a LiveObject or
primitive value", and primitives already surface as Instances via
Instance#get (RTINS5c).

Replace RTPO8d with RTPO8f: a primitive resolution returns a new
Instance wrapping the primitive value. Resolution failure (RTPO8e) still
returns undefined/null.

Update the corresponding UTS test spec: the RTPO8c primitive-null test
becomes RTPO8f/instance-primitive-wrapped-0, asserting the returned
Instance has no object id (RTINS3b) and exposes the primitive via
Instance#value (RTINS4c).
@sacOO7 sacOO7 changed the title Deprecate RTPO8d: PathObject#instance wraps primitives (RTPO8f) [AIT-1138] Deprecate RTPO8d: PathObject#instance wraps primitives (RTPO8f) Jul 10, 2026
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.

1 participant