Skip to content

Add internal-engine LiveObjects UTS unit tests#136

Draft
maratal wants to merge 1 commit into
feature/uts-path-based-unit-testsfrom
feature/uts-objects-internal-unit-tests
Draft

Add internal-engine LiveObjects UTS unit tests#136
maratal wants to merge 1 commit into
feature/uts-path-based-unit-testsfrom
feature/uts-objects-internal-unit-tests

Conversation

@maratal

@maratal maratal commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Stacked on feature/uts-path-based-unit-tests (the PR base).

Translates the LiveObjects UTS unit specs that exercise the internal engine directly — object_id, objects_pool, parent_references — into Swift in the UTS test target. Unlike the path-based tests (which trap on the public-API skeleton), these drive ObjectsPool / InternalDefaultRealtimeObjects / the live-object classes directly (no ably-cocoa client / mock WebSocket), so the cases covering implemented behaviour pass.

Test files (Tests/UTS/Tests/Internal)

  • ObjectIdTests — RTO14 (objectId generation; pure function — passes)
  • ObjectsPoolTests — RTO3–RTO9 (pool + RTO4/RTO5 sync state machine — passes, except the 3 RTO5c10 parentReferences cases, which trap)
  • ParentReferencesTests — RTLO3f/4f/4g/4h, RTO5c10 (compile + trap)

The parentReferences cases bind to new notImplemented() skeletons and trap at runtime — like the path-based tests — until that API is implemented.

SDK additions

  • ParentReferencing skeleton (parentReferences / addParentReference / removeParentReference / getFullPaths), conformed by InternalDefaultLiveCounter / InternalDefaultLiveMap.
  • testsOnly_ hooks to drive/seed/inspect the engine: InternalDefaultRealtimeObjects.testsOnly_objectsSyncState / testsOnly_setLiveMap / testsOnly_setLiveCounter; ObjectsPool.testsOnly_setLiveMap / testsOnly_setLiveCounter; InternalDefaultLive{Map,Counter}.testsOnly_setData.

Harness + helpers (Tests/UTS)

  • UTSTestCase: shared lazy objectsInternalQueue / objectsUserCallbackQueue.
  • UTSTestCase+LiveObjects: makeRealtimeObjects / makePool / makeCounter / makeMap / makeCoreSDK / onQueue / flushCallbacks.
  • UTSNoOpLogger, UTSMockCoreSDK.
  • StandardTestPool: objectsMap / internalMapEntries builders; objectStateMessage composes the ObjectState in one call.

Deviations (deviations.md)

RTO7/RTO8 (SDK buffers only while SYNCING), RTO9a2b (object created before the unsupported-action check), RTO4b2a (no objectMessage on the update), RTLO4b4c1 (non-constructible empty counterInc), and the notImplemented() skeletons added to host parent_references / public_object_message.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e089386d-9e8d-4eb2-b1d1-1e3487bcf03e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/uts-objects-internal-unit-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot temporarily deployed to staging/pull/136/AblyLiveObjects July 13, 2026 00:14 Inactive
Translate the LiveObjects UTS unit specs that exercise the internal engine
directly (`object_id`, `objects_pool`, `parent_references`) into Swift, in the
`UTS` test target. Unlike the path-based tests (which trap on the public API
skeleton), these drive `ObjectsPool` / `InternalDefaultRealtimeObjects` / the
live-object classes directly — with no ably-cocoa client / mock WebSocket — so
the cases covering implemented behaviour actually pass. The `parentReferences`
cases bind to new `notImplemented()` skeletons and trap at runtime, like the
path-based tests, until that API is implemented.

Test files (Tests/UTS/Tests/Internal):
- ObjectIdTests       — RTO14 (objectId generation; pure function, passes)
- ObjectsPoolTests    — RTO3–RTO9 (pool + RTO4/RTO5 sync state machine; passes,
                        except the 3 RTO5c10 parentReferences cases, which trap)
- ParentReferencesTests — RTLO3f/4f/4g/4h, RTO5c10 (compile + trap)

SDK additions:
- `ParentReferencing` skeleton (`parentReferences` / `addParentReference` /
  `removeParentReference` / `getFullPaths`, all `notImplemented()`), conformed by
  `InternalDefaultLiveCounter` / `InternalDefaultLiveMap`.
- `testsOnly_` hooks to drive/seed/inspect the engine from the test target:
  `InternalDefaultRealtimeObjects.testsOnly_objectsSyncState` /
  `testsOnly_setLiveMap` / `testsOnly_setLiveCounter`; `ObjectsPool.testsOnly_setLiveMap` /
  `testsOnly_setLiveCounter`; `InternalDefaultLive{Map,Counter}.testsOnly_setData`.

Harness + helpers (Tests/UTS):
- UTSTestCase: shared lazy `objectsInternalQueue` / `objectsUserCallbackQueue`.
- UTSTestCase+LiveObjects: `makeRealtimeObjects` / `makePool` / `makeCounter` /
  `makeMap` / `makeCoreSDK` / `onQueue` / `flushCallbacks`.
- UTSNoOpLogger, UTSMockCoreSDK.
- StandardTestPool: `objectsMap` / `internalMapEntries` builders; `objectStateMessage`
  now composes the `ObjectState` in one call.

Deviations (deviations.md): RTO7/RTO8 (SDK buffers only while SYNCING), RTO9a2b
(object created before the unsupported-action check), RTO4b2a (no `objectMessage`
on the update), RTLO4b4c1 (non-constructible empty `counterInc`), and the
`notImplemented()` skeletons added to host `parent_references` / `public_object_message`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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