Repository navigation
Conversation
test_a_multi_day_idle_gap_recomputes_even_when_time_never_decreases raced EPOCHSECONDS' 1-second wall-clock granularity against its own 1-second simulated day: _REMEMBER_LOG_LAST_EPOCH is captured at log.sh source time, before the test's first log() call, so ordinary CI startup jitter could itself cross a real 1-second boundary and trip the rollover branch a call early -- reproduced locally by injecting a controlled sleep between source and the first log() call, matching the CI failure signature exactly (FILE1 one day ahead, FILE2 with an empty date component from the exhausted date queue). Widened to a 5-second simulated day and an 8-second sleep, well clear of realistic startup jitter in both directions. No production code changed; the sibling midnight test uses the default 86400s threshold and was never at risk. Co-Authored-By: Max <noreply>
…onger shares Self-review finding (oss:auditor): after widening the sleep in the test above from 1.5s to 8s, this positive control's docstring still said it used "the SAME real sleep" as that test -- true before this fix, stale after it (its own sleep 1.5 is intentionally unchanged, since a 999999s threshold is nowhere near either margin). Says so explicitly instead. Co-Authored-By: Max <noreply>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #715.
test_a_multi_day_idle_gap_recomputes_even_when_time_never_decreases(tests/test_log_sh.py) was flaky on CI: its 1-second simulated day (_REMEMBER_LOG_DAY_SECONDS_TEST=1) and 1.5s sleep raced ordinary shell-startup jitter againstscripts/log.sh's EPOCHSECONDS-based idle-gap check. EPOCHSECONDS has 1-second wall-clock granularity, and_REMEMBER_LOG_LAST_EPOCHis captured at source time, before the test's own firstlog()call ever runs -- so a loaded CI runner could cross a real 1-second boundary during startup alone and trip the rollover branch a call early, producing exactly the observed failure (FILE1 one day ahead, FILE2 with an empty date component from the exhausted fake-date queue).Confirmed the mechanism with a standalone bash repro (not the pytest test itself, since injecting jitter there would defeat its own purpose) replicating log.sh's sourcing + fake-date-shim + log() mechanism: the old parameters reproduce the CI failure signature exactly under injected jitter; the new parameters (5s simulated day, 8s sleep) are correct with and without jitter. Widened the real test to match and ran it 3x plus alongside both siblings (3 passed). No production code changed --
scripts/log.shis untouched, per the issue's own acceptance criterion allowing a test-timing-only fix.Also fixed a sibling test's docstring, which claimed "the SAME real sleep" as the just-widened test -- true before this change, stale after. Below-bar-adjacent finding from self-review, fixed directly rather than filed.
Added
changelog.d/715.fixed.md.[AI-generated]