Skip to content

fix(#794): tolerate a minute-boundary race in the tz clock-parity test - #795

Merged
fdaviddpt merged 1 commit into
mainfrom
fix/794
Sep 26, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
fix/794

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

test_remember_date_into_matches_remember_date_with_tz read the clock twice (once via _remember_date, once via _remember_date_into) and asserted the two minute-resolution strings were exactly equal. A minute boundary crossing between the two reads made the assertion fail even though both functions were correct -- observed once on the macOS 3.9 CI leg (the slowest), at commit bb71467, job 108405447527: AssertionError: {'NEW': '2026-09-26 12:40 UTC', 'OLD': '2026-09-26 12:39 UTC'}.

Fixed by retrying once on a mismatch and re-asserting equality on the second pair, mirroring the sibling test three lines above it in the same file (test_remember_date_into_matches_remember_date_builtin_path), which already carries this exact pattern for the same race on the untz'd variant. The assertion stays an exact ==; only the race is tolerated, never by widening the comparison to in (OLD, OLD2).

No production code changed -- test-only fix, plus a changelog.d/794.fixed.md fragment.

Evidence. The true red state is the CI failure quoted above, not something reproduced on demand locally (the race is non-deterministic and rare -- one occurrence in the project's CI history so far). Green: pytest tests/test_fast_path_subshells_511.py -v passes 9/9 post-fix. A standalone synthetic script fed fabricated OLD/NEW values reproducing the same boundary crossing confirmed the pre-fix assertion fails on them and the new retry logic passes given a clean second sample while still catching a genuine deterministic bug on both attempts.

Self-reviewed by two concurrent spawned reviewers (Explore, oss:auditor); both returned NO FINDINGS, tree_snapshot clean.

Closes #794.

[AI-generated]

test_remember_date_into_matches_remember_date_with_tz read the clock twice
(once via `_remember_date`, once via `_remember_date_into`) and asserted the
two minute-resolution strings were equal. A minute boundary crossed between
the two reads made the assertion fail even though both functions were
correct -- observed on the macOS 3.9 CI leg, the slowest one, where the
subshell fork on bash 3.2 widens the gap.

Retry once on a mismatch, mirroring the sibling
test_remember_date_into_matches_remember_date_builtin_path test's existing
pattern three lines above it: the assertion stays exact (`==`, no `in`
tolerance), only the race is absorbed by re-running the whole script pair.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fdaviddpt
fdaviddpt merged commit e245e50 into main Sep 26, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/794 branch September 26, 2026 14:02
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.

test_remember_date_into_matches_remember_date_with_tz flakes across a minute boundary

1 participant