Repository navigation
fix: describe every UUID with the same fields in getInfo() and the validators - #125
Merged
Merged
Conversation
v1 wrote time_hi from the wrong bits, v6 laid the time field out 4 bits off, and both computed the 60-bit tick count as a number past 2^53, so low bits were lost. Both now build the ticks as a bigint and match the RFC 9562 test vectors. Fixes #124
…lidators getInfo(), validate() and validateDetailed() read the custom-variant bit positions on every id, so RFC ids got a subvariant, issuer ID and category from unrelated bits, and the validator report ignored the subvariant and timestamp layout. One decoder (src/lib/describe.mjs) now describes every id with the same keys, null where the variant doesn't define a field: - RFC ids report their RFC version and, for v1, v6 and v7, their timestamp; getTimestamp(), the new getTimestampUnit() and UUID.compare cover them too - getInfo() adds variantFamily, timestampUnit and date - Nil and Max are RFC ids; Max no longer reads as a custom id - getIssuerID()/getIssuerCategory() are null except on Issuer Variants - validator fields are the getInfo() fields plus the raw timestamp bit fields, named after the spec (timestampSegmentA, timestampLayout); timestampLower63, reservedBit69, actualTimestamp and categoryValidation are gone - entropy counts the real random bits per variant - one issuer category name everywhere, and issuer IDs 512-1023 warn about the future RFC range again Fixes #123
…ily name our ids isUUID() returned false for every RFC id because it only checked for variant 111. It now means a well-formed UUID: RFC versions 1-8, Nil, Max and CLDMV ids. The new isCLDMV() (and getInfo().isCLDMV) carries the old meaning, and variantFamily names variant 111 "CLDMV" instead of "Custom". Refs #123
getInfo().variant was the raw bits 64-66, which read 4 or 5 on an RFC id depending on a data bit. It is now the family's number: CLDMV 7, RFC 2 (Nil and Max included), Microsoft 6, NCS 0. getVariant() still returns the raw bits. fullVersion is variant.subvariant.version as numbers, 0 for a part the id doesn't have: "7.0.6" for TB, "7.1.1" for IA, "2.0.4" for RFC v4. Refs #123
docs/reference/uuid-details.md shows what every detail method returns for each RFC version, the Nil, Max and Microsoft ids, and each kind of CLDMV id. npm run docs:details regenerates it from the library, and a test fails when the committed page is out of date.
…ucible v7() takes no random input, so the page changed on every run. The generator now sets the id's random bits itself.
npm run docs:build renders docs/dist/index.html from the same generator as the Markdown page. .github/workflows/docs.yml builds it on pushes to master and deploys it with the GitHub Pages actions; the README links it at https://cldmv.github.io/uuid/ next to the Markdown version.
CodeQL's sensitive-data heuristic read UUID.DNS as a secret reaching the MD5/SHA-1 that RFC v3/v5 require (js/weak-cryptographic-algorithm). The generated ids are unchanged.
Shinrai
approved these changes
Nov 25, 2026
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getInfo(),validate()andvalidateDetailed()describe every UUID, RFC or CLDMV, with the same fields,nullwhere the id's variant doesn't have one.isUUID()means a well-formed UUID andisCLDMV()marks our ids;variantis the family number andfullVersionisvariant.subvariant.version. RFC v1/v6/v7 ids report their timestamp andUUID.compare()sorts them by time.UUID.v1()andUUID.v6()now write RFC 9562 timestamps and match the RFC test vectors.Also adds a generated UUID detail reference:
docs/reference/uuid-details.md(kept in sync by a test) and an HTML version published to GitHub Pages by.github/workflows/docs.yml, both linked from the README.Resolves #123, resolves #124