Skip to content

Make ctx.new_guid() return a standard UUID v4#26

Merged
tjgreen42 merged 5 commits into
mainfrom
fix/new-guid-uuid-v4
Jun 8, 2026
Merged

Make ctx.new_guid() return a standard UUID v4#26
tjgreen42 merged 5 commits into
mainfrom
fix/new-guid-uuid-v4

Conversation

@tjgreen42

@tjgreen42 tjgreen42 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

generate_guid() built its value from SystemTime nanoseconds plus a thread-local counter, which produced low-entropy, structured output — the leading groups were always zero and the remainder was largely sequential. This switches to uuid::Uuid::new_v4().

new_guid() was already a regular activity whose result is recorded in history, so determinism comes from that recorded value, not from how it's generated. Replay is unaffected.

generate_guid() derived its value from SystemTime nanoseconds plus a
thread-local counter, which produced low-entropy, structured output (the
leading groups were always zero and the rest was largely sequential).
Switch to uuid::Uuid::new_v4(). The value is still recorded in history,
so replay stays deterministic.
@tjgreen42 tjgreen42 marked this pull request as draft June 5, 2026 19:22
@tjgreen42 tjgreen42 force-pushed the fix/new-guid-uuid-v4 branch from 78e0389 to ebe12b1 Compare June 5, 2026 19:25
tjgreen42 added 2 commits June 5, 2026 19:38
Existing test_new_guid and test_new_guid_as_activity_input_replays_correctly
already cover uniqueness and replay; the removed test mostly asserted uuid
crate behavior.
- Reword residual 'deterministic GUID' doc references to 'random/replay-safe'.
- Restore a minimal UUID v4 structural guard in test_new_guid so a revert to
  the old predictable scheme would be caught.
- Generate SQLite provider lock tokens with uuid::Uuid::new_v4() instead of
  nanos + pid.
@tjgreen42 tjgreen42 marked this pull request as ready for review June 5, 2026 20:17
@tjgreen42 tjgreen42 requested review from affandar and pinodeca June 5, 2026 20:17
Comment thread tests/system_calls_test.rs Outdated
pinodeca
pinodeca previously approved these changes Jun 5, 2026

@pinodeca pinodeca left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for 1 nit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tjgreen42 tjgreen42 merged commit bad3f05 into main Jun 8, 2026
2 checks 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.

3 participants