Skip to content

Commit b394399

Browse files
committed
fix(uts/objects): assert map semantics as the symbolic enum value LWW
Review feedback (ttypic): semantics is the ObjectsMapSemantics enum, wire-encoded as an integer (OMP2) - the lowercase form asserted here previously was ably-js's idiomatic string-literal rendering leaking into the pseudo-code. The assertions revert to the symbolic "LWW", and a new 'Enum values' bullet in the uts/README.md pseudocode conventions defines how SDKs derive their idiomatic public rendering from it (enum member in typed SDKs, string-literal union in ably-js). Also documents the provision_objects_via_rest response contract: the helper returns the created/updated objectIds flattened in request order, so derived tests can target follow-up operations by objectId.
1 parent 9641a81 commit b394399

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

uts/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ Pseudocode maps to language idioms rather than prescribing exact syntax:
9595
- **Property access**: member access written as a call (e.g. `instance.id()`) is satisfied by a
9696
property or getter (`instance.id`) where the SDK's feature spec defines the member as a
9797
property (e.g. `Instance#id`, RTINS3).
98+
- **Enum values**: a symbolic enum value in pseudo-code (e.g. `"LWW"` for
99+
`ObjectsMapSemantics.LWW`, wire-encoded as an integer per OMP2) is satisfied by the SDK's
100+
idiomatic public rendering of that enum member — the enum member itself in typed SDKs
101+
(`MapSemantics.LWW` in ably-java), or a string-literal union value in ably-js (`'lww'`).
98102
- **Language-inapplicable inputs**: a test input that cannot be constructed in a given language
99103
(e.g. a non-string map key in JavaScript, where object keys are always coerced to strings; or a
100104
`null` argument where the SDK's signature makes null indistinguishable from "omitted") makes

uts/objects/helpers/standard_test_pool.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,15 @@ If an SDK uses a REST client object to perform provisioning, it must be closed a
468468
```pseudo
469469
provision_objects_via_rest(api_key, channel_name, operations):
470470
# operations: a single operation object, or an array of operation objects (batch)
471-
POST https://sandbox.realtime.ably-nonprod.net/channels/{encode_uri_component(channel_name)}/object
471+
response = POST https://sandbox.realtime.ably-nonprod.net/channels/{encode_uri_component(channel_name)}/object
472472
WITH Authorization: Basic {base64(api_key)}
473473
WITH Content-Type: application/json
474474
WITH body: operations
475+
# Response contract: the body is a single result object, or a JSON array of result objects
476+
# (one per batch entry); each result carries an `objectIds` string array naming the objects
477+
# the operation created or updated. The helper returns them flattened, in request order, so
478+
# derived tests can target follow-up operations by `objectId`.
479+
RETURN [objectId FOR result IN as_list(parse_json(response.body)) FOR objectId IN result.objectIds]
475480
```
476481

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

uts/objects/unit/public_object_message.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Tests that when the source ObjectOperation has a `mapCreate` field, the PublicAP
371371
source_operation = {
372372
action: "MAP_CREATE",
373373
objectId: "map:new@2000",
374-
mapCreate: { semantics: "lww", entries: { "key1": { data: { string: "val1" } } } }
374+
mapCreate: { semantics: "LWW", entries: { "key1": { data: { string: "val1" } } } }
375375
}
376376
```
377377

@@ -385,7 +385,7 @@ public_op = PublicObjectOperation.fromObjectOperation(source_operation)
385385
ASSERT public_op.action == "MAP_CREATE"
386386
ASSERT public_op.objectId == "map:new@2000"
387387
ASSERT public_op.mapCreate IS NOT null
388-
ASSERT public_op.mapCreate.semantics == "lww"
388+
ASSERT public_op.mapCreate.semantics == "LWW"
389389
ASSERT public_op.mapCreate.entries["key1"].data.string == "val1"
390390
ASSERT public_op.counterCreate == null
391391
```
@@ -404,14 +404,14 @@ Tests that when the source ObjectOperation has `mapCreateWithObjectId` but not `
404404

405405
### Setup
406406
```pseudo
407-
derived_map_create = { semantics: "lww", entries: { "x": { data: { number: 10 } } } }
407+
derived_map_create = { semantics: "LWW", entries: { "x": { data: { number: 10 } } } }
408408
409409
source_operation = {
410410
action: "MAP_CREATE",
411411
objectId: "map:derived@3000",
412412
mapCreateWithObjectId: {
413413
objectId: "map:derived@3000",
414-
semantics: "lww",
414+
semantics: "LWW",
415415
entries: { "x": { data: { number: 10 } } },
416416
derivedFrom: derived_map_create // retained MapCreate per RTLMV4j5 (local-only; not a wire field name)
417417
}
@@ -428,7 +428,7 @@ public_op = PublicObjectOperation.fromObjectOperation(source_operation)
428428
ASSERT public_op.action == "MAP_CREATE"
429429
ASSERT public_op.objectId == "map:derived@3000"
430430
ASSERT public_op.mapCreate IS NOT null
431-
ASSERT public_op.mapCreate.semantics == "lww"
431+
ASSERT public_op.mapCreate.semantics == "LWW"
432432
ASSERT public_op.mapCreate.entries["x"].data.number == 10
433433
ASSERT public_op.counterCreate == null
434434
```

0 commit comments

Comments
 (0)