Skip to content

Fix three more date-boundary flaky asserts in ReadSpineActiveDeviceTests - #609

Merged
ryanbr merged 1 commit into
mainfrom
fix/readspine-date-boundary-flaky-tests
Jul 19, 2026
Merged

Fix three more date-boundary flaky asserts in ReadSpineActiveDeviceTests#609
ryanbr merged 1 commit into
mainfrom
fix/readspine-date-boundary-flaky-tests

Conversation

@ryanbr

@ryanbr ryanbr commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Same class as #607's HugeImportFirstPaintStressTests fix, surfaced by the same cause: now that app-build runs StrandTests, these latent time-bombs actually execute.

The bug

ReadSpineActiveDeviceTests seeds HR spanning [base, base+N-1] and asserts latestDataDayStart() equals logicalDayStart(base). But latestDataDayStart resolves to MAX(ts) = base+N-1 (the newest sample), not the first. When a seed straddles the 04:00 logical-day rollover, base and base+N-1 land on different logical days and the assert fails in that window. This run hit it at 05:57 UTC (freshBase = now − 2h = 03:57freshBase+299 = 04:02), giving expected 2026-07-18 vs actual 2026-07-19.

Three asserts affected (lines 45/55/164). The #607 confirming run at 05:05 UTC happened to miss all three; this 05:57 run caught the fresh one — confirming they're wall-clock-flaky.

The fix

Assert against the latest sample's day, matching what the code returns: staleBase+299 / freshBase+299 (300-sample seeds), liveBase+599 (600-sample seed). Test-only — latestDataDayStart correctly returns the newest data's day; the tests were checking the wrong endpoint.

Verification

swiftc -parse clean; dispatched app-build (which now runs StrandTests) to confirm the suite is green. Note: the flake is wall-clock-dependent, so a single run can't reproduce the boundary window, but the fix makes expected equal logicalDayStart(MAX ts) by construction, which is exactly what the read resolves to.

Same class as the HugeImportFirstPaintStressTests fix (#607), surfaced now that
app-build runs StrandTests: these assert latestDataDayStart() equals the logical
day of the seed's FIRST sample (base), but latestDataDayStart resolves to MAX(ts)
= the LAST sample (base + N-1). When a seed spans the 04:00 logical-day rollover
(e.g. base=03:57 → base+299=04:02), the two land on different days and the assert
fails in that window — this run hit it at 05:57 UTC (freshBase = now-2h = 03:57).

Assert against the latest sample's day instead: staleBase+299 / freshBase+299
(300-sample seeds) and liveBase+599 (600-sample seed). Test-only; the code is
correct (latestDataDayStart rightly returns the newest data's day).
@ryanbr
ryanbr merged commit 7c80d7e into main Jul 19, 2026
3 checks passed
@ryanbr
ryanbr deleted the fix/readspine-date-boundary-flaky-tests branch July 19, 2026 06:03
DX23876 pushed a commit to DX23876/noop that referenced this pull request Jul 22, 2026
…sts (ryanbr#609)

Same class as the HugeImportFirstPaintStressTests fix (ryanbr#607), surfaced now that
app-build runs StrandTests: these assert latestDataDayStart() equals the logical
day of the seed's FIRST sample (base), but latestDataDayStart resolves to MAX(ts)
= the LAST sample (base + N-1). When a seed spans the 04:00 logical-day rollover
(e.g. base=03:57 → base+299=04:02), the two land on different days and the assert
fails in that window — this run hit it at 05:57 UTC (freshBase = now-2h = 03:57).

Assert against the latest sample's day instead: staleBase+299 / freshBase+299
(300-sample seeds) and liveBase+599 (600-sample seed). Test-only; the code is
correct (latestDataDayStart rightly returns the newest data's day).
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