Skip to content
Open
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
19 changes: 17 additions & 2 deletions uts/objects/helpers/standard_test_pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,25 @@ setup_synced_channel_no_ack(channel_name):

For integration tests that need pre-existing object state before the test client connects, use the REST API to establish fixtures.

The objects REST API uses the **V2 format** (per the LiveObjects OpenAPI specification). A request publishes a single operation, or a batch of operations as a JSON array — there is **no** `{ "messages": [...] }` envelope. Each operation names its type via a payload key (`mapSet`, `mapRemove`, `mapCreate`, `counterInc`, `counterCreate`) and targets an object by `objectId` **or** `path`. Note the endpoint path is singular (`/object`).

```pseudo
provision_objects_via_rest(api_key, channel_name, operations):
POST https://sandbox-rest.ably.io/channels/{encode_uri_component(channel_name)}/objects
# operations: a single operation object, or an array of operation objects (batch)
POST https://sandbox.realtime.ably-nonprod.net/channels/{encode_uri_component(channel_name)}/object
WITH Authorization: Basic {base64(api_key)}
WITH Content-Type: application/json
WITH body: { "messages": operations }
WITH body: operations
```

Operation shapes (target by `objectId` or `path`; an optional `id` on any operation is an idempotency key):

```pseudo
{ mapSet: { key: "<key>", value: <value> }, objectId|path: "<target>" }
{ mapRemove: { key: "<key>" }, objectId|path: "<target>" }
{ mapCreate: { semantics: 0, entries: { "<key>": { data: <value> } } } [, objectId|path: "<target>"] } # semantics 0 = LWW
{ counterCreate: { count: <number> } [, objectId|path: "<target>"] }
{ counterInc: { number: <number> }, objectId|path: "<target>" } # negative number = decrement
```

where `<value>` is a primitive value object: `{ string: "..." }`, `{ number: ... }`, `{ boolean: ... }`, `{ bytes: "<base64>" }`, or a reference `{ objectId: "..." }` (`string`/`bytes` may also carry an optional `encoding`).
201 changes: 0 additions & 201 deletions uts/objects/integration/objects_batch_test.md

This file was deleted.

27 changes: 12 additions & 15 deletions uts/objects/integration/objects_lifecycle_test.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ propagates via the server and a second client sees the updated value.
```pseudo
channel_name = "objects-lifecycle-" + random_id()

client_a = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_a = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })

client_a.connect()
AWAIT_STATE client_a.connection.state == CONNECTED
Expand Down Expand Up @@ -105,8 +105,8 @@ on the server. Second client syncs and reads the counter value.
```pseudo
channel_name = "objects-counter-create-" + random_id()

client_a = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_a = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })

client_a.connect()
AWAIT_STATE client_a.connection.state == CONNECTED
Expand Down Expand Up @@ -152,8 +152,8 @@ The server applies the increment and propagates the updated value.
```pseudo
channel_name = "objects-increment-" + random_id()

client_a = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_a = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })

client_a.connect()
AWAIT_STATE client_a.connection.state == CONNECTED
Expand Down Expand Up @@ -204,8 +204,8 @@ Second client can navigate into the nested map.
```pseudo
channel_name = "objects-map-create-" + random_id()

client_a = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_a = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })

client_a.connect()
AWAIT_STATE client_a.connection.state == CONNECTED
Expand Down Expand Up @@ -254,7 +254,7 @@ after the sync sequence completes.
```pseudo
channel_name = "objects-get-root-" + random_id()

client = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client.connect()
AWAIT_STATE client.connection.state == CONNECTED

Expand Down Expand Up @@ -294,18 +294,15 @@ channel_name = "objects-rest-provision-" + random_id()
// Provision data via REST before any realtime client connects
provision_objects_via_rest(api_key, channel_name, [
{
operation: {
action: "MAP_SET",
objectId: "root",
mapSet: { key: "provisioned", value: { string: "from_rest" } }
}
mapSet: { key: "provisioned", value: { string: "from_rest" } },
objectId: "root"
}
])
```

### Test Steps
```pseudo
client = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client.connect()
AWAIT_STATE client.connection.state == CONNECTED

Expand Down
10 changes: 5 additions & 5 deletions uts/objects/integration/objects_sync_test.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ processes OBJECT_SYNC messages, then transitions to SYNCED. get() waits for SYNC
```pseudo
channel_name = "objects-sync-" + random_id()

client = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client.connect()
AWAIT_STATE client.connection.state == CONNECTED

Expand Down Expand Up @@ -89,8 +89,8 @@ client.close()
```pseudo
channel_name = "objects-two-sync-" + random_id()

client_a = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client_a = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client_b = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })

client_a.connect()
AWAIT_STATE client_a.connection.state == CONNECTED
Expand Down Expand Up @@ -137,7 +137,7 @@ is re-populated from the server.
```pseudo
channel_name = "objects-reattach-" + random_id()

client = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client.connect()
AWAIT_STATE client.connection.state == CONNECTED

Expand Down Expand Up @@ -183,7 +183,7 @@ sends HAS_OBJECTS, sync completes, root is an empty LiveMap.
```pseudo
channel_name = "objects-subscribe-only-" + random_id()

client = Realtime(options: { key: api_key, useBinaryProtocol: PROTOCOL == "msgpack" })
client = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false, useBinaryProtocol: PROTOCOL == "msgpack" })
client.connect()
AWAIT_STATE client.connection.state == CONNECTED

Expand Down
4 changes: 2 additions & 2 deletions uts/objects/integration/proxy/objects_faults.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ The mutations should be buffered and applied after the sync completes.
channel_name = "objects-buffer-resync-" + random_id()

// Client A: direct connection (no proxy), publishes mutations
client_a = Realtime(options: { key: api_key })
client_a = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false })
client_a.connect()
AWAIT_STATE client_a.connection.state == CONNECTED
WITH timeout: 15 seconds
Expand Down Expand Up @@ -391,7 +391,7 @@ sync completes.
channel_name = "objects-publish-during-sync-" + random_id()

// Client A: direct, no proxy
client_a = Realtime(options: { key: api_key })
client_a = Realtime(options: { key: api_key, endpoint: "nonprod:sandbox", autoConnect: false })
client_a.connect()
AWAIT_STATE client_a.connection.state == CONNECTED
WITH timeout: 15 seconds
Expand Down
Loading