Translate LiveObjects objects UTS test specs to Kotlin tests#1222
Draft
sacOO7 wants to merge 4 commits into
Draft
Translate LiveObjects objects UTS test specs to Kotlin tests#1222sacOO7 wants to merge 4 commits into
objects UTS test specs to Kotlin tests#1222sacOO7 wants to merge 4 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization 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 |
uts-to-kotlin skillobjects UTS unit specs to Kotlin (10/15 specs, 181 tests)
objects UTS unit specs to Kotlin (10/15 specs, 181 tests)objects UTS unit specs to Kotlin tests
…s.md Record the five objects/unit UTS specs (live_counter, live_map, object_id, objects_pool, parent_references) that cannot be translated into the :uts module. They assert on the internal CRDT graph (ObjectsPool, live nodes, applyOperation, object-id generation, parent references), which is (a) not yet implemented in :liveobjects and (b) Kotlin-`internal`, so unreachable from the :uts test module at compile time. Covers: status of all 15 objects/unit specs (10 translated, 5 blocked), why these target internals, the two blockers, and the realistic visibility options (java-test-fixtures bridge, tests in :liveobjects/src/test, or reflection) with their trade-offs and a recommendation.
18a9d0c to
43a3ab2
Compare
Add the integration-tier translation of standard_test_pool.md's REST fixture
provisioning (`provision_objects_via_rest`) under
uts/.../integration/standard/liveobjects/helpers.kt: `provisionObjectsViaRest`
plus op builders (mapSet/mapRemove/mapCreate/counterCreate/counterInc) and value
builders (string/number/boolean/bytes/objectId).
The helper follows the LiveObjects V2 objects REST API (per the OpenAPI), not the
legacy pseudocode: POST /channels/{channel}/object (singular), body is a single
operation or a bare array (no "messages" envelope), each op identified by its
payload key with an objectId/path target. Compiles against :java only
(AblyRest + HttpUtils); used by objects/integration/RTPO15.
Document it in the uts-to-kotlin skill's objects-mapping.md as a new section
("14. Integration-test helpers"), promoted out of the unit-only internal-graph
section, with the TOC renumbered accordingly.
…ation/proxy tests
objects UTS unit specs to Kotlin testsobjects UTS test specs to Kotlin tests
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.
Summary
Translates the
objects(LiveObjects) UTS unit specs into runnable Kotlin tests in theutsmodule, using the
uts-to-kotlinskill. Of the 15objects/unitspecs, 10 are translated(181 tests) and 5 are blocked by missing internal implementation (documented, not silently
skipped).
This is translate-only: every test compiles (
./gradlew :uts:compileTestKotlinis green). Mostrun only once the LiveObjects engine (
OBJECT_SYNCprocessing +RealtimeObject.get()) lands; themessage-layer and value-type construction tests run today.
What's included
10 translated spec files — 181
@Testmethodsobjects/unit/…)instance.mdInstanceTestInstance)path_object.mdPathObjectTestPathObject)path_object_mutations.mdPathObjectMutationsTestpath_object_subscribe.mdPathObjectSubscribeTestlive_counter_api.mdLiveCounterApiTestlive_map_api.mdLiveMapApiTestlive_object_subscribe.mdLiveObjectSubscribeTestpublic_object_message.mdPublicObjectMessageTestrealtime_object.mdRealtimeObjectTestget()+ sync events)value_types.mdValueTypesTestcreatesurface)Each test carries a verbatim
@UTS objects/unit/…tag tracing it to the source spec point. All filesfollow the
utsconventions (no star imports,runTest, sharedhelpers.kt).Deviations —
uts/src/test/kotlin/io/ably/lib/uts/deviations.mdPer-test divergences where ably-java (a typed SDK) differs from the spec's dynamic API, e.g.:
Instancecast throwsIllegalStateExceptionrather thanErrorInfo 92007;value()/size()partitioned off the wrong-typed view (not expressible);compact()unimplemented →compactJson()used;Blocked specs —
uts/src/test/kotlin/io/ably/lib/uts/private_deviations.mdThe 5 specs that could not be translated, with the reasons and a recommended path forward.
The 5 blocked specs
live_counter.md,live_map.md,object_id.md,objects_pool.md,parent_references.mdassert on theinternal CRDT graph (live nodes +
applyOperation,siteTimeserials, theObjectsPool, object-idgeneration, parent references). Two blockers:
:liveobjectscurrently ships only the public view layer; theCRDT engine these specs test does not exist (
ObjectsPool,generateObjectId,applyOperation, … =0 references). There is nothing to assert against.
internalvisibility (secondary). Once implemented, those symbols will be Kotlininternaland unreachable from the:utstest module at compile time.private_deviations.mdlays out the realistic options for when the engine lands — the recommended one(to keep tests under
uts/unit) is ajava-test-fixturesbridge in:liveobjectsexposing a smallpublic inspection surface; the lowest-ceremony alternative is authoring them in
:liveobjects/src/test.Notes / caveats
deviations.mdentries thatdocument SDK behaviour become live once the engine is implemented.
documented no-op test bodies, paired with a
// DEVIATIONnote +deviations.mdentry.LiveCounterApiTest/LiveMapApiTestcontain a few wire-shape assertions read reflectively /via observable round-trip; these are unverified until the SDK publish path lands (flagged in the code).
How it was produced
Driven by the
uts-to-kotlinskill (per-spec: read theobjectsmapping doc + infra, translate, compileonce for the whole module, review against the spec). The bulk batch was fanned out with a multi-agent
workflow (one agent per spec, parallel), then compiled and fixed centrally.
Testing
Update — integration & proxy tiers added
Extends this PR beyond the unit tier: the direct-sandbox integration and proxy integration
objectsspecs are now translated. Still translate-only (compiles; runs once the LiveObjects engine lands and against the sandbox). With these, all non-blockedobjectsspecs across all three tiers are translated — only the 5 internal-graph unit specs remain blocked (above).Integration tier — direct sandbox (
integration/standard/liveobjects/)Real-sandbox happy path: connect → sync → create/mutate via
PathObject→ verify propagation to a second client; no fault injection. Each case runs once per protocol variant (JSON + msgpack) via auseBinaryProtocol@ParameterizedTest.objects/integration/…)objects_lifecycle_test.mdObjectsLifecycleTestobjects_sync_test.mdObjectsSyncTestClients hit the nonprod sandbox (
sandbox.realtime.ably-nonprod.netviaProxyManager.sandboxRealtimeHost); a throwaway app is provisioned withSandboxAppin@BeforeAll/@AfterAll.Proxy tier — sandbox + fault injection (
integration/proxy/liveobjects/)Routes the SDK through the programmable
uts-proxyto inject transport faults (disconnect mid-OBJECT_SYNC, delayed sync, server-initiatedDETACHED, channelERROR→FAILED). JSON-only (the proxy inspects only text frames).objects/integration/proxy/…)objects_faults.mdObjectsFaultsTestOther changes
integration/standard/liveobjects/helpers.kt:provisionObjectsViaRest(...)plus op/value builders, the ably-java translation ofstandard_test_pool.md'sprovision_objects_via_rest. Built to the V2 objects REST contract (POST /channels/{ch}/object, payload-key ops, no{messages}envelope), targeting the nonprod sandbox host viarestHost. Used by RTPO15's rest-provisioned-data-sync case; compiles against:javaonly (publicAblyRest).junit-jupiter-paramsadded touts/build.gradle.kts— enables the protocol-variant@ParameterizedTestin the integration tier (version managed by the JUnit BOM already on the test classpath).objects-mapping.md§14 — documents the integration REST-helper mapping in theuts-to-kotlinskill reference.Related
The V2 + nonprod-host alignment of the UTS source spec is tracked upstream in ably/specification#497 (the
provision_objects_via_resthost/shape and the objects integration client endpoints).Testing