From f16dce4d5130b4a4eaa07e60577b9e567e4d2a53 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 20 Oct 2026 08:09:58 -0500 Subject: [PATCH 1/3] tools/name-check: refuse retired project names in added lines (ADR 0038) Bash tool plus offline red/green test (17 cases) and the ARCH-NAME-CHECK gate. Lowercase names, identifiers and history paths are not judged. This branch changes tests/gates/, so it is an operator-run head. Co-Authored-By: Claude Opus 5.5 --- tests/gates/arch-name-check.gate | 21 ++++++++++ tests/gates/run.sh | 8 ++++ tools/name-check/README.md | 10 +++++ tools/name-check/name-check.sh | 71 ++++++++++++++++++++++++++++++++ tools/name-check/test.sh | 47 +++++++++++++++++++++ 5 files changed, 157 insertions(+) create mode 100644 tests/gates/arch-name-check.gate create mode 100644 tools/name-check/README.md create mode 100755 tools/name-check/name-check.sh create mode 100755 tools/name-check/test.sh diff --git a/tests/gates/arch-name-check.gate b/tests/gates/arch-name-check.gate new file mode 100644 index 0000000..f7c5132 --- /dev/null +++ b/tests/gates/arch-name-check.gate @@ -0,0 +1,21 @@ +# tests/gates/arch-name-check.gate +# ADR 0038: refuse new uses of the retired project names in added lines (see tools/name-check). +# Also runs the tool's own offline test (red and green cases) first. +gate: ARCH-NAME-CHECK +manifest_version: 2 +owner: aien-architecture +requires: + - host +inputs: + - tools/name-check/ + - tests/gates/ +run: + exec: tests/gates/run.sh + args: ["name-check"] +expects: + exit: 0 + observe: ["name_check_cases == 17"] + verdict: PASS +timeout: 5m +exactness: EXACT +cache_scope: machine diff --git a/tests/gates/run.sh b/tests/gates/run.sh index f7a84fe..7fd0240 100755 --- a/tests/gates/run.sh +++ b/tests/gates/run.sh @@ -40,6 +40,14 @@ case "$step" in # Repository script (aien-architecture#7): doctrine consistency, pure text, no network. bash scripts/check_doctrine.sh "$ROOT" ;; + name-check) + # ADR 0038: the tool's own red/green test, then the check itself on this head + # (added lines since origin/main, else since the previous commit). + out=$(bash tools/name-check/test.sh) + printf '%s\n' "$out" + obs name_check_cases "$(printf '%s\n' "$out" | grep -c '^ok ')" + bash tools/name-check/name-check.sh + ;; script-tests) # The offline tests of the repository's own operator scripts. Each builds temporary git # repos and fake gh/crumb tools under mktemp; no network, no auth (see their headers). diff --git a/tools/name-check/README.md b/tools/name-check/README.md new file mode 100644 index 0000000..92a1d51 --- /dev/null +++ b/tools/name-check/README.md @@ -0,0 +1,10 @@ +# name-check + +Refuses new uses of the retired project names (ADR 0038). The kernel is **Aienux**, the whole operating system is **AienOS**, and the old names are retired in prose. + +- `name-check.sh [--base REF] [--repo DIR] [--allow GLOB]...` looks only at lines added since the merge base with REF (default `origin/main`, else the previous commit). Exit 0 PASS, 1 FAIL with file and line, 2 usage or git error. +- Lowercase names (paths, crate names, URLs, the `aienos.com` address) and identifiers that only contain the old word (macros, type names, key-derivation labels) are not flagged: renaming those is code work with its own tests. +- History is never judged: `evidence/`, `receipts/`, `docs/history/`, `CHANGELOG*`. +- `test.sh` is the offline test: six cases that must fail, eleven that must pass. The gate `ARCH-NAME-CHECK` runs both. + +No Python, no network. Bash and GNU grep with `-P`. diff --git a/tools/name-check/name-check.sh b/tools/name-check/name-check.sh new file mode 100755 index 0000000..1f80938 --- /dev/null +++ b/tools/name-check/name-check.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# name-check: refuse new uses of the retired names (ADR 0038). +# +# name-check.sh [--base REF] [--repo DIR] [--allow GLOB]... +# +# Looks only at lines ADDED between the merge base of REF and HEAD (default REF: +# origin/main, else HEAD~1). Fails (exit 1) when an added line outside the allowed +# paths names the project with a retired word: +# Aienix / AIENIX retired everywhere (the whole system is AienOS) +# AIENOS / Aienos retired in prose (the kernel is Aienux, the whole system AienOS) +# Not flagged: lowercase names (paths, crates, URLs, the aienos.com address), and +# identifiers that only contain the word (AIENOS_DISK, AienosCapRef, AIENOS-PKV-...): +# those are code and change with their own tests, not with prose. +# Allowed paths (history is never rewritten): evidence/, receipts/, docs/history/, +# CHANGELOG*, the naming ADR itself and this tool. Exit 2 on usage or git errors. +set -euo pipefail + +base="" repo="." allow=() +while [ $# -gt 0 ]; do + case "$1" in + --base) base="$2"; shift 2 ;; + --repo) repo="$2"; shift 2 ;; + --allow) allow+=("$2"); shift 2 ;; + -h|--help) sed -n '2,16p' "$0"; exit 0 ;; + *) echo "name-check: unknown argument: $1" >&2; exit 2 ;; + esac +done +cd "$repo" || exit 2 +if [ -z "$base" ]; then + if git rev-parse -q --verify origin/main >/dev/null; then base=origin/main; else base=HEAD~1; fi +fi +mb=$(git merge-base "$base" HEAD) || { echo "name-check: no merge base with $base" >&2; exit 2; } + +allowed() { + case "$1" in + evidence/*|*/evidence/*|receipts/*|*/receipts/*|docs/history/*|CHANGELOG*|*/CHANGELOG*) return 0 ;; + docs/adr/0038-*|tools/name-check/*) return 0 ;; + esac + local g + for g in "${allow[@]+"${allow[@]}"}"; do + # shellcheck disable=SC2053 + [[ "$1" == $g ]] && return 0 + done + return 1 +} + +# A retired word that stands as a word: no letter, digit or _ beside it, not joined +# by - or . or / to another token (labels, paths, file names). +L='(? "$d/$path" + git -C "$d" add -A + git -C "$d" -c user.name=t -c user.email=t@t commit -q -m change + "$nc" --repo "$d" --base HEAD~1 >"$d.out" 2>&1 || got=$? + if [ "$got" -eq "$want" ]; then pass=$((pass + 1)); echo "ok $name" + else fail=$((fail + 1)); echo "FAIL $name: want exit $want, got $got"; sed 's/^/ /' "$d.out"; fi +} + +# red: retired names in prose +case_ aienix-prose 1 README.md "Aienix is the core tree of AIEN." +case_ aienix-caps 1 docs/x.md "Welcome to AIENIX." +case_ aienix-in-word 1 docs/y.md "the Aienix-wide plan" +case_ aienos-caps-prose 1 notes.md "AIENOS boots on the iMac." +case_ aienos-mixed-prose 1 src/a.c "/* Aienos kernel entry */" +case_ aienos-sentence-end 1 a.md "It runs AIENOS." +# green: clean text and the new names +case_ clean-text 0 README.md "Aienux is the kernel; AienOS is the whole system; AIEN is the agent." +case_ new-names-only 0 docs/z.md "AienOS = Aienux + Omega + runtime + Allen" +# green: identifiers, labels, paths and addresses stay legal +case_ macro-identifier 0 src/b.h "#define AIENOS_DISK_NATIVE 1" +case_ type-identifier 0 src/c.c "AienosCapRef r = { 0 };" +case_ kdf-label 0 src/d.rs 'let l = "AIENOS-PKV-ENVID-KEY-V1";' +case_ lowercase-paths 0 docs/w.md "see github.com/aien-dev/aienix and www.aienos.com and crates/aienos-kernel" +case_ file-name-token 0 docs/v.md "docs/AIENOS.md" +# green: history paths are never judged +case_ evidence-path 0 evidence/r.md "AIENOS receipt text, Aienix era" +case_ receipts-path 0 receipts/a.md "Aienix" +case_ history-path 0 docs/history/h.md "AIENOS history" +case_ changelog 0 CHANGELOG.md "- Aienix renamed" + +echo "name-check tests: $pass passed, $fail failed" +[ "$fail" -eq 0 ] From 4ff353358198651d6df5ac3e068849d0741d75bc Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 20 Oct 2026 08:11:04 -0500 Subject: [PATCH 2/3] tools/name-check: allow glossary _Avoid_ lines (ADR 0038) Co-Authored-By: Claude Opus 5.5 --- tests/gates/arch-name-check.gate | 2 +- tools/name-check/README.md | 2 +- tools/name-check/name-check.sh | 3 ++- tools/name-check/test.sh | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/gates/arch-name-check.gate b/tests/gates/arch-name-check.gate index f7c5132..a932c62 100644 --- a/tests/gates/arch-name-check.gate +++ b/tests/gates/arch-name-check.gate @@ -14,7 +14,7 @@ run: args: ["name-check"] expects: exit: 0 - observe: ["name_check_cases == 17"] + observe: ["name_check_cases == 18"] verdict: PASS timeout: 5m exactness: EXACT diff --git a/tools/name-check/README.md b/tools/name-check/README.md index 92a1d51..85e2a56 100644 --- a/tools/name-check/README.md +++ b/tools/name-check/README.md @@ -5,6 +5,6 @@ Refuses new uses of the retired project names (ADR 0038). The kernel is **Aienux - `name-check.sh [--base REF] [--repo DIR] [--allow GLOB]...` looks only at lines added since the merge base with REF (default `origin/main`, else the previous commit). Exit 0 PASS, 1 FAIL with file and line, 2 usage or git error. - Lowercase names (paths, crate names, URLs, the `aienos.com` address) and identifiers that only contain the old word (macros, type names, key-derivation labels) are not flagged: renaming those is code work with its own tests. - History is never judged: `evidence/`, `receipts/`, `docs/history/`, `CHANGELOG*`. -- `test.sh` is the offline test: six cases that must fail, eleven that must pass. The gate `ARCH-NAME-CHECK` runs both. +- `test.sh` is the offline test: six cases that must fail, twelve that must pass. The gate `ARCH-NAME-CHECK` runs both. No Python, no network. Bash and GNU grep with `-P`. diff --git a/tools/name-check/name-check.sh b/tools/name-check/name-check.sh index 1f80938..f1c5846 100755 --- a/tools/name-check/name-check.sh +++ b/tools/name-check/name-check.sh @@ -12,7 +12,7 @@ # identifiers that only contain the word (AIENOS_DISK, AienosCapRef, AIENOS-PKV-...): # those are code and change with their own tests, not with prose. # Allowed paths (history is never rewritten): evidence/, receipts/, docs/history/, -# CHANGELOG*, the naming ADR itself and this tool. Exit 2 on usage or git errors. +# CHANGELOG*, the naming ADR itself and this tool; glossary lines starting "_Avoid_:". Exit 2 on usage or git errors. set -euo pipefail base="" repo="." allow=() @@ -56,6 +56,7 @@ while IFS= read -r line; do "+++ b/"*) file="${line#+++ b/}" ;; "+++ "*) file="" ;; "@@ "*) n="${line#*+}"; n="${n%%[, ]*}" ;; + "+_Avoid_:"*) n=$((n + 1)) ;; # glossary lines that name the retired words on purpose "+"*) if [ -n "$file" ] && ! allowed "$file" && printf '%s\n' "${line:1}" | grep -qP "$pat"; then word=$(printf '%s\n' "${line:1}" | grep -oP "$pat" | head -1) diff --git a/tools/name-check/test.sh b/tools/name-check/test.sh index 0905173..8976c9a 100755 --- a/tools/name-check/test.sh +++ b/tools/name-check/test.sh @@ -42,6 +42,7 @@ case_ evidence-path 0 evidence/r.md "AIENOS receipt text, Aienix era" case_ receipts-path 0 receipts/a.md "Aienix" case_ history-path 0 docs/history/h.md "AIENOS history" case_ changelog 0 CHANGELOG.md "- Aienix renamed" +case_ glossary-avoid 0 CONTEXT.md "_Avoid_: Aienix (retired), AIENOS, Aienos" echo "name-check tests: $pass passed, $fail failed" [ "$fail" -eq 0 ] From 90296b212437af79bae65acf572b7c7012f62e32 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 20 Oct 2026 08:11:59 -0500 Subject: [PATCH 3/3] tools/name-check: quoted text keeps its words (code spans, quotations) Co-Authored-By: Claude Opus 5.5 --- tests/gates/arch-name-check.gate | 2 +- tools/name-check/README.md | 2 +- tools/name-check/name-check.sh | 8 ++++++-- tools/name-check/test.sh | 7 +++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/gates/arch-name-check.gate b/tests/gates/arch-name-check.gate index a932c62..3e35fa8 100644 --- a/tests/gates/arch-name-check.gate +++ b/tests/gates/arch-name-check.gate @@ -14,7 +14,7 @@ run: args: ["name-check"] expects: exit: 0 - observe: ["name_check_cases == 18"] + observe: ["name_check_cases == 23"] verdict: PASS timeout: 5m exactness: EXACT diff --git a/tools/name-check/README.md b/tools/name-check/README.md index 85e2a56..96a4cf6 100644 --- a/tools/name-check/README.md +++ b/tools/name-check/README.md @@ -5,6 +5,6 @@ Refuses new uses of the retired project names (ADR 0038). The kernel is **Aienux - `name-check.sh [--base REF] [--repo DIR] [--allow GLOB]...` looks only at lines added since the merge base with REF (default `origin/main`, else the previous commit). Exit 0 PASS, 1 FAIL with file and line, 2 usage or git error. - Lowercase names (paths, crate names, URLs, the `aienos.com` address) and identifiers that only contain the old word (macros, type names, key-derivation labels) are not flagged: renaming those is code work with its own tests. - History is never judged: `evidence/`, `receipts/`, `docs/history/`, `CHANGELOG*`. -- `test.sh` is the offline test: six cases that must fail, twelve that must pass. The gate `ARCH-NAME-CHECK` runs both. +- `test.sh` is the offline test: seven cases that must fail, sixteen that must pass. The gate `ARCH-NAME-CHECK` runs both. No Python, no network. Bash and GNU grep with `-P`. diff --git a/tools/name-check/name-check.sh b/tools/name-check/name-check.sh index f1c5846..7ea585b 100755 --- a/tools/name-check/name-check.sh +++ b/tools/name-check/name-check.sh @@ -50,6 +50,10 @@ L='(?