Skip to content

Start the view tests early in a second - #327

Merged
arifBurakDemiray merged 1 commit into
stagingfrom
view-duration-flake
Oct 23, 2026
Merged

arifBurakDemiray merged 1 commit into
stagingfrom
view-duration-flake

Conversation

@arifBurakDemiray

Copy link
Copy Markdown
Member

What

The view tests are the most frequent CI failure: 15 of the last 40 failed runs, on master, staging and PR branches alike, all with 0.0 expected duration, got 1.0.

Test Failures
sc_MV_ManualViewTests.MV_201A_autoStopped_pausedResumed_Legacy 4
sc_MV_ManualViewTests.MV_200A_autostartView_autoClose_legacy 3
ModuleViewsTests.validateSegmentation1, validateSegmentation2 2 each
ModuleViewsTests.validateSegmentation_internalKeys, useWithAutoStoppedOnes, simpleFlow, mixedTestFlow1 1 each

Why

ModuleViews measures a view as TimeUtils.uniqueTimestampS() (milliseconds / 1000) at the stop minus the same at the start, in whole seconds, as the reference SDK does. A view stopped a few milliseconds after it started therefore reports 1 s when the two calls fall on either side of a second boundary. TestUtils.validateEvent keeps a 0.0 expectation strict on purpose, so the test fails.

Change

TestUtils.awaitStartOfSecond() waits for the next second when the clock is past the first 200 ms of the current one. The setup of both view test classes calls it, and so does SessionImplTests.view_stopStartedAndNext, which expects 0.0 from a view stopped by the next one. The SDK and the assertions are unchanged; the reference SDK fixed the same flake the same way (alignToSecondBoundary in its test utilities).

Verified

  • The two view classes, two runs on Java 8: 46 of 46 tests, 58.7 s against 55.1 s before (about 4 s more).
  • With SessionImplTests: 93 of 93.
  • What is left: a test whose view calls stall for most of a second can still cross a boundary.

🤖 Generated with Claude Code

A view's duration is the difference of two whole-second timestamps, so a
view stopped right after it started reports 1 s whenever the two calls
fall on either side of a second boundary, and the strict 0.0 duration
checks failed on busy runners ("0.0 expected duration, got 1.0"). The
view test classes now wait in their setup until the clock is within the
first 200 ms of a second.
@github-actions

Copy link
Copy Markdown

Dependency security scan

Scanned 25 resolved dependencies, failing on HIGH and above.

No known vulnerabilities in 25 resolved dependencies.

Result: passed

Full run log

@github-actions

Copy link
Copy Markdown

Unit Test Results 🚀

739 tests  ±0   739 ✅ ±0   2m 51s ⏱️ -1s
 64 suites ±0     0 💤 ±0 
 64 files   ±0     0 ❌ ±0 

Results for commit 5ce4970. ± Comparison against base commit a261452.

@arifBurakDemiray
arifBurakDemiray marked this pull request as ready for review October 23, 2026 08:51
@github-actions

Copy link
Copy Markdown

Code coverage

module lines branches
sdk-java 89.8% (7232/8054) 80.0% (3202/4000)
sdk-java-ui 70.5% (968/1374) 63.2% (499/790)

No changed file appears in a coverage report. Either none of the changed Java files are in a measured module, or they are test sources.

Least covered classes (10 shown)
class module lines covered uncovered
ly.count.sdk.java.ui.JavaFxContentDisplay sdk-java-ui 10.6% (23/216) 193
ly.count.sdk.java.ui.FxSurfaces sdk-java-ui 74.8% (172/230) 58
ly.count.sdk.java.ui.ExternalBrowser sdk-java-ui 55.0% (66/120) 54
ly.count.sdk.java.internal.SDKCore sdk-java 89.0% (363/408) 45
ly.count.sdk.java.ui.JavaFxWidgetHost sdk-java-ui 81.2% (190/234) 44
ly.count.sdk.java.internal.ModuleRequests sdk-java 75.9% (132/174) 42
ly.count.sdk.java.internal.ModuleContent sdk-java 89.7% (280/312) 32
ly.count.sdk.java.internal.TimedEvents sdk-java 60.8% (48/79) 31
ly.count.sdk.java.internal.SessionImpl sdk-java 90.1% (274/304) 30
ly.count.sdk.java.internal.SDKStorage sdk-java 84.5% (158/187) 29

Full run log

@arifBurakDemiray
arifBurakDemiray merged commit 025fd6a into staging Oct 23, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant