Files
Matt Van Horn 4ec0e96264 anisette: fix crash in date formatter (#422)
## What does this PR do?

Password login can terminate with an illegal-instruction crash on Linux,
leaving the user logged out. Anisette client time was formatted with
DateFormatter and an explicitly assigned Gregorian calendar. That
formatting path reaches Foundation’s NSCalendar bridging code, where the
reported crash occurs.

AnisetteData now formats client time with Date.ISO8601FormatStyle,
avoiding the DateFormatter calendar bridge. The header retains its UTC
timestamp format with whole seconds and a trailing Z. New parameterized
tests check the complete header dictionary for the Unix epoch, a year
boundary, leap day, and a timestamp with fractional seconds.

Fixes #184

## How was it tested?

Ran `swift test` locally on macOS for the xtool AnisetteData change; it
fails the same way on the base branch, so the failure predates this
change (it fails the same way on upstream/main).
`swift build` failed because an async call in a defer body prevented
compilation.
`swift test` failed during compilation with the same async-in-defer
error, so the tests did not run.
`repo_lint` ran without reported output.
`make lint SWIFTLINT_FLAGS='--reporter=github-actions-logging' | tee
swiftlint.log` ran with no lint diagnostics shown in the transcript.

The tests in `Tests/XToolTests/AnisetteDataTests.swift` fail without the
fix in the xtool AnisetteData change (checked by reverting the source
changes).

## AI tool usage

How much of the code in this PR was AI-assisted? (check one)

- [ ] **0** - No AI was used to write code
- [ ] **1** - I was assisted by AI in writing code. I reviewed the
finished result.
- [ ] **2** - I set the AI going and left it to it; nobody has read the
result - no review, or AI review only

AI was used for assistance.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Client timestamps now use a consistent UTC ISO 8601 format with dashed
dates, colon-separated times, and no fractional seconds. This applies to
timestamps with or without fractional seconds in the source date.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
4ec0e96264 · 2026-11-06 00:17:14 -05:00
History
..
2026-10-28 17:48:38 -04:00
2026-10-28 19:22:26 -04:00