Add internal-engine LiveObjects UTS unit tests#136
Draft
maratal wants to merge 1 commit into
Draft
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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>
7bae75b to
15578db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 theUTStest target. Unlike the path-based tests (which trap on the public-API skeleton), these driveObjectsPool/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)RTO5c10parentReferencescases, which trap)The
parentReferencescases bind to newnotImplemented()skeletons and trap at runtime — like the path-based tests — until that API is implemented.SDK additions
ParentReferencingskeleton (parentReferences/addParentReference/removeParentReference/getFullPaths), conformed byInternalDefaultLiveCounter/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 lazyobjectsInternalQueue/objectsUserCallbackQueue.UTSTestCase+LiveObjects:makeRealtimeObjects/makePool/makeCounter/makeMap/makeCoreSDK/onQueue/flushCallbacks.UTSNoOpLogger,UTSMockCoreSDK.StandardTestPool:objectsMap/internalMapEntriesbuilders;objectStateMessagecomposes theObjectStatein one call.Deviations (
deviations.md)RTO7/RTO8 (SDK buffers only while SYNCING), RTO9a2b (object created before the unsupported-action check), RTO4b2a (no
objectMessageon the update), RTLO4b4c1 (non-constructible emptycounterInc), and thenotImplemented()skeletons added to hostparent_references/public_object_message.🤖 Generated with Claude Code