Skip to content

THRIFT-5939: Replace GUID generation with stable UUID algorithm#3366

Merged
Jens-G merged 1 commit intoapache:masterfrom
Jens-G:feature/delphi-uuid-v8-deterministic-guids
Mar 27, 2026
Merged

THRIFT-5939: Replace GUID generation with stable UUID algorithm#3366
Jens-G merged 1 commit intoapache:masterfrom
Jens-G:feature/delphi-uuid-v8-deterministic-guids

Conversation

@Jens-G
Copy link
Copy Markdown
Member

@Jens-G Jens-G commented Mar 27, 2026

Replace the Windows-only random CoCreateGuid() GUID generation with deterministic UUIDv8 (RFC 9562) derived from SHA-256 over a namespace hierarchy (DNS → thrift.apache.org → program → interface metadata).

Uses SHA-256 implementation by Brad Conte (brad AT bradconte.com), which is explicitly public domain (no copyright claimed). Source: https://github.com/B-Con/crypto-algorithms

  • sha256.h: Brad Conte's algorithm verbatim, inlined to a header-only file, macros prefixed THRIFT_SHA256_ to avoid collisions
  • Add generate_guid_v8() for services and structs using a canonical string covering: program namespace UUID, entity name, parent service hash (for inheritance), and function/field signatures with Thrift IDL type names
  • Add type_name_for_guid(), canonical_service_string(), canonical_struct_string(), program_namespace_uuid() helpers
  • Add guid_v4 generator option to fall back to legacy random GUIDs (Windows only, for migration compatibility)
  • GUIDs are now emitted on all platforms, not just Windows
  • Add UuidV8Test.thrift fixture and CI step that validates determinism, UUIDv8 format, field-order sensitivity, and parent-service hash inclusion
  • LICENSE: add attribution section for the third-party public-domain code, following the existing pattern in the file

Replace the Windows-only random CoCreateGuid() GUID generation with
deterministic UUIDv8 (RFC 9562) derived from SHA-256 over a namespace
hierarchy (DNS → thrift.apache.org → program → interface metadata).

Uses SHA-256 implementation by Brad Conte (brad AT bradconte.com),
which is explicitly public domain (no copyright claimed).
Source: https://github.com/B-Con/crypto-algorithms

- sha256.h: Brad Conte's algorithm verbatim, inlined to a header-only file,
  macros prefixed THRIFT_SHA256_ to avoid collisions
- Add generate_guid_v8() for services and structs using a canonical
  string covering: program namespace UUID, entity name, parent service
  hash (for inheritance), and function/field signatures with Thrift
  IDL type names
- Add type_name_for_guid(), canonical_service_string(),
  canonical_struct_string(), program_namespace_uuid() helpers
- Add guid_v4 generator option to fall back to legacy random GUIDs
  (Windows only, for migration compatibility)
- GUIDs are now emitted on all platforms, not just Windows
- Add UuidV8Test.thrift fixture and CI step that validates
  determinism, UUIDv8 format, field-order sensitivity, and
  parent-service hash inclusion
- LICENSE: add attribution section for the third-party public-domain code,
  following the existing pattern in the file

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mergeable mergeable bot added delphi compiler github_actions Pull requests that update GitHub Actions code labels Mar 27, 2026
@Jens-G Jens-G merged commit 1e5fa4b into apache:master Mar 27, 2026
80 checks passed
@Jens-G Jens-G deleted the feature/delphi-uuid-v8-deterministic-guids branch March 28, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler delphi github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant