From 866931ef5bf9daaa8b2cee3ff4978980a0075927 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 12:49:54 +0000 Subject: [PATCH 1/4] chore(arrival-pack): refresh generator and regenerate CLAUDE.md from the deed Copies the newer arrival-pack generator (README, arrival-pack.ncl, extract.sh) and scripts/deed-field.sh (which extract.sh now calls with --typed) from rsr-template-repo, then runs just claude-md. The deed is untouched; its :repo-uuid #u5 literal is printed as written. Removes superseded generated text: the instruction to write #u5 literals, the 'registers into gv-clade-index' wording and the clade-as-identity header. Adds the generated proofs section and the chora/CLADE distinction. Verified: verify.sh reports in sync before and after; the seven generator files are byte-identical to rsr-template-repo's; no change outside the ARRIVAL-PACK markers in CLAUDE.md. just check-views and site-check fail identically on base and here (deed_lint pin mismatch against the local standards checkout, no asciidoctor); deed_clause_test passes on both. Not fixed (needs the owner-run ADR-008 P3 id migration or a deed edit): the deed's #u5 identity literal and its (ecosystem :not) mention of gv-clade-index. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01J4QvDfhy8tVtwc5dx1A3nD --- .machine_readable/arrival-pack/README.adoc | 19 ++-- .../arrival-pack/arrival-pack.ncl | 86 +++++++++++++++++-- .machine_readable/arrival-pack/extract.sh | 65 +++++++++++--- CLAUDE.md | 54 +++++++++++- scripts/deed-field.sh | 59 ++++++++++--- 5 files changed, 241 insertions(+), 42 deletions(-) diff --git a/.machine_readable/arrival-pack/README.adoc b/.machine_readable/arrival-pack/README.adoc index 8c857014..2729dac3 100644 --- a/.machine_readable/arrival-pack/README.adoc +++ b/.machine_readable/arrival-pack/README.adoc @@ -11,14 +11,16 @@ the repo's own machine-readable truth. [source] ---- _chora.deed extract.sh arrival-pack.ncl CLAUDE.md -+ anchors/ANCHOR ──▶ (deed → JSON, ──▶ (Nickel projection ──▶ region between - the thin reader) = the engine) BEGIN/END markers +(incl. its (anchor (deed → JSON, (Nickel projection region between + (golden-path))) ──▶ the thin reader) ──▶ = the engine) ──▶ BEGIN/END markers ---- Two halves of the generated region: * *Estate-common* — identical in every repo; the Manifesto doctrine + format-family - orientation + canon pointers + language policy. Pinned to a Manifesto SHA once + orientation + canon pointers + language policy + the proof guidance (which + prover for which obligation; moved in from hand-authored text on 2026-11-15 + so a wording fix reaches every repo by regenerating). Pinned to a Manifesto SHA once the wording is ratified (today: `DRAFT-unratified`). * *Repo-specific* — projected from this repo's deed: identity, IS / IS-NOT, position, constraints, golden path, state. @@ -52,7 +54,14 @@ just validate-claude-md # fail if the committed region drifted / was hand-edit * Estate-common doctrine is a *DRAFT* in the agent's words — owner to ratify into his voice, then pin to a `hyperpolymath/manifesto` commit SHA. -* `ECOSYSTEM.what-this-is-not` is empty here, so IS-NOT renders as "not yet - declared". Populating it is the boundary-erosion fix (the `lith` lesson). +* IS-NOT comes from the deed's `(ecosystem :not (…))`. When that list is empty, + IS-NOT renders as "not yet declared" and the deed should gain the list (the + boundary-erosion fix, the `lith` lesson). +* A repo's `(anchor (implementation-policy …))` renders as one "Anchor + override" line in the repo-specific part: what `:forbidden` lists, and any + language `:allowed` lists that the estate policy denies. An allowed language + the estate does not deny is no override and is not listed. The line is + hidden when there is neither. Controls: + `tests/workflows/arrival_pack_anchor_override_test.sh`. * The `(anchor)` clause currently encodes semantic-authority + golden-path; the recognised-drift / re-anchor-ledger aspect is a pending standards change. diff --git a/.machine_readable/arrival-pack/arrival-pack.ncl b/.machine_readable/arrival-pack/arrival-pack.ncl index 05f4a4ce..205e3323 100644 --- a/.machine_readable/arrival-pack/arrival-pack.ncl +++ b/.machine_readable/arrival-pack/arrival-pack.ncl @@ -20,6 +20,35 @@ let data = import "claude-md-data.json" in # owner's voice. Until then the estate-common block is explicitly DRAFT. let manifesto_pin = "DRAFT-unratified" in +# The estate deny list, stated once: the language-policy line below prints it, +# and the anchor override compares the anchor's allowed list against it. +let estate_denied = ["Nix", "Python", "Go", "TypeScript", "ReScript", "AGPL"] in + +# An anchor overrides the estate policy for its repo in two ways: it forbids +# what the estate permits, and it allows what the estate denies. Both are +# rendered, or the pack would tell an agent that an estate denial applies in a +# repo whose anchor allows the language (Codex review of sholes#13). A language +# the anchor allows and the estate does not deny is no override and is not +# listed. Names are compared as written. +let anchor_allows_denied = + std.array.filter (fun l => std.array.elem l estate_denied) data.anchor_allowed +in +let anchor_override = + let allows = std.string.join ", " anchor_allows_denied in + let forbids = std.string.join ", " data.anchor_forbidden in + let has_allows = std.array.length anchor_allows_denied > 0 in + let has_forbids = std.array.length data.anchor_forbidden > 0 in + let lead = "\n- **Anchor override** (ANCHOR) — This repo's anchor " in + let tail = ". The anchor overrides the estate policy above." in + if has_allows && has_forbids then + "%{lead}allows, where the estate policy above denies: %{allows}; it forbids: %{forbids}%{tail}" + else if has_allows then + "%{lead}allows, where the estate policy above denies: %{allows}%{tail}" + else if has_forbids then + "%{lead}forbids: %{forbids}%{tail}" + else "" +in + let provenance = "DEED@%{data.h_deed} ANCHOR@%{data.h_anchor}" in @@ -57,7 +86,7 @@ The descriptive family (working name *descriptiles*) describes what-is; the **co | File | Answers | |---|---| -| `%{data.deed}` | **CHORA**, the repo deed. Its `(identity)` `(clade)` `(lineage)` clauses say what this repo IS (registers into `gv-clade-index`); `(meta)` the architecture axes; `(agentic)` *may I act now?*; `(ecosystem)` where it sits and what it is not; `(status)` and `(maturity)` where it is now. Read fields with `scripts/deed-field.sh`. | +| `%{data.deed}` | **CHORA**, the repo deed. Its header `:repo-uuid` is the repo's one id, and `(identity)` and `(lineage)` say what this repo IS; a `(clade)` clause, when present, records the repo's clade placements: identity facts about where it sits, never its id and never an edict. chora-registry (formerly `gv-clade-index`) is authoritative for them; this repo's validation checks only that a declared clade is one of the 12 shelves; `(meta)` the architecture axes; `(agentic)` *may I act now?*; `(ecosystem)` where it sits and what it is not; `(status)` and `(maturity)` where it is now. Read fields with `scripts/deed-field.sh`. | | `(anchor)` | *Semantic authority + golden path* — what downstream may extend-not-redefine; if a recognised-drift / re-anchor marker is present, it **supersedes** accumulated context — read it first. | | `(neurosym)` | *Meaning* of operations — proof obligations. | | `(playbook)` | *How* permitted actions run. | @@ -65,6 +94,12 @@ The descriptive family (working name *descriptiles*) describes what-is; the **co | contractiles | Normative doctrine: **Intend** (north-star) · **Must** (invariants) · **Trust** (security) · **Adjust** (accessibility / inclusive design) — the integral core that holds strong; plus **Dust** (exnovation drift) · **Bust** (failure / breakage, not drift). | | k9 | *Validation*. Kennel (data) / Yard (pure eval) / Hunt (guarded exec). | +**The chora and CLADE are different things** (owner, 2026-11-15; standards A1 CHORA-SPEC §11.1): +- **The chora is ontological/metaphysical**: what this repo *is* and is meant to be in its context, code as identity: its intension (what defines it) and its extension (what it is an instance of). A `(clade …)` placement in it is an identity fact, copied from chora-registry, and the registry wins; never take one from a legacy file. +- **`CLADE.deed` is logical/epistemological**: how this repo's own content is ordered. Its scheme may be strict (Linnaean), judgement or none; membership may be single or multiple; a category is decided by its criterion. It is a descriptile and never identity; none is created until A7 M3 `clade` lands. +- **The aesthetic spans both**: what one experiences of the repo from outside, and in its ordering within. +- A legacy `CLADE.a2ml`, or A2ML named `CLADE.deed`, feeds the chora and `STATE.deed` (standards `clade-to-repo-deed.adoc`), never a `CLADE.deed`. + ## Canon pointers Estate data-format route: **kyq** handles exactly **TOML, Dhall, KYAML, I-JSON/JCS**. Preserve TOML/Dhall; migrate YAML/YML to KYAML and JSON variants @@ -74,27 +109,66 @@ grammars. Canon: `metadatastician/standards/3-practice/DATA-FORMAT-ROUTING.adoc` Planned support is not operational evidence: retain explicit transitional checks until a pinned kyq executable passes positive and negative tests. -- `hyperpolymath/standards` — the canon source. · `hyperpolymath/gv-clade-index` — the estate map (identity registry). · `hyperpolymath/manifesto` — this doctrine. +- `hyperpolymath/standards` — the canon source. · `hyperpolymath/gv-clade-index` (being renamed chora-registry) — the estate registry of repo identities and classification schemes. · `hyperpolymath/manifesto` — this doctrine. - **Before you invent, rename, or consolidate anything: STOP and check the map + IS-NOT.** ## Estate language policy (overridable per-repo via AGENTIC) -Deny: **Nix, Python, Go, TypeScript, ReScript, AGPL**. (Guix, not Nix.) +Deny: **%{std.string.join ", " estate_denied}**. (Guix, not Nix.) JavaScript runtime: **Bun** > Deno > pnpm > npm (last resort, permitted), from one `package.json` that carries every runtime's lock (`bun.lock`, `deno.lock`, `pnpm-lock.yaml`), all written by `js-runtimes regen` (owner ruling 2026-10-14, standards LANGUAGE-POLICY §1.3–§1.4). Deno is permitted again; `package-lock.json` stays refused. Use plain JavaScript when this tooling is needed. TypeScript and ReScript migrate to AffineScript. ## Asking the owner Put every question that needs the owner's decision through the selector (the AskUserQuestion tool), not as prose at the end of a report. Batch up to four per call, offer concrete options with the recommended one first, and say what each option would cause. +## Proofs — which prover for which obligation + +Normative source: `3-practice/PROOF-POLICY.adoc` in `hyperpolymath/standards`. +Read it there; `verification/proofs/README.adoc` maps it onto this repo. + +| Code or obligation | Verifier | +|---|---| +| Rust code | **Creusot** with **Pearlite** contracts, and **Verus**, by default and on the code (§1.2). Kani for `unsafe`/FFI seams and Aeneas for Rust that implements an Agda theorem run alongside, never instead | +| Ada code | **SPARK** | +| APIs, ABIs, engineering properties | **Idris2** | +| Theory | **Agda**, rechecked in **Rocq** and **Lean** (no Mathlib) | + +Always name Creusot, Pearlite and Verus in Rust verification plans and in +`docs/status/PROOF-STATUS.adoc`. Pearlite is Creusot's specification +language, not a third verifier. Plan scopes for both verifiers, and record +any that is unsupported, inapplicable or not yet run, with its reason; never +present an unexecuted check as a pass. Using both does not make two +independent witnesses (policy §1.2). + +Third-party code (crates such as Bevy, libraries, forks) is **not** converted +or re-proved. Where a proof relies on a dependency the prover does not check, +state the reliance as an `ASSUMED` boundary specification. Where the +dependency's whole import cone compiles under the prover's safe mode with zero +postulates, it is *checked, not assumed*: record the cone (root module, flags, +postulate count of zero, library name, version and pin) instead of an +`ASSUMED` row (policy §1.1). A cone with a postulate, or compiled outside safe +mode, is not checked. When choosing between dependencies that fit equally +well, prefer one that carries its own verification. A preference, not a gate. + +Proof Witness Grades are policy §8. They apply to *theory* theorems only: Agda +source, rechecked in Rocq and Lean (§8.1). Engineering proofs (Creusot, Verus, +SPARK, Idris2) are not graded on this ladder; they use the §5 tokens only. For +a theory theorem, `PWG-3` < `PWG-2i` < `PWG-2ii` < `PWG-1`, where `PWG-1` is +strongest. A theorem that does not reach `PWG-3` is `ungraded`, with no +qualifier. A grade is derived from receipts, never asserted. A "verified" or +"machine-checked" claim needs current receipts. Report a census with its +denominator, never a percentage. Always write the `PWG-` prefix: CRG, TRG, ARG +and FRG letters, and ECHIDNA's `TrustLevel`, are different schemes. + --- -# This repo: `%{data.canonical_name}` · clade `%{data.prefixed_name}` +# This repo: `%{data.canonical_name}` -- **Identity** — uuid `%{data.uuid}`; clade `%{data.clade_primary}` (secondary `%{data.clade_secondary}`); born %{data.born}; forge `%{data.forge_gh}`. +- **Identity** — chora id `%{data.uuid}`; clade: %{data.clade_aid}; born %{data.born}; forge `%{data.forge_gh}`. - **IS** — %{data.purpose} - **IS-NOT** — %{data.isnot} - **Where it sits** — pipeline position **%{data.pipeline_pos}**; chain `%{data.chain}`; coordination = `%{data.coordination}`. - **Constraints here** (AGENTIC) — fail-closed; evidence-per-step; no-silent-skip; rerun-after-fix; release-claim-requires-hard-pass. Never: banned langs (above), secrets, state files in repo root, AGPL. Details: the deed's `(bot-directives (methodology) (coverage) (debt))` clauses. -- **Golden path** (ANCHOR) — `%{data.golden_smoke}` → %{data.golden_crit}. +- **Golden path** (ANCHOR) — `%{data.golden_smoke}` → %{data.golden_crit}.%{anchor_override} - **State** — phase %{data.phase}; maturity %{data.maturity}. Milestones and next actions: `docs/status/ROADMAP.adoc`. diff --git a/.machine_readable/arrival-pack/extract.sh b/.machine_readable/arrival-pack/extract.sh index 4eeb4ebe..3972306b 100755 --- a/.machine_readable/arrival-pack/extract.sh +++ b/.machine_readable/arrival-pack/extract.sh @@ -46,21 +46,44 @@ items() { printf '%s' "$out" } +# lines PATH KEY -> the deed list :KEY ( … ), one item per line, "" when absent +lines() { + local out rc=0 + out="$(bash "$READ" --list "$DEED" "$1" "$2")" || rc=$? + [[ "$rc" -le 1 ]] || return "$rc" + printf '%s' "$out" +} + # hash12 -> short content hash of stdin (drift provenance) hash12() { sha256sum | cut -c1-12; } -# The identity is the deed's own TYPED literal (#u5"", later #u8""), -# never a computed hex uuid. The uuid is derived from that name and never -# stored (deed.abnf); printing its hex form put a version-5 literal in -# CLAUDE.md, which ADR-008's strict gate (owner ruling D320, standards -# governance job uuid-v7-conformance) rejects in every minted repo. The -# typed literal says what the identifier is, as ADR-008 asks of legacy ids, -# and follows the deed when it moves to version 8. +# The identity is the deed's own TYPED literal, printed as written: +# #uuid"" (minted once, A7 J11), or the computed #u8"". +# The pack never prints a derived hex form of a name literal: that once put a +# version 5 id in CLAUDE.md, which ADR-008's strict gate (owner ruling D320) +# rejects in every minted repo. The typed literal says what the identifier is, +# as ADR-008 asks. uuid_name="$(field '' repo-uuid)" uuid="" -[ -z "$uuid_name" ] || uuid="$(sed -n -E 's/^[[:space:]]*:repo-uuid[[:space:]]+(#u[0-9]+"[^"]*").*/\1/p' "$DEED" | head -1)" +if [[ -n "$uuid_name" ]]; then + # --typed keeps the tag and quotes, and reads the literal wherever the layout puts it + rc=0 + uuid="$(bash "$READ" --typed "$DEED" '' repo-uuid)" || rc=$? + [[ "$rc" -le 1 ]] || exit "$rc" + [[ "$uuid" =~ ^#u(uid|[0-9]+)\"[^\"]*\"$ ]] || uuid="" +fi [ -z "$uuid_name" ] || [ -n "$uuid" ] \ - || { echo "extract.sh: $(basename "$DEED") :repo-uuid is not a typed #u\"...\" literal" >&2; exit 2; } + || { echo "extract.sh: $(basename "$DEED") :repo-uuid is not a typed #uuid\"...\" or #u\"...\" literal" >&2; exit 2; } +# A version 5 identity is reported, not refused, here: this is the arrival-pack +# reader, not the gate. Standards A1 v0.4.5 C10 and T30 (ruling Q2) make +# v5-identity and u5-identity errors in every mode, and `just validate-rsr` +# and estate-rules (scripts/check-identity.sh) refuse them. The chora id is the +# v8 id of the birth path. +case "$uuid" in + '#u5"'*|'#uuid"'????????-????-5*) + echo "extract.sh: v5-identity: $(basename "$DEED") :repo-uuid $uuid is a version 5 id; the chora id is #uuid\"\" (standards A1 V8)" >&2 ;; + *) ;; # any other identity is printed as written, with nothing to report +esac # read_clauses -> the clauses this pack reads, one token per line. Hashing only # these keeps an unrelated deed edit (say a canon-pin bump) from reading as drift. @@ -81,9 +104,18 @@ isnot="$(items ecosystem not ' · ')" canonical_name="$(field '' canonical-name)" [ -n "$canonical_name" ] \ || { echo "extract.sh: $(basename "$DEED") has no :canonical-name" >&2; exit 2; } -prefixed_name="$(field identity prefixed-name)" +# Clade placements are identity facts about where the repo sits, never its id +# and never an edict; chora-registry is authoritative for them (standards A1 +# §11, ruling W10). The clause is optional. clade_primary="$(field clade primary)" clade_secondary="$(items clade secondary ', ')" +if [[ -z "$clade_primary" ]]; then + clade_aid="none declared (optional placement)" +elif [[ -n "$clade_secondary" ]]; then + clade_aid="$clade_primary (secondary $clade_secondary; placement)" +else + clade_aid="$clade_primary (placement)" +fi born="$(field lineage born)" forge_gh="$(field forges github)" purpose="$(field ecosystem purpose)" @@ -94,16 +126,17 @@ phase="$(field status phase)" maturity="$(field maturity level)" golden_smoke="$(items anchor/golden-path smoke-test-command ' && ')" golden_crit="$(items anchor/golden-path success-criteria '; ')" +# The anchor may override the estate language policy for this repo only. +anchor_forbidden="$(lines anchor/implementation-policy forbidden)" +anchor_allowed="$(lines anchor/implementation-policy allowed)" anchor_clause="$(bash "$READ" --clause "$DEED" anchor)" h_deed="$(read_clauses | hash12)" h_anchor="$(printf '%s\n' "$anchor_clause" | hash12)" jq -cnS \ --arg canonical_name "$canonical_name" \ - --arg prefixed_name "$prefixed_name" \ + --arg clade_aid "$clade_aid" \ --arg uuid "$uuid" \ - --arg clade_primary "$clade_primary" \ - --arg clade_secondary "$clade_secondary" \ --arg born "$born" \ --arg forge_gh "$forge_gh" \ --arg purpose "$purpose" \ @@ -118,4 +151,8 @@ jq -cnS \ --arg golden_crit "$golden_crit" \ --arg h_deed "$h_deed" \ --arg h_anchor "$h_anchor" \ - '$ARGS.named' + --arg anchor_forbidden "$anchor_forbidden" \ + --arg anchor_allowed "$anchor_allowed" \ + '$ARGS.named + | .anchor_forbidden |= (split("\n") | map(select(. != ""))) + | .anchor_allowed |= (split("\n") | map(select(. != "")))' diff --git a/CLAUDE.md b/CLAUDE.md index 113622a0..14f774ff 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -39,7 +39,7 @@ The descriptive family (working name *descriptiles*) describes what-is; the **co | File | Answers | |---|---| -| `mathesis_chora.deed` | **CHORA**, the repo deed. Its `(identity)` `(clade)` `(lineage)` clauses say what this repo IS (registers into `gv-clade-index`); `(meta)` the architecture axes; `(agentic)` *may I act now?*; `(ecosystem)` where it sits and what it is not; `(status)` and `(maturity)` where it is now. Read fields with `scripts/deed-field.sh`. | +| `mathesis_chora.deed` | **CHORA**, the repo deed. Its header `:repo-uuid` is the repo's one id, and `(identity)` and `(lineage)` say what this repo IS; a `(clade)` clause, when present, records the repo's clade placements: identity facts about where it sits, never its id and never an edict. chora-registry (formerly `gv-clade-index`) is authoritative for them; this repo's validation checks only that a declared clade is one of the 12 shelves; `(meta)` the architecture axes; `(agentic)` *may I act now?*; `(ecosystem)` where it sits and what it is not; `(status)` and `(maturity)` where it is now. Read fields with `scripts/deed-field.sh`. | | `(anchor)` | *Semantic authority + golden path* — what downstream may extend-not-redefine; if a recognised-drift / re-anchor marker is present, it **supersedes** accumulated context — read it first. | | `(neurosym)` | *Meaning* of operations — proof obligations. | | `(playbook)` | *How* permitted actions run. | @@ -47,6 +47,12 @@ The descriptive family (working name *descriptiles*) describes what-is; the **co | contractiles | Normative doctrine: **Intend** (north-star) · **Must** (invariants) · **Trust** (security) · **Adjust** (accessibility / inclusive design) — the integral core that holds strong; plus **Dust** (exnovation drift) · **Bust** (failure / breakage, not drift). | | k9 | *Validation*. Kennel (data) / Yard (pure eval) / Hunt (guarded exec). | +**The chora and CLADE are different things** (owner, 2026-11-15; standards A1 CHORA-SPEC §11.1): +- **The chora is ontological/metaphysical**: what this repo *is* and is meant to be in its context, code as identity: its intension (what defines it) and its extension (what it is an instance of). A `(clade …)` placement in it is an identity fact, copied from chora-registry, and the registry wins; never take one from a legacy file. +- **`CLADE.deed` is logical/epistemological**: how this repo's own content is ordered. Its scheme may be strict (Linnaean), judgement or none; membership may be single or multiple; a category is decided by its criterion. It is a descriptile and never identity; none is created until A7 M3 `clade` lands. +- **The aesthetic spans both**: what one experiences of the repo from outside, and in its ordering within. +- A legacy `CLADE.a2ml`, or A2ML named `CLADE.deed`, feeds the chora and `STATE.deed` (standards `clade-to-repo-deed.adoc`), never a `CLADE.deed`. + ## Canon pointers Estate data-format route: **kyq** handles exactly **TOML, Dhall, KYAML, I-JSON/JCS**. Preserve TOML/Dhall; migrate YAML/YML to KYAML and JSON variants @@ -56,7 +62,7 @@ grammars. Canon: `metadatastician/standards/3-practice/DATA-FORMAT-ROUTING.adoc` Planned support is not operational evidence: retain explicit transitional checks until a pinned kyq executable passes positive and negative tests. -- `hyperpolymath/standards` — the canon source. · `hyperpolymath/gv-clade-index` — the estate map (identity registry). · `hyperpolymath/manifesto` — this doctrine. +- `hyperpolymath/standards` — the canon source. · `hyperpolymath/gv-clade-index` (being renamed chora-registry) — the estate registry of repo identities and classification schemes. · `hyperpolymath/manifesto` — this doctrine. - **Before you invent, rename, or consolidate anything: STOP and check the map + IS-NOT.** ## Estate language policy (overridable per-repo via AGENTIC) @@ -67,16 +73,56 @@ Use plain JavaScript when this tooling is needed. TypeScript and ReScript migrat ## Asking the owner Put every question that needs the owner's decision through the selector (the AskUserQuestion tool), not as prose at the end of a report. Batch up to four per call, offer concrete options with the recommended one first, and say what each option would cause. +## Proofs — which prover for which obligation + +Normative source: `3-practice/PROOF-POLICY.adoc` in `hyperpolymath/standards`. +Read it there; `verification/proofs/README.adoc` maps it onto this repo. + +| Code or obligation | Verifier | +|---|---| +| Rust code | **Creusot** with **Pearlite** contracts, and **Verus**, by default and on the code (§1.2). Kani for `unsafe`/FFI seams and Aeneas for Rust that implements an Agda theorem run alongside, never instead | +| Ada code | **SPARK** | +| APIs, ABIs, engineering properties | **Idris2** | +| Theory | **Agda**, rechecked in **Rocq** and **Lean** (no Mathlib) | + +Always name Creusot, Pearlite and Verus in Rust verification plans and in +`docs/status/PROOF-STATUS.adoc`. Pearlite is Creusot's specification +language, not a third verifier. Plan scopes for both verifiers, and record +any that is unsupported, inapplicable or not yet run, with its reason; never +present an unexecuted check as a pass. Using both does not make two +independent witnesses (policy §1.2). + +Third-party code (crates such as Bevy, libraries, forks) is **not** converted +or re-proved. Where a proof relies on a dependency the prover does not check, +state the reliance as an `ASSUMED` boundary specification. Where the +dependency's whole import cone compiles under the prover's safe mode with zero +postulates, it is *checked, not assumed*: record the cone (root module, flags, +postulate count of zero, library name, version and pin) instead of an +`ASSUMED` row (policy §1.1). A cone with a postulate, or compiled outside safe +mode, is not checked. When choosing between dependencies that fit equally +well, prefer one that carries its own verification. A preference, not a gate. + +Proof Witness Grades are policy §8. They apply to *theory* theorems only: Agda +source, rechecked in Rocq and Lean (§8.1). Engineering proofs (Creusot, Verus, +SPARK, Idris2) are not graded on this ladder; they use the §5 tokens only. For +a theory theorem, `PWG-3` < `PWG-2i` < `PWG-2ii` < `PWG-1`, where `PWG-1` is +strongest. A theorem that does not reach `PWG-3` is `ungraded`, with no +qualifier. A grade is derived from receipts, never asserted. A "verified" or +"machine-checked" claim needs current receipts. Report a census with its +denominator, never a percentage. Always write the `PWG-` prefix: CRG, TRG, ARG +and FRG letters, and ECHIDNA's `TrustLevel`, are different schemes. + --- -# This repo: `mathesis` · clade `fv-mathesis` +# This repo: `mathesis` -- **Identity** — uuid `#u5"github.com/hyperpolymath/mathesis"`; clade `fv` (secondary ``); born 2026-10-29; forge `hyperpolymath/mathesis`. +- **Identity** — chora id `#u5"github.com/hyperpolymath/mathesis"`; clade: fv (placement); born 2026-10-29; forge `hyperpolymath/mathesis`. - **IS** — The maths section of the estate: an atlas of the mathematics in other repositories, the theory that no single system owns, and methods that apply mathematics to decisions. Each statement carries its evidence. Mathesis derives status from the receipts of the home repositories and does not assert it. - **IS-NOT** — a prover or a proof kernel: the checker of the home repository decides · the proof policy: PROOF-POLICY in standards decides · the identity registry: gv-clade-index decides · the map of the type family: nextgen-typing coordinates that map and its glossary · a copy of the proofs or receipts of other repositories · a grade authority: it derives a grade and does not assign one · a store for private or organisation-specific case material · the RSR template: the template is its lineage only - **Where it sits** — pipeline position **discovery-and-evidence-navigation**; chain `standards prescribes -> home repositories prove and keep receipts -> mathesis describes (census, claim pins, receipts read through the canon reader) -> researchers and proof tooling`; coordination = `standards`. - **Constraints here** (AGENTIC) — fail-closed; evidence-per-step; no-silent-skip; rerun-after-fix; release-claim-requires-hard-pass. Never: banned langs (above), secrets, state files in repo root, AGPL. Details: the deed's `(bot-directives (methodology) (coverage) (debt))` clauses. - **Golden path** (ANCHOR) — `just check` → Every generated view matches its data: catalogue, census tests, atlas, claims registry, bridges; Every gated proof checks in the pinned Guix shell, with no axiom, Admitted, sorry or postulate in its cone. +- **Anchor override** (ANCHOR) — This repo's anchor forbids: Node.js, npm, Nix, Python, Go, TypeScript, ReScript. The anchor overrides the estate policy above. - **State** — phase incubating; maturity experimental. Milestones and next actions: `docs/status/ROADMAP.adoc`. diff --git a/scripts/deed-field.sh b/scripts/deed-field.sh index 57d27c19..914b5603 100755 --- a/scripts/deed-field.sh +++ b/scripts/deed-field.sh @@ -16,7 +16,12 @@ # deed-field.sh --clause DEED PATH the clause, one token per line (for hashing) # deed-field.sh --has DEED PATH exit 0 iff the clause exists # deed-field.sh --find [DIR] print the one *_chora.deed in DIR (default .) -# deed-field.sh --uuid DEED the repo uuid, derived from :repo-uuid +# deed-field.sh --uuid DEED the repo uuid: the body of :repo-uuid #uuid"…" as +# written (#u8 is derived; a #u5 is derived only to +# read an old deed, and check-identity.sh refuses it) +# deed-field.sh --typed DEED PATH KEY like the first form, but a tagged literal keeps its +# tag and quotes: #u5"github.com/o/r" (a plain value +# prints as it does without --typed) # # PATH names clauses below (repo-deed …), slash-separated: `status`, # `agentic/integrity`, `meta/maintenance-axes`. An empty PATH is (repo-deed …) @@ -30,9 +35,15 @@ # literal prints its string: `:repo-uuid #u5"github.com/o/r"` gives # github.com/o/r, the uuid5 name (uuidgen --sha1 --namespace @url --name …). # -# --uuid derives the uuid5 (RFC 9562, URL namespace) of the header :repo-uuid -# name. It uses uuidgen when that supports --sha1, else bun, and exits 2 when -# neither is available or the result is not uuid-shaped: it never guesses. +# --uuid prints the repo id. The chora id is minted once and carried opaquely +# as `:repo-uuid #uuid""` (standards A1 V8, A7 J11), so +# for that form it prints the body as written and NEVER re-derives it: a +# transfer or rename does not change the id (ruling U1). Legacy literals are +# still read, with a note on stderr: #u5"NAME" gives the uuid5 (RFC 9562, URL +# namespace) of NAME, through uuidgen with --sha1, else scripts/uuid5-url.sh, +# else bun; #u8"DOMAIN:NAME" gives the profile C id through scripts/uuid-v8.sh. +# It exits 2 when no tool is available or the result is not uuid-shaped: it +# never guesses. # # Exit: 0 found; 1 clause or key absent (nothing printed); 2 usage error or no # readable deed. --find exits 1 unless exactly one deed is present. @@ -40,7 +51,7 @@ set -euo pipefail mode=value case "${1:-}" in - --list|--clause|--has|--uuid) mode="${1#--}"; shift ;; + --list|--clause|--has|--uuid|--typed) mode="${1#--}"; shift ;; --find) shopt -s nullglob deeds=("${2:-.}"/*_chora.deed) @@ -54,7 +65,7 @@ deed="${1:-}"; path="${2-}"; key="${3:-}" if [ -z "$deed" ] || [ ! -r "$deed" ]; then echo "deed-field.sh: no readable deed: '${deed}'" >&2; exit 2 fi -if { [ "$mode" = value ] || [ "$mode" = list ]; } && [ -z "$key" ]; then +if [[ ( "$mode" = value || "$mode" = typed || "$mode" = list ) && -z "$key" ]]; then echo "deed-field.sh: KEY is required" >&2; exit 2 fi @@ -137,10 +148,13 @@ END { if (tok[t] == ")") { d--; continue } if (d != 0 || tok[t] != "A:" key) continue nx = tok[t + 1] - if (mode == "value") { + if (mode == "value" || mode == "typed") { if (nx == "(" || nx == ")" || nx == "") exit 1 # A tagged literal such as #u5"github.com/o/r" prints its string. - if (nx ~ /^A#[a-z0-9]+$/ && substr(tok[t + 2], 1, 1) == "S") nx = tok[t + 2] + if (nx ~ /^A#[a-z0-9]+$/ && substr(tok[t + 2], 1, 1) == "S") { + if (mode == "typed") { print substr(nx, 2) "\"" substr(tok[t + 2], 2) "\""; exit 0 } + nx = tok[t + 2] + } print show(nx); exit 0 } if (nx != "(") exit 1 @@ -161,6 +175,9 @@ END { uuid5_url() { if uuidgen --sha1 --namespace @url --name x >/dev/null 2>&1; then uuidgen --sha1 --namespace @url --name "$1" + elif [ -f "$(dirname "${BASH_SOURCE[0]}")/uuid5-url.sh" ] && bash "$(dirname "${BASH_SOURCE[0]}")/uuid5-url.sh" x >/dev/null 2>&1; then + # The same derivation repo-init mints with (sha1sum, shasum or openssl). + bash "$(dirname "${BASH_SOURCE[0]}")/uuid5-url.sh" "$1" elif command -v bun >/dev/null 2>&1; then bun -e ' const h = new Bun.CryptoHasher("sha1"); @@ -173,15 +190,31 @@ uuid5_url() { console.log([x.slice(0, 8), x.slice(8, 12), x.slice(12, 16), x.slice(16, 20), x.slice(20)].join("-")); ' "$1" else - echo "deed-field.sh: --uuid needs uuidgen with --sha1, or bun" >&2; return 2 + echo "deed-field.sh: --uuid needs uuidgen with --sha1, sha1sum, shasum, openssl, or bun" >&2; return 2 fi } if [ "$mode" = uuid ]; then - name="$(read_deed value)" || exit $? - id="$(uuid5_url "$name")" || exit 2 - [[ "$id" =~ ^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ ]] \ - || { echo "deed-field.sh: derived uuid is not uuid5-shaped: '$id'" >&2; exit 2; } + lit="$(read_deed typed)" || exit $? + re_uuid='^[0-9a-f]{8}-[0-9a-f]{4}-[58][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$' + case "$lit" in + '#uuid"'*'"') + # The chora id, minted once: print it as written, never re-derive it. + id="${lit#\#uuid\"}"; id="${id%\"}" ;; + '#u5"'*'"') + name="${lit#\#u5\"}"; name="${name%\"}" + # Read only so an old deed can still be looked up: a #u5 in an identity + # field is u5-identity, an error in every mode (A1 v0.4.5 T30, Q2), and + # scripts/check-identity.sh refuses it. + echo "deed-field.sh: :repo-uuid is a #u5 literal, an error under A1 T30 (Q2); derived here only to read an old deed. Write #uuid\"\"." >&2 + id="$(uuid5_url "$name")" || exit 2 ;; + '#u8"'*:*'"') + body="${lit#\#u8\"}"; body="${body%\"}" + id="$(bash "$(dirname "${BASH_SOURCE[0]}")/uuid-v8.sh" "${body%%:*}" "${body#*:}")" || exit 2 ;; + *) echo "deed-field.sh: :repo-uuid is not a #uuid, #u5 or #u8 literal: '$lit'" >&2; exit 2 ;; + esac + [[ "$id" =~ $re_uuid ]] \ + || { echo "deed-field.sh: :repo-uuid is not a lowercase v5 or v8 uuid: '$id'" >&2; exit 2; } printf '%s\n' "$id" exit 0 fi From f8d6d5e2381c50c5b509dd09b14345279ffcf8a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 12:51:51 +0000 Subject: [PATCH 2/4] docs(claude-md): state the UUIDv8 deed rule as ruled, not the superseded #u5 instruction The hand-authored section below the generated region still told agents to 'use #u5 literals until the deed ABNF admits v8'. The ruling (ADR-008, owner Q2 2026-11-14; rsr-template-repo's CLAUDE.md carries it) is that the chora id is the opaque :repo-uuid #uuid literal, minted by repo-init and never re-derived; legacy #u5/#u8 literals are read but never written. The previous commit's message said this instruction was removed; it was not, because it sits outside the generated region. This commit removes it. The section is now identical to the template's apart from the deed file name. The deed itself still carries a #u5 identity. That is the owner-run ADR-008 P3 migration and is not touched here. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01J4QvDfhy8tVtwc5dx1A3nD --- CLAUDE.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 14f774ff..d7e97dcd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -171,8 +171,10 @@ wired in `estate-rules.yml`). Rule and gate: **UUIDv8 (owner ruling D305, standards ADR-008):** mint every new identifier as UUIDv8 in the ADR-008 layout. Do not rewrite existing v4/v7 identifiers by -hand; that migration is done per repo (ADR-008 phase P3). In deed files use -`#u5` literals until the deed ABNF admits v8; a `#u7` literal is illegal. +hand; that migration is done per repo (ADR-008 phase P3). In deed files the +chora id is `:repo-uuid #uuid""`, minted by +`repo-init` and never re-derived; legacy `#u5`/`#u8` literals are read but +never written, and a `#u7` literal is illegal. **.a2ml → deed:** A2ML is retired; never create or restore a `.a2ml` file. - Grammars: `standards/1-formats/deed/spec/abnf/deed.abnf` (authoritative From 995dfa096fdc9d68577da8fb2c8581dde0b67679 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 14:28:01 +0000 Subject: [PATCH 3/4] fix(deed-field): carry the two helpers the refreshed reader calls scripts/deed-field.sh (refreshed from rsr-template-repo in this branch) calls scripts/uuid-v8.sh for a legacy #u8 literal and scripts/uuid5-url.sh as the SHA-1 fallback for a #u5 literal. Neither file was tracked here, so a #u8 read exited 2 and the #u5 fallback could not run without uuidgen --sha1 or bun. Found by review on the pull request. Both files are byte-identical copies of rsr-template-repo's (mode 100755). No existing file changes. Verified here: uuid-v8.sh and uuid5-url.sh each print an identifier; deed-field.sh --uuid reads this repo's deed and a #u8 fixture; the arrival pack still verifies in sync. No test was added: this repo has no test file for deed-field.sh, and the copied generator is the template's to test. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01J4QvDfhy8tVtwc5dx1A3nD --- scripts/uuid-v8.sh | 29 +++++++++++++++++++++++++++++ scripts/uuid5-url.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100755 scripts/uuid-v8.sh create mode 100755 scripts/uuid5-url.sh diff --git a/scripts/uuid-v8.sh b/scripts/uuid-v8.sh new file mode 100755 index 00000000..e6df425c --- /dev/null +++ b/scripts/uuid-v8.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# +# uuid-v8.sh DOMAIN NAME — the ADR-008 profile C UUIDv8 of NAME in DOMAIN, +# the same on every machine and equal to standards `scripts/uuid-v8.js c`: +# the first 16 bytes of SHA-256(DOMAIN ":" NAME), the version nibble set to 8 +# and the variant to 10xx. A repo's chora id is the profile C id of its birth +# path in the domain chora-registry (standards A1 rules V8 and V9, A7 J11); an +# id minted before V9 keeps its gv-clade-index id and is never reminted. +# SHA-256 comes from sha256sum, shasum or openssl, whichever is installed first. +# +# Exit: 0 printed; 2 usage, a DOMAIN that is empty or holds ":", or no +# SHA-256 tool (it never guesses). +set -euo pipefail +[ $# -eq 2 ] || { echo "usage: uuid-v8.sh DOMAIN NAME" >&2; exit 2; } +[[ "$1" =~ ^[!-9\;-~]+$ ]] \ + || { echo "uuid-v8.sh: DOMAIN must be non-empty printable ASCII without ':'" >&2; exit 2; } + +sha256() { + if command -v sha256sum >/dev/null 2>&1; then sha256sum + elif command -v shasum >/dev/null 2>&1; then shasum -a 256 + elif command -v openssl >/dev/null 2>&1; then openssl dgst -sha256 -r + else echo "uuid-v8.sh: needs sha256sum, shasum or openssl" >&2; return 2 + fi +} +h="$(printf '%s:%s' "$1" "$2" | sha256)" || exit 2 +[[ "$h" =~ ^[0-9a-f]{64} ]] || { echo "uuid-v8.sh: the SHA-256 tool printed '$h'" >&2; exit 2; } +printf '%s-%s-8%s-%x%s-%s\n' "${h:0:8}" "${h:8:4}" "${h:13:3}" \ + $(( (16#${h:16:1} & 3) | 8 )) "${h:17:3}" "${h:20:12}" diff --git a/scripts/uuid5-url.sh b/scripts/uuid5-url.sh new file mode 100755 index 00000000..ea3d4ce7 --- /dev/null +++ b/scripts/uuid5-url.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) +# +# uuid5-url.sh NAME — the UUIDv5 of NAME in the RFC 9562 URL namespace, the +# same on every machine: equal to `uuidgen --sha1 --namespace @url --name NAME` +# (util-linux), which macOS's uuidgen cannot compute (it has no --sha1). +# +# RFC 9562 §5.5: SHA-1 over the namespace's 16 bytes followed by NAME's bytes, +# truncated to 16 bytes, the version nibble set to 5 and the variant to 10xx. +# SHA-1 comes from sha1sum, shasum or openssl, whichever is installed first. +# +# Exit: 0 printed; 2 usage, or no SHA-1 tool (it never guesses). +set -euo pipefail +[ $# -eq 1 ] || { echo "usage: uuid5-url.sh NAME" >&2; exit 2; } + +sha1() { + if command -v sha1sum >/dev/null 2>&1; then sha1sum # NOSONAR shell:S4790: RFC 9562 mandates SHA-1 for UUIDv5 + elif command -v shasum >/dev/null 2>&1; then shasum -a 1 # NOSONAR shell:S4790: RFC 9562 mandates SHA-1 for UUIDv5 + elif command -v openssl >/dev/null 2>&1; then openssl dgst -sha1 -r # NOSONAR shell:S4790: RFC 9562 mandates SHA-1 for UUIDv5 + else echo "uuid5-url.sh: needs sha1sum, shasum or openssl" >&2; return 2 + fi +} +# 6ba7b811-9dad-11d1-80b4-00c04fd430c8, the URL namespace (RFC 9562 §6.6). +h="$( { printf '\x6b\xa7\xb8\x11\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8' + printf '%s' "$1"; } | sha1 )" || exit 2 +[[ "$h" =~ ^[0-9a-f]{40} ]] || { echo "uuid5-url.sh: the SHA-1 tool printed '$h'" >&2; exit 2; } +printf '%s-%s-5%s-%x%s-%s\n' "${h:0:8}" "${h:8:4}" "${h:13:3}" \ + $(( (16#${h:16:1} & 3) | 8 )) "${h:17:3}" "${h:20:12}" From f8b49d36efd1573fdd1c79badbbc3753bb8a34ce Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 14:34:06 +0000 Subject: [PATCH 4/4] test(deed-field): run the helper controls that guard the #u8 and uuid5 read paths 995dfa0 added scripts/uuid-v8.sh and scripts/uuid5-url.sh, which the refreshed deed-field.sh calls, but no test ran them here. This adds the two control scripts that already guard them in rsr-template-repo, byte-identical, and runs both in estate-rules next to the deed clause writer controls (two run: steps; no uses: line changes, check-lock-sync.sh still passes). Run locally: uuid_v8_test.sh 5 PASS lines, exit 0 (including "deed-field.sh --uuid derives a #u8 literal quietly"); uuid5_url_test.sh 3 PASS lines, exit 0. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01J4QvDfhy8tVtwc5dx1A3nD --- .github/workflows/estate-rules.yml | 8 ++++ tests/workflows/uuid5_url_test.sh | 57 +++++++++++++++++++++++ tests/workflows/uuid_v8_test.sh | 72 ++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100755 tests/workflows/uuid5_url_test.sh create mode 100755 tests/workflows/uuid_v8_test.sh diff --git a/.github/workflows/estate-rules.yml b/.github/workflows/estate-rules.yml index 928dddec..bc6de621 100644 --- a/.github/workflows/estate-rules.yml +++ b/.github/workflows/estate-rules.yml @@ -75,6 +75,14 @@ jobs: run: bash tests/workflows/check_no_a2ml_test.sh - name: Deed clause writer controls run: bash tests/workflows/deed_clause_test.sh + # The repo uuid is derived the same on every machine (sha1sum, shasum or + # openssl), equal to uuidgen --sha1; with no SHA-1 tool it is refused. + - name: Repo uuid derivation is machine-independent + run: bash tests/workflows/uuid5_url_test.sh + # A #uuid body is read as written, and a legacy #u8 literal is derived + # through scripts/uuid-v8.sh, equal to standards scripts/uuid-v8.js. + - name: Repo chora id is read as written, and #u8 is derived as UUIDv8 + run: bash tests/workflows/uuid_v8_test.sh - name: Install verified Nickel 1.17.0 run: | mkdir -p "$RUNNER_TEMP/nickel-bin" diff --git a/tests/workflows/uuid5_url_test.sh b/tests/workflows/uuid5_url_test.sh new file mode 100755 index 00000000..ce3d8355 --- /dev/null +++ b/tests/workflows/uuid5_url_test.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# The repo uuid is a function of its name, so it must be the same on every +# machine: a mint without uuidgen once rendered UNASSIGNED and the drift +# gate's replay (which has uuidgen) reported the unchanged child as drift +# (Codex review of #275). scripts/uuid5-url.sh derives it with whichever SHA-1 +# tool is installed; each must give util-linux uuidgen's answer, and with +# none it must refuse, never print something uuid-shaped. +set -euo pipefail +repo=$(git rev-parse --show-toplevel) +work=$(mktemp -d); trap 'rm -rf "$work"' EXIT +fail() { echo "FAIL: $*" >&2; exit 1; } +bash_bin=$(command -v bash) + +# Fixed vectors, from `uuidgen --sha1 --namespace @url --name NAME` (util-linux +# 2.39), so the test holds where uuidgen is absent. +names=("github.com/metadatastician/lintel" "github.com/a b/ü&x" "gitlab.com/x/y.jl") +want=(9ff6d785-9049-588c-b2b9-58ba6b791579 7471e3e9-0030-54f9-acac-9b67c9f2a178 b9e0966d-05b0-5e75-952e-30961f73de6f) + +tested=0 +for tool in sha1sum shasum openssl; do + src=$(command -v "$tool" 2>/dev/null) || { echo "SKIP: $tool not installed"; continue; } + # A PATH holding this one SHA-1 tool and nothing else the script could use. + shim="$work/only-$tool"; mkdir -p "$shim"; ln -s "$src" "$shim/$tool" + for i in "${!names[@]}"; do + got=$(PATH="$shim" "$bash_bin" "$repo/scripts/uuid5-url.sh" "${names[$i]}") \ + || fail "uuid5-url.sh failed with only $tool" + [ "$got" = "${want[$i]}" ] || fail "with only $tool, '${names[$i]}' gave $got, not ${want[$i]}" + if command -v uuidgen >/dev/null 2>&1 && uuidgen --sha1 --namespace @url --name x >/dev/null 2>&1; then + [ "$got" = "$(uuidgen --sha1 --namespace @url --name "${names[$i]}")" ] \ + || fail "with only $tool, '${names[$i]}' differs from this machine's uuidgen" + fi + done + tested=$((tested + 1)) +done +[ "$tested" -gt 0 ] || fail "no SHA-1 tool was available to test with" +echo "PASS: uuid5-url.sh equals uuidgen --sha1 --namespace @url with each of $tested SHA-1 tool(s)" + +# Negative control: no SHA-1 tool at all is a refusal (exit 2), not a guess. +mkdir -p "$work/none" +rc=0; out=$(PATH="$work/none" "$bash_bin" "$repo/scripts/uuid5-url.sh" github.com/o/r 2>"$work/err") || rc=$? +[ "$rc" -eq 2 ] && [ -z "$out" ] && grep -q 'needs sha1sum, shasum or openssl' "$work/err" \ + || fail "with no SHA-1 tool it exited $rc and printed '$out'" +echo "PASS: with no SHA-1 tool, uuid5-url.sh refuses (exit 2) and prints nothing" + +# deed-field.sh --uuid falls back to the same derivation where uuidgen cannot +# do it (macOS's uuidgen has no --sha1): a uuidgen that fails is shadowed here. +src=$(command -v sha1sum 2>/dev/null || command -v shasum 2>/dev/null || command -v openssl) +d="$work/df"; mkdir -p "$d/bin" +ln -s "$src" "$d/bin/$(basename "$src")" +for t in bash awk sed grep tr cat dirname head basename; do ln -s "$(command -v "$t")" "$d/bin/$t"; done +printf '#!%s\nexit 1\n' "$bash_bin" > "$d/bin/uuidgen"; chmod +x "$d/bin/uuidgen" +printf '(repo-deed\n :repo-uuid #u5"github.com/metadatastician/lintel")\n' > "$d/x_chora.deed" +got=$(PATH="$d/bin" "$bash_bin" "$repo/scripts/deed-field.sh" --uuid "$d/x_chora.deed" 2>"$work/err") \ + || { cat "$work/err" >&2; fail "deed-field.sh --uuid failed without a --sha1 uuidgen"; } +[ "$got" = "${want[0]}" ] || fail "deed-field.sh --uuid gave $got, not ${want[0]}" +echo "PASS: deed-field.sh --uuid uses the same derivation when uuidgen cannot" diff --git a/tests/workflows/uuid_v8_test.sh b/tests/workflows/uuid_v8_test.sh new file mode 100755 index 00000000..30c5e74f --- /dev/null +++ b/tests/workflows/uuid_v8_test.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# The chora id is minted once from the birth path (standards A1 V8, A7 J11): +# scripts/uuid-v8.sh must give standards scripts/uuid-v8.js's profile C answer +# with each SHA-256 tool, refuse with none, and deed-field.sh --uuid must print +# a #uuid literal's body as written, never re-derive it. +set -euo pipefail +repo=$(git rev-parse --show-toplevel) +work=$(mktemp -d); trap 'rm -rf "$work"' EXIT +fail() { echo "FAIL: $*" >&2; exit 1; } +bash_bin=$(command -v bash) + +# Fixed vectors: the independent oracle of standards tools/uuid-v8 (sha256sum +# and shell nibble arithmetic), plus this template's own birth path. +domains=(gv-clade-index gv-clade-index d d echidna-goal) +# The template's birth path is built at run time: the mint's self-name pass +# rewrites a literal one into the child's own path, and the vector then fails. +tmpl_path="github.com/hyperpolymath/rsr-""template-repo" +names=("github.com/hyperpolymath/standards" "$tmpl_path" "" "a:b c" "é✓") +want=(b32d6be4-73ba-873e-9d61-e57f43c75cd1 8e515699-3fb9-8785-8883-ef2a100c2e02 + 394e0f7e-2f80-8af2-b682-28464ce30d58 ca23a717-72b1-8d99-94c5-e32a4fda7acd + 939052b9-3381-8187-9199-1960e0a527a4) + +tested=0 +for tool in sha256sum shasum openssl; do + src=$(command -v "$tool" 2>/dev/null) || { echo "SKIP: $tool not installed"; continue; } + shim="$work/only-$tool"; mkdir -p "$shim"; ln -s "$src" "$shim/$tool" + # shasum is a perl script; give it perl when it is the one under test. + [ "$tool" != shasum ] || { p=$(command -v perl) && ln -s "$p" "$shim/perl"; } + for i in "${!names[@]}"; do + got=$(PATH="$shim" "$bash_bin" "$repo/scripts/uuid-v8.sh" "${domains[$i]}" "${names[$i]}") \ + || fail "uuid-v8.sh failed with only $tool" + [ "$got" = "${want[$i]}" ] || fail "with only $tool, ${domains[$i]}:${names[$i]} gave $got, not ${want[$i]}" + done + tested=$((tested + 1)) +done +[ "$tested" -gt 0 ] || fail "no SHA-256 tool was available to test with" +echo "PASS: uuid-v8.sh equals the standards profile C oracle with each of $tested SHA-256 tool(s)" + +# Negative controls: no SHA-256 tool, and a domain holding ":", are refusals. +mkdir -p "$work/none" +rc=0; out=$(PATH="$work/none" "$bash_bin" "$repo/scripts/uuid-v8.sh" d x 2>"$work/err") || rc=$? +[ "$rc" -eq 2 ] && [ -z "$out" ] && grep -q 'needs sha256sum, shasum or openssl' "$work/err" \ + || fail "with no SHA-256 tool it exited $rc and printed '$out'" +rc=0; out=$("$bash_bin" "$repo/scripts/uuid-v8.sh" 'a:b' x 2>/dev/null) || rc=$? +[ "$rc" -eq 2 ] && [ -z "$out" ] || fail "a domain with ':' exited $rc and printed '$out'" +echo "PASS: uuid-v8.sh refuses (exit 2) with no SHA-256 tool and with a ':' in the domain" + +# deed-field.sh --uuid prints a #uuid body as written: no tool is consulted. +d="$work/df"; mkdir -p "$d/bin" +for t in bash awk sed grep tr cat dirname head basename; do ln -s "$(command -v "$t")" "$d/bin/$t"; done +printf '(repo-deed\n :repo-uuid #uuid"%s")\n' "${want[1]}" > "$d/x_chora.deed" +got=$(PATH="$d/bin" "$bash_bin" "$repo/scripts/deed-field.sh" --uuid "$d/x_chora.deed" 2>"$work/err") \ + || { cat "$work/err" >&2; fail "deed-field.sh --uuid failed on a #uuid literal"; } +[ "$got" = "${want[1]}" ] && [ ! -s "$work/err" ] || fail "deed-field.sh --uuid gave '$got' for a #uuid literal" +echo "PASS: deed-field.sh --uuid prints a #uuid body as written, with no hashing tool" + +# An uppercase or v4 body is refused, never normalised. +# Built from the oracle so no non-v8 literal sits in this file (ADR-008 gate). +for bad in "$(printf %s "${want[1]}" | tr a-f A-F)" "${want[1]/-8785-/-4785-}"; do + printf '(repo-deed\n :repo-uuid #uuid"%s")\n' "$bad" > "$d/x_chora.deed" + rc=0; "$bash_bin" "$repo/scripts/deed-field.sh" --uuid "$d/x_chora.deed" >/dev/null 2>&1 || rc=$? + [ "$rc" -eq 2 ] || fail "deed-field.sh --uuid accepted $bad (exit $rc)" +done +echo "PASS: deed-field.sh --uuid refuses an uppercase or version 4 body" + +# A #u8 literal is accepted (A7 S2, A1 T30) and derived through uuid-v8.sh, +# without a note: it is not legacy. +printf '(repo-deed\n :repo-uuid #u8"gv-clade-index:%s")\n' "${names[0]}" > "$d/x_chora.deed" +got=$("$bash_bin" "$repo/scripts/deed-field.sh" --uuid "$d/x_chora.deed" 2>"$work/err") || fail "#u8 literal failed" +[[ "$got" = "${want[0]}" && ! -s "$work/err" ]] || fail "#u8 gave '$got' (stderr: $(cat "$work/err"))" +echo "PASS: deed-field.sh --uuid derives a #u8 literal quietly (S2)"