Skip to content

fix(tests): tolerate .abbreviated formatter "3m ago" output#71

Merged
variablefate merged 1 commit intomainfrom
fix/relative-date-formatter-test-flake
Apr 28, 2026
Merged

fix(tests): tolerate .abbreviated formatter "3m ago" output#71
variablefate merged 1 commit intomainfrom
fix/relative-date-formatter-test-flake

Conversation

@variablefate
Copy link
Copy Markdown
Owner

Summary

RoadFlareTests/PresentationTypesTests/lastLocationTimestampLabelIsRelativeString flakes under parallel xcodebuild test but passes in isolation. Production code uses RelativeDateTimeFormatter with unitsStyle = .abbreviated and an injected en_US locale — that combination produces either "3 min. ago" or "3m ago" depending on the runner process's CFLocale/ICU resource state. Fresh simulator "Clone N" processes spawned for parallel testing consistently produce the narrower "3m ago" form, which the previous label.contains("min") assertion rejected.

The hypothesis that another test was mutating shared locale state turned out not to be the cause — RelativeDateTimeFormatter.UnitsStyle has no .narrow member, no test mutates global locale, and a single-process concurrent stress test on macOS Foundation produces "3m ago" 200/200 deterministically. The variance is process-level resource initialization, not state mutation.

Production behavior is intentional (.abbreviated is the right UX for that label), so the fix tightens only the test assertion to accept either output:

#expect(label.contains("min") || label.contains("m ago"))

Test plan

  • Reproduced the flake on main — full parallel suite fails with (label → "3m ago").contains("min") on first attempt
  • Full parallel xcodebuild test (200 unit tests) — target test passes after fix
  • xcodebuild test -only-testing:RoadFlareTests/DriverDetailViewState — passes
  • Full unit-test suite under parallel testing (-skip-testing:RoadFlareUITests) — passes
  • gitnexus_detect_changes — risk: low, 0 affected processes

Notes

While reproducing, I observed 4 unrelated pre-existing failures in ChatCoordinatorTests, RideCoordinatorTests, and a RoadFlareUITests-Runner accessibility-load timeout that did not recur on subsequent runs. Those look like separate async-timing flakes worth tracking but are out of scope for this PR.

🤖 Generated with Claude Code

`RelativeDateTimeFormatter` with `.abbreviated` and an injected en_US
locale produces either "3 min. ago" or "3m ago" depending on the
runner process's CFLocale/ICU resource state. Fresh simulator clones
spawned by parallel `xcodebuild test` consistently produce the
narrower form, which made `lastLocationTimestampLabelIsRelativeString`
flake under parallel load while passing in isolation.

Accept either form rather than pinning a wider style — `.abbreviated`
output is intentional UX for the production label.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@variablefate
Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@variablefate variablefate merged commit 918a81e into main Apr 28, 2026
@variablefate variablefate deleted the fix/relative-date-formatter-test-flake branch April 28, 2026 18:35
variablefate added a commit that referenced this pull request Apr 29, 2026
Bumps CURRENT_PROJECT_VERSION from 1 to 2 across all 8 build
configurations in project.pbxproj. Build 1 was the live 1.0 build
uploaded 2026-04-16 20:25 PT; build 2 is the 1.0.1 candidate
shipping the merged work since (#66, #69, #71, #76, #84, #85, #86).

Per RELEASING.md, tag will land after App Store Connect confirms
upload acceptance, not before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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