Skip to content

Add high-value property tests for HLC and vector clocks#37

Merged
dexcompiler merged 1 commit intomore-clockworks-property-testsfrom
copilot/sub-pr-36
Feb 8, 2026
Merged

Add high-value property tests for HLC and vector clocks#37
dexcompiler merged 1 commit intomore-clockworks-property-testsfrom
copilot/sub-pr-36

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

Adds FsCheck-based property tests for HlcTimestamp and VectorClock to verify critical distributed systems invariants.

HlcTimestampProperties.fs:

  • ToPackedInt64 truncates 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).
  • ToString and Parse round-trip — Parse(ts.ToString()) = ts.
  • ToString and TryParse round-trip — TryParse(ts.ToString()) succeeds and yields original value.
  • TryParse is non-throwing — TryParse(string?, out VectorClockMessageHeader) never throws for arbitrary input strings (and if it returns true, parsed.ToString() matches the input).
  • Operators are consistent with CompareTo — <, >, <=, >= results match CompareTo(HlcTimestamp).
  • WriteTo encoding preserves lexicographic ordering — big-endian 10-byte encoding compares lexicographically the same way as CompareTo(HlcTimestamp).

VectorClockProperties.fs:

  • Merge returns the upper bound when one input dominates — if a <= b then a.Merge(b) = b, if a >= b then a.Merge(b) = a, concurrent case ignored.
  • Merge is monotone with respect to inputs — merged result is never Before either input.
  • Increment is 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.

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
Copilot AI requested a review from dexcompiler February 8, 2026 13:39
@dexcompiler dexcompiler marked this pull request as ready for review February 8, 2026 13:58
@dexcompiler dexcompiler merged commit 5149c40 into more-clockworks-property-tests Feb 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants