fix(sync): use microseconds for MAX_TIMESTAMP_FUTURE_SHIFT#99
Merged
dignifiedquire merged 1 commit intoMay 8, 2026
Merged
Conversation
Wall times are Unix epoch microseconds; deriving the cap from milliseconds limited future slack to ~600ms instead of 10 minutes. Add a regression test that inserts a 1s-ahead entry and asserts round-trip from the store.
dignifiedquire
approved these changes
May 8, 2026
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.
Description
Fixes future timestamp validation so the allowed skew matches the documented ten-minute policy.
Entry timestamps and
system_time_now()are Unix epoch microseconds.MAX_TIMESTAMP_FUTURE_SHIFTwas derived using milliseconds, so the effective cap was about 600 ms instead of ten minutes. The constant now usesDuration::from_secs(1).as_micros()so it is expressed in the same unit as wall time.Adds
test_future_timestamp_accepts_one_second_skew, a regression test that would fail if the slack constant were still on millisecond scale: it inserts an entry one second in the future, then asserts the stored entry matches (round-trip), not only that insert succeeds.Breaking Changes
None
Notes & open questions
MAX_TIMESTAMP_FUTURE_SHIFTunit mismatch causesvalidate_entryto reject entries from peers with >600 ms wall-clock skew #97Change checklist