Skip to content

Harden UUIDv7 custom RNG guidance#75

Open
dexcompiler wants to merge 3 commits into
mainfrom
codex/72-uuidv7-rng-guidance
Open

Harden UUIDv7 custom RNG guidance#75
dexcompiler wants to merge 3 commits into
mainfrom
codex/72-uuidv7-rng-guidance

Conversation

@dexcompiler
Copy link
Copy Markdown
Owner

Summary

  • document the UuidV7Factory custom RNG contract in XML docs, README, the UUIDv7 guide, and changelog
  • add C# tests showing same-seed deterministic replay and derived deterministic streams for independent test nodes
  • add an F# property proving deterministic RNG replay for same seed/time/call pattern
  • replace HashCode.Combine in deterministic RNG derivation with a stable explicit integer mixer for replayable derived streams
  • make the UUIDv7 demo call out that deterministic RNG injection is for tests/simulations, not production UUID issuance

Why

UuidV7Factory accepts a caller-provided RandomNumberGenerator for deterministic testing and simulation replay. That capability is valuable, but identical deterministic RNG state plus identical time and call patterns intentionally reproduces UUID output. The production path should remain rng: null or an independent CSPRNG per factory.

Validation

  • dotnet test tests/Clockworks.Tests.csproj --filter UuidV7FactoryTests -v minimal
  • dotnet test property-tests/Clockworks.PropertyTests.fsproj --filter "Deterministic RNG replays UUID sequence" -v minimal
  • dotnet test Clockworks.sln -v minimal -m:1
  • DOCS_VERSION=dev npm run docs:build

Fixes #72

@dexcompiler dexcompiler marked this pull request as ready for review May 14, 2026 22:32
@dexcompiler dexcompiler changed the title [codex] Harden UUIDv7 custom RNG guidance Harden UUIDv7 custom RNG guidance May 14, 2026
@dexcompiler
Copy link
Copy Markdown
Owner Author

@codex[agent] review this pr

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Co-authored-by: dexcompiler <115876036+dexcompiler@users.noreply.github.com>
@Codex
Copy link
Copy Markdown

Codex AI commented May 14, 2026

@codex[agent] review this pr

Reviewed; added follow-up commit 16e1fa4 to (1) remove brittle claims about System.Random’s internal algorithm in deterministic RNG XML docs, (2) fix the stray // <summary> in the demo RNG, and (3) update the UUIDv7 guide snippet to avoid referencing a non-library DeterministicRandomNumberGenerator type. Targeted UUIDv7 replay tests still pass.

Repository owner deleted a comment from chatgpt-codex-connector Bot May 14, 2026
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.

Docs/Test: harden custom RNG guidance for UUIDv7 collision safety

2 participants