Add high-value property tests for HLC and vector clocks#37
Merged
dexcompiler merged 1 commit intomore-clockworks-property-testsfrom Feb 8, 2026
Merged
Add high-value property tests for HLC and vector clocks#37dexcompiler merged 1 commit intomore-clockworks-property-testsfrom
dexcompiler merged 1 commit intomore-clockworks-property-testsfrom
Conversation
Copilot
AI
changed the title
[WIP] Add high-value property tests for HLC and vector clocks
Add high-value property tests for HLC and vector clocks
Feb 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.
Adds FsCheck-based property tests for HlcTimestamp and VectorClock to verify critical distributed systems invariants.
HlcTimestampProperties.fs:
ToPackedInt64truncates counter and node id — verifies packed 64-bit encoding masks Counter to 12 bits and NodeId to 4 bits (and preserves wall time in the tested domain).ToStringand Parse round-trip —Parse(ts.ToString())= ts.ToStringandTryParseround-trip —TryParse(ts.ToString())succeeds and yields original value.TryParseis non-throwing —TryParse(string?, out VectorClockMessageHeader)never throws for arbitrary input strings (and if it returns true,parsed.ToString()matches the input).CompareTo— <, >, <=, >= results matchCompareTo(HlcTimestamp).WriteToencoding preserves lexicographic ordering — big-endian 10-byte encoding compares lexicographically the same way asCompareTo(HlcTimestamp).VectorClockProperties.fs:
Mergereturns the upper bound when one input dominates — if a <= b thena.Merge(b)= b, if a >= b thena.Merge(b)= a, concurrent case ignored.Mergeis monotone with respect to inputs — merged result is never Before either input.Incrementis stable under merge with original —clock.Merge(clock.Increment(nodeId))= incremented and symmetric.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.