Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/UUID-V7-ESTATE-STANDARD.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ and can be run against a repository or a list of files. It is intentionally a
supplement to type-aware tests: absence of a literal does not prove that a
runtime generator is compliant.

Julia project files are the one typed external-identifier context the checker
recognises by itself. The General registry assigns every Julia package its UUID
and Julia does not let a dependant change it, so the `[deps]`, `[weakdeps]` and
`[extras]` tables of `Project.toml` / `JuliaProject.toml`, and every
`Manifest*.toml` / `JuliaManifest*.toml`, are not scanned. A package's own
top-level `uuid =` is still checked: a new estate Julia package MUST mint it as
v7 before it is first registered, because the registry fixes it from then on.

== References and ownership

The specification is RFC 9562, *Universally Unique IDentifiers (UUIDs)*,
Expand All @@ -146,3 +154,7 @@ Revision history:

* 2026-09-29 — v1.0: UUID v7 made the sole estate UUID standard; migration and
enforcement requirements established.
* 2026-10-02 — v1.1: the checker no longer scans registry-assigned Julia
dependency UUIDs (Project.toml dependency tables, Manifests). Migration
impact: no repository that passed before fails now; Julia repositories whose
only findings were dependency UUIDs now pass. Package-own UUIDs stay governed.
21 changes: 20 additions & 1 deletion scripts/check-uuid-v7.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@
set -- .
fi

# Print the text of a file that is subject to the v7 rule.
#
# Julia project files name each dependency by the UUID the General registry
# assigned it. Those are external identifiers (the standard: preserve and type
# explicitly), so the [deps], [weakdeps] and [extras] tables of a
# Project.toml / JuliaProject.toml are not scanned, and neither is a Manifest
# (every entry is a resolved dependency). Everything else in a project file,
# including the package's own top-level `uuid =`, is still checked.
scannable_text() {
case "${1##*/}" in
Manifest.toml|Manifest-v*.toml|JuliaManifest.toml|JuliaManifest-v*.toml) ;;
Project.toml|JuliaProject.toml)
awk '/^[[:space:]]*\[/ { t = $0; gsub(/[[:space:]]/, "", t); sub(/#.*/, "", t)
skip = (t == "[deps]" || t == "[weakdeps]" || t == "[extras]") }
!skip' "$1" ;;

Check warning on line 24 in scripts/check-uuid-v7.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_standards&issues=AaD9JXig0W6qUPVfv_pL&open=AaD9JXig0W6qUPVfv_pL&pullRequest=1138
*) cat "$1" ;;

Check warning on line 25 in scripts/check-uuid-v7.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Assign this positional parameter to a local variable.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_standards&issues=AaD9JXig0W6qUPVfv_pM&open=AaD9JXig0W6qUPVfv_pM&pullRequest=1138
esac
}

# A UUID literal is v7 only when the version nibble is 7 and the variant nibble
# is 8, 9, a, or b. Keep this POSIX so it can run in every estate checkout.
status=0
Expand All @@ -14,7 +33,7 @@
[ -f "$file" ] || continue
# Ignore this checker and documentation examples of non-v7 UUIDs; scan source
# and data files, not binary files.
case "$file" in

Check failure on line 36 in scripts/check-uuid-v7.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a default case (*) to handle unexpected values.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_standards&issues=AaD9JXig0W6qUPVfv_pN&open=AaD9JXig0W6qUPVfv_pN&pullRequest=1138
*/.git/*|*/check-uuid-v7.sh) continue ;;
esac
if grep -IEni -- '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' "$file" >/dev/null 2>&1; then
Expand All @@ -28,7 +47,7 @@
*) printf '%s: non-v7 UUID literal (%s)\n' "$file" "$uuid" >&2; status=1 ;;
esac
done <<EOF
$(grep -IEni -- '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' "$file" || true)
$(scannable_text "$file" | grep -Ei -- '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' || true)
EOF
fi
done <<EOF
Expand Down
18 changes: 18 additions & 0 deletions scripts/tests/uuid-v7-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
expect() { # expect <wanted-exit> <label> (runs the checker over $WORK/t)
local want="$1" label="$2" got=0
bash "$SCRIPT" "$WORK/t" >"$WORK/out" 2>&1 || got=$?
if [ "$got" = "$want" ]; then pass=$((pass+1)); echo " ok $label"

Check failure on line 23 in scripts/tests/uuid-v7-test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_standards&issues=AaD9JXVD0W6qUPVfv_pJ&open=AaD9JXVD0W6qUPVfv_pJ&pullRequest=1138
else fail=$((fail+1)); echo " FAIL $label (wanted exit $want, got $got)"; sed 's/^/ /' "$WORK/out"; fi
}
fresh() { rm -rf "$WORK/t"; mkdir -p "$WORK/t"; }
Expand Down Expand Up @@ -58,5 +58,23 @@
fresh; printf '\000%s\n' "$V4" > "$WORK/t/blob.bin"
expect 0 "a v4 inside a binary file is ignored"

# Julia project files: registry-assigned dependency UUIDs are external IDs.
fresh; printf 'name = "P"\nuuid = "%s"\n\n[deps]\nX = "%s"\n\n[weakdeps]\nY = "%s"\n\n[extras]\nZ = "%s"\n' \
"$V7_8" "$V4" "$V4" "$V4" > "$WORK/t/Project.toml"
expect 0 "v4 dependency UUIDs in Project.toml [deps]/[weakdeps]/[extras] are accepted"

fresh; printf 'name = "P"\nuuid = "%s"\n\n[deps]\nX = "%s"\n' "$V4" "$V7_8" > "$WORK/t/Project.toml"
expect 1 "a v4 package's own uuid in Project.toml is rejected"

fresh; printf 'uuid = "%s"\n[ deps ] # comment\nX = "%s"\n\n[compat]\n\n[sources]\nY = "%s"\n' \
"$V7_8" "$V4" "$V4" > "$WORK/t/JuliaProject.toml"
expect 1 "the exemption ends at the next table header"

fresh; printf '[deps]\nX = "%s"\n' "$V4" > "$WORK/t/deps.toml"
expect 1 "a [deps] table outside a Julia project file is not exempt"

fresh; mkdir -p "$WORK/t/docs"; printf '[[deps.X]]\nuuid = "%s"\n' "$V4" > "$WORK/t/docs/Manifest-v1.12.toml"
expect 0 "a v4 in a Julia Manifest is accepted"

echo "PASS=$pass FAIL=$fail"
[ "$fail" -eq 0 ]

Check failure on line 80 in scripts/tests/uuid-v7-test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=hyperpolymath_standards&issues=AaD9JXVD0W6qUPVfv_pK&open=AaD9JXVD0W6qUPVfv_pK&pullRequest=1138
Loading