Repository navigation
fix(update): pin the clock in the cold-install budget test - #1826
Open
fengyue-xve wants to merge 1 commit into
Open
fengyue-xve wants to merge 1 commit into
fengyue-xve wants to merge 1 commit into
Conversation
The test reads the real clock, and the cold-install budget is computed as ``fallback_deadline - now`` from a deadline derived from the same ``now``. That subtraction is ``900 +/- 1 ulp`` depending on the current ``time.monotonic()`` value (CI has produced both 899.9999999999999 on Linux and 900.0000000000002 on Windows), so the exact ``[90, 900]`` budget assertion fails on unlucky runners. The sibling window tests already pin ``time.monotonic``; do the same here so the budgets are deterministic.
This was referenced Oct 8, 2026
4 of 12 tasks
This branch has not been deployed
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.
Summary
test_cold_target_install_budget_preserves_regular_timeoutreads the real clock whileself_updatecomputes the cold-install budget asfallback_deadline - now, with the deadline derived from the samenow. That subtraction is900 +/- 1 ulpdepending on the currenttime.monotonic()value — CI has produced both899.9999999999999(Linux) and900.0000000000002(Windows) — so the exactbudgets == [90, 900]assertion fails on unlucky runners and passes on others without any code change.The sibling window tests already pin
time.monotonic; do the same here so the budgets are deterministic:Reproduced the mechanism directly:
(7777.7777 + 900) - 7777.7777 == 899.9999999999991.Target branch
develop(feature / fix — default)Type of change
Test plan
pytest tests/unit/infra/setup/test_self_update.py— 135 passedruff check/ruff format --checkon the file — cleanAdded/updated tests (the flaky test itself is now clock-independent)
make allpasses locally (not run end-to-end — the change is confined to one unit test file)