From 080f085e8c6fa48e0ecd2172792fd01f1df635e2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Oct 2026 08:50:25 +0000 Subject: [PATCH] feat(uuid-v8): shared Rust generator for ADR-008 profiles T and C (P1) tools/uuid-v8 (crate estate-uuid-v8, MPL-2.0): the Rust member of the "shared profile T and C generators per estate language" in ADR-008 P1, producing the same ids as scripts/uuid-v8.js. - profile_t(): library v7 with the version nibble set to 8 (the only bit operation ADR-008 permits); strictly increasing within a process. - profile_c(domain, name) / profile_c_bytes(): bytes 0..15 of SHA-256(domain ":" name), version 8, variant 10; domain is non-empty printable ASCII without ':' (same rule as uuid-v8.js). - from_deed_body("domain:name"): splits on the first ':'. - from_v7(id): the P2 alias, flipping only the version nibble. - uuid-v8 binary with uuid-v8.js's interface and exit codes. Tests: cargo test checks profile C against vectors from the independent sha256sum oracle of scripts/tests/bun/uuid-v8-gen-test.sh (a variant-mask mutant fails two of them), plus T layout/order/timestamp, from_v7 and the domain rules. scripts/tests/rust/uuid-v8-rs-test.sh runs the binary against the same oracle, against uuid-v8.js (bun) and through check-uuid-v8.sh --strict: 20/20 locally. Both run in deed-conformance.yml; no new actions, so actions.lock is unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019a95kk88TZ1iegsBK3kox3 --- .github/workflows/deed-conformance.yml | 9 + scripts/tests/rust/uuid-v8-rs-test.sh | 83 ++++++++ tools/uuid-v8/Cargo.lock | 267 +++++++++++++++++++++++++ tools/uuid-v8/Cargo.toml | 21 ++ tools/uuid-v8/README.adoc | 45 +++++ tools/uuid-v8/src/lib.rs | 219 ++++++++++++++++++++ tools/uuid-v8/src/main.rs | 35 ++++ 7 files changed, 679 insertions(+) create mode 100755 scripts/tests/rust/uuid-v8-rs-test.sh create mode 100644 tools/uuid-v8/Cargo.lock create mode 100644 tools/uuid-v8/Cargo.toml create mode 100644 tools/uuid-v8/README.adoc create mode 100644 tools/uuid-v8/src/lib.rs create mode 100644 tools/uuid-v8/src/main.rs diff --git a/.github/workflows/deed-conformance.yml b/.github/workflows/deed-conformance.yml index 7744b8b65..3385905dd 100644 --- a/.github/workflows/deed-conformance.yml +++ b/.github/workflows/deed-conformance.yml @@ -26,6 +26,8 @@ on: - '.github/workflows/deed-conformance.yml' - 'scripts/uuid-v8.js' - 'scripts/tests/bun/**' + - 'tools/uuid-v8/**' + - 'scripts/tests/rust/**' pull_request: paths: - '**.deed' @@ -33,6 +35,8 @@ on: - '.github/workflows/deed-conformance.yml' - 'scripts/uuid-v8.js' - 'scripts/tests/bun/**' + - 'tools/uuid-v8/**' + - 'scripts/tests/rust/**' workflow_call: inputs: require-files: @@ -80,6 +84,11 @@ jobs: - name: uuid-v8 generator against an independent sha256sum oracle (#u8 = profile C) if: github.repository == 'hyperpolymath/standards' run: bash scripts/tests/bun/uuid-v8-gen-test.sh + - name: uuid-v8 Rust generator (tools/uuid-v8) against the same oracle, the bun generator and check-uuid-v8.sh + if: github.repository == 'hyperpolymath/standards' + run: | + cargo test --quiet --locked --manifest-path tools/uuid-v8/Cargo.toml + bash scripts/tests/rust/uuid-v8-rs-test.sh - name: lint every committed deed env: REQUIRE_FILES: ${{ inputs.require-files || false }} diff --git a/scripts/tests/rust/uuid-v8-rs-test.sh b/scripts/tests/rust/uuid-v8-rs-test.sh new file mode 100755 index 000000000..bdb1d67ed --- /dev/null +++ b/scripts/tests/rust/uuid-v8-rs-test.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# +# Proves tools/uuid-v8 (the shared Rust ESTATE-UUID-V8 generator, ADR-008) +# emits the same ids as the independent oracle in +# scripts/tests/bun/uuid-v8-gen-test.sh (sha256sum and shell nibble +# arithmetic), the same ids as scripts/uuid-v8.js when bun is present, and ids +# that check-uuid-v8.sh --strict accepts. +# +# Lives below scripts/tests/ so run-shell-test-suite.sh (maxdepth 1) does not +# discover it; deed-conformance.yml runs it next to the bun generator test. +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/../../.." && pwd)" +MANIFEST="$ROOT/tools/uuid-v8/Cargo.toml" +CHECK="$ROOT/scripts/check-uuid-v8.sh" +WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT +pass=0; fail=0 + +cargo build --quiet --release --locked --manifest-path "$MANIFEST" +GEN="$ROOT/tools/uuid-v8/target/release/uuid-v8" + +# Record one assertion: check