Skip to content

Set Guid version to 1 #5974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: rel/4.0
Choose a base branch
from
Draft

Set Guid version to 1 #5974

wants to merge 4 commits into from

Conversation

Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Jul 10, 2025

Fixes #5957

@Youssef1313 Youssef1313 marked this pull request as draft July 10, 2025 11:24
@Youssef1313 Youssef1313 marked this pull request as ready for review July 10, 2025 15:44
@Youssef1313 Youssef1313 marked this pull request as draft July 10, 2025 15:55
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Please upload report for BASE (rel/4.0@40ff27c). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...er.PlatformServices/ObjectModel/UnitTestElement.cs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             rel/4.0    #5974   +/-   ##
==========================================
  Coverage           ?   65.03%           
==========================================
  Files              ?      579           
  Lines              ?    32355           
  Branches           ?        0           
==========================================
  Hits               ?    21041           
  Misses             ?    11314           
  Partials           ?        0           
Flag Coverage Δ
Debug 65.03% <0.00%> (?)
integration 65.03% <0.00%> (?)
production 65.03% <0.00%> (?)
unit 65.03% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...er.PlatformServices/ObjectModel/UnitTestElement.cs 65.97% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Youssef1313
Copy link
Member Author

From discussion with @tannergooding, the version field can be used by tools to interpret Guid in certain ways.

https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-1

Version 1 for example is for UTC timestamps and network card MAC address encoding.
Version 3 is for values computed by MD5, etc etc.

If we want to embed our own version while following the RFC properly, we should use version 8, and reserve other bits for embedding our "own" version.

Note that in the past, I think we never followed the RFC accurately, as we just hashed and passed that to Guid constructor, meaning we are creating random versions, and none of the tools reading TRX today tries to interpret the version following the spec. So we were mostly okay, but still we violated the spec.

In addition, XxHash128 output is big endian, so it's best if we do new Guid(hash, bigEndian: true) instead of new Guid(hash).

Note that there is not much of a concern of us using extra bits for reserving our version with regards to collision probability, as it's still very unlikely to practically see collisions.

I think that summarizes our discussion @tannergooding (hopefully accurately/correctly).

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