Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions .claude/skills/uts-to-kotlin/references/objects-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ doubt, that IDL is the source of truth; this doc is the applied version of it fo
11. [Message / operation types (`PublicAPI::ObjectMessage` →)](#11-messages)
12. [Errors & error codes](#12-errors)
13. [Internal-graph types (unit specs) — important caveat](#13-internal-graph)
14. [Worked example](#14-worked-example)
15. [Quick symbol index](#15-symbol-index)
14. [Integration-test helpers — REST fixture provisioning](#14-integration-helpers)
15. [Worked example](#15-worked-example)
16. [Quick symbol index](#16-symbol-index)

---

Expand Down Expand Up @@ -554,9 +555,43 @@ wire `action` / `semantics` are integer enum codes — the builders emit the cod
> is implemented. (`buildPublicObjectMessage` does *not* depend on this — the message/operation layer is
> implemented, so those tests can run now.)

(For the **integration** tier's REST fixture helper — `provision_objects_via_rest` — see §14.)

---

## 14. Integration-test helpers — REST fixture provisioning (`standard_test_pool.md` → integration `helpers.kt`) <a id="14-integration-helpers"></a>

Some objects **integration** specs (tier `integration/standard`) seed object state over REST *before* the
realtime client connects, via the spec's `## REST Fixture Provisioning` helper `provision_objects_via_rest`.
Its ably-java translation lives in
`uts/src/test/kotlin/io/ably/lib/uts/integration/standard/liveobjects/helpers.kt` (package
`io.ably.lib.uts.integration.standard.liveobjects`) — **call it; don't hand-roll the REST request or payload
JSON.** (Currently only `objects/integration/RTPO15` uses it.) Unlike the unit helpers (§13), this needs no
reflection and no `:liveobjects` dependency — it compiles and runs against `:java`'s public `AblyRest`.

| Spec helper / operation shape | integration `helpers.kt` |
|---|---|
| `provision_objects_via_rest(api_key, channel_name, operations)` | `provisionObjectsViaRest(apiKey, channelName, operations: List<JsonObject>): List<String>` (POSTs the op(s); returns created/updated `objectIds`) |
| op `{ mapSet: { key, value }, objectId/path }` | `mapSetOp(key, value, objectId = …, path = …, id = …)` |
| op `{ mapRemove: { key }, objectId/path }` | `mapRemoveOp(key, objectId = …, path = …, id = …)` |
| op `{ mapCreate: { semantics: 0, entries }, [objectId/path] }` | `mapCreateOp(entries: Map<String, JsonObject>, semantics = 0, objectId = …, path = …, id = …)` |
| op `{ counterCreate: { count }, [objectId/path] }` | `counterCreateOp(count, objectId = …, path = …, id = …)` |
| op `{ counterInc: { number }, objectId/path }` | `counterIncOp(number, objectId = …, path = …, id = …)` |
| value `{ string }` / `{ number }` / `{ boolean }` / `{ bytes }` / `{ objectId }` | `valueString` / `valueNumber` / `valueBoolean` / `valueBytes` / `valueObjectId` (each → `JsonObject`; `valueString` / `valueBytes` take an optional `encoding`) |

> **V2 REST format.** These builders follow the LiveObjects **V2** objects REST API (the OpenAPI is the
> source of truth), **not** the literal `standard_test_pool.md` pseudocode — which still showed the legacy
> `POST …/objects` + `{ messages: [...] }` envelope. V2: `POST /channels/{channel}/object` (**singular**),
> body is a single operation **or** a bare array (no `messages` wrapper), each op named by its payload key
> (`mapSet` / `mapRemove` / `mapCreate` / `counterInc` / `counterCreate`) with an `objectId`/`path` target
> (and optional idempotency `id`). The spec helper is being aligned upstream (ably/specification#497).
>
> The REST call hits the live sandbox today; the realtime client it provisions for only *observes* the data
> once the SDK's OBJECT_SYNC + `RealtimeObject.get()` land.

---

## 14. Worked example <a id="14-worked-example"></a>
## 15. Worked example <a id="15-worked-example"></a>

Spec pseudocode (public-API style):

Expand Down Expand Up @@ -597,7 +632,7 @@ wrapped in `LiveMapValue.of`; `at(...)` followed by `asLiveCounter()` before cou

---

## 15. Quick symbol index <a id="15-symbol-index"></a>
## 16. Quick symbol index <a id="16-symbol-index"></a>

| ably-js / spec symbol | ably-java |
|---|---|
Expand Down
2 changes: 2 additions & 0 deletions uts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dependencies {
// helpers reach the internal wire/message classes (e.g. for build_public_object_message) by reflection.
testRuntimeOnly(project(":liveobjects"))
testImplementation(kotlin("test"))
// @ParameterizedTest / @ValueSource — version managed by the junit-bom on the test classpath.
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation(libs.mockk)
testImplementation(libs.coroutine.core)
testImplementation(libs.coroutine.test)
Expand Down
Loading
Loading