Skip to content

Serialize the LiveObjects integration suites - #2288

Merged
maratal merged 1 commit into
mainfrom
test/serialize-liveobjects-integration
Sep 18, 2026
Merged

maratal merged 1 commit into
mainfrom
test/serialize-liveobjects-integration

Conversation

@maratal

@maratal maratal commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Each case in LiveObjects/Tests/AblyLiveObjectsTests/Integration stands up its own realtime client, its own channel and its own object sync against the sandbox:

let realtime = try await ClientHelper.realtimeWithObjects(…)
let channel = realtime.channels.get(UUID().uuidString, …)
try await channel.attachAsync()
let root = try await channel.object.get()

swift-testing runs a suite's cases in parallel unless told otherwise, and none of these three suites said otherwise. NumberPrecisionTests alone is four test functions over three argument values, so twelve concurrent clients.

What that does on CI

From the Xcode, iOS (Xcode 16.4) job on run 35081997799:

09:58:33  ◇ Test mapNumberSurvivesJSONRoundTrip started
09:58:33  ◇ Test counterValueSurvivesJSONRoundTrip started
09:58:33  ◇ Test mapNumberSurvivesMessagePackRoundTrip started
09:58:33  ◇ Test counterValueSurvivesMessagePackRoundTrip started
…
10:01:06  ✔ mapNumberSurvivesJSONRoundTrip passed after 127.618 seconds
10:01:09  ✘ counterValueSurvivesJSONRoundTrip … Error -1001 - The request timed out

A test that performs one set and one poll took over two minutes. The counter tests make twice the round trips — create, poll, increment, poll — so they were the ones to cross SandboxEnvironment.provisioningTimeout (30s) and fail with NSURLErrorTimedOut.

It is not specific to any branch

Per-attempt data for the same job, which run-level conclusions hide because the failures were cleared by re-running:

PR Branch Attempt Failed
#2267 split/agent-identifiers 2 of 3 Xcode, iOS
#2274 ci/retry-absorbs-flakes 2 of 3 Xcode, iOS
#2275 split/uts-per-side 2 of 3 Xcode, iOS and tvOS
#2284 deps/raise-platform-floor 1 of 2 Xcode, iOS
#2286 fix/test-crash-on-timeout 1 Xcode, iOS

Those five branches have nothing in common, NumberPrecisionTests came from main in fbb638b3 and none of them touch it, and tvOS is affected too — so this is contention, not a platform quirk. macOS has never failed this way, being the host rather than a simulator.

LiveObjects/BuildTool passes no -retry-tests-on-failure, so one timeout in one of twelve concurrent cases reddens the whole job and somebody has to press the button. Adding that flag is a separate, complementary change.

The convention already exists

Test/UTS/README.md states it for the UTS integration tier — "Suites are @Suite(.serialized) final class … : UTSTestCase" — and IntegrationTestCase repeats it. These three suites never adopted it.

The trade, measured

Serializing is slower where there is no contention, and I checked rather than assumed: locally NumberPrecisionTests goes from 3.6s to 11.9s. That is the cost. The benefit is on CI, where the parallel version currently spends minutes and then fails — twelve sequential cases at a few seconds each should beat twelve concurrent ones at 128 seconds each.

I cannot demonstrate the CI improvement from a local run, because the contention comes from the runner's latency to the sandbox. CI on this PR is the measurement.

Verification

All three suites pass serialized: NumberPrecisionTests (4 tests, 11.4s), AblyLiveObjectsTests (418 tests in 109 suites, 11.7s), ObjectLifetimesTests (3 tests, 3.3s).

Summary by CodeRabbit

  • Tests
    • Updated integration test suites to run serially rather than in parallel.
    • No test logic or end-user functionality changed.

Each case in these suites stands up its own realtime client, channel and
object sync against the sandbox. swift-testing runs a suite's cases in
parallel unless told otherwise, so NumberPrecisionTests alone opened twelve
connections at once — four test functions over three argument values.

On CI that collapses. In the run linked below, all twelve cases started
inside four seconds, the cheapest of them then took 128 seconds, and the
counter tests — which make twice the round trips — crossed the 30 second
provisioning timeout and failed with `Error -1001 - The request timed out`.
The same job has failed this way on five unrelated branches, always on a
simulator platform, never on macOS.

The UTS integration tier already settled this: Test/UTS/README.md states the
convention as `@Suite(.serialized) final class … : UTSTestCase`. These three
suites never adopted it.

Note that serializing is slower where there is no contention: locally
NumberPrecisionTests goes from 3.6s to 11.9s. The trade is worth it on CI,
where the parallel version costs minutes and then fails.
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: e645dbdd-4130-4441-b128-4723cf6f0927

📥 Commits

Reviewing files that changed from the base of the PR and between b5074d9 and c1e12ba.

📒 Files selected for processing (3)
  • LiveObjects/Tests/AblyLiveObjectsTests/Integration/AblyLiveObjectsTests.swift
  • LiveObjects/Tests/AblyLiveObjectsTests/Integration/NumberPrecisionTests.swift
  • LiveObjects/Tests/AblyLiveObjectsTests/Integration/ObjectLifetimesTests.swift

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

Three integration test suites now use serialized execution. No test logic changed.

Changes

Integration test execution

Layer / File(s) Summary
Serialized suite annotations
LiveObjects/Tests/AblyLiveObjectsTests/Integration/*.swift
AblyLiveObjectsTests, NumberPrecisionTests, and ObjectLifetimesTests now include .serialized in their suite annotations.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: sacoo7

Merge Risk: ⚪ Minimal · up to c1e12

The integration suites now run serially as intended, with no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: serializing the LiveObjects integration test suites.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/serialize-liveobjects-integration

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

A rabbit hops through tests in line
No parallel paws collide this time
Three suites march with careful feet
Their serialized run is neat
Green carrots wait when checks complete

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

@ttypic ttypic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maratal
maratal merged commit 5dc8946 into main Sep 18, 2026
28 checks passed
@maratal
maratal deleted the test/serialize-liveobjects-integration branch September 18, 2026 22:20

This branch was successfully deployed

4 active deployments
staging/pull/2288/markdown-api-reference — c1e12ba6 Deployed Sep 16, 2026 by github-actions[bot]
staging/pull/2288/jazzydoc — c1e12ba6 Deployed Sep 16, 2026 by github-actions[bot]
staging/pull/2288/AblyLiveObjects — c1e12ba6 Deployed Sep 16, 2026 by github-actions[bot]
staging/pull/2288/features — c1e12ba6 Deployed Sep 16, 2026 by github-actions[bot]
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.

2 participants