test(protocol): bracket the custody acceptance clock in the expiry test - #494
Merged
Merged
Conversation
The engine stamps a held frame's acceptance with the wall clock, and the test read its own clock only afterwards, then swept at that reading plus the hold minus one. Expiry is `now - accepted > hold`, so two milliseconds between acceptance and the read put the "inside the hold" sweep past it. A loaded CI runner failed it on Windows and macOS on the same day. Read the clock before and after acceptance: the inside sweep uses the earlier reading, the expiry sweep the later one, so neither depends on how long the runner took.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
a_held_frame_expires_at_the_end_of_the_hold_in_force(from #493) flakes on loaded CI runners. It failed on Windows (#485) and macOS (#487) on 2026-10-01, both PRs that do not touch custody.Cause
The engine stamps
accepted_at_msfrom the wall clock at the drop point. The test readUtc::now()only after acceptance and then swept atnow_ms + hold - 1. Expiry isnow - accepted > hold, so two milliseconds between acceptance and the test's read put the "inside the hold" sweep past the hold.Fix
Read the clock before and after acceptance. The inside sweep runs at
before_ms + hold, which is never more thanholdpast acceptance. The expiry sweep runs atafter_ms + hold + 1, which is always past it. Test-only change.Verification
inside the hold, custody.rs:639) and passes the fixed one.cargo fmt --all -- --checkis clean.