Name check: a gate that stops the retired project names coming back (ADR 0038)
closed1efd53eea83e6ba7 #289 · opened 2026-10-20 14:59 UTC · closed 2026-10-29 18:58 UTC
Imported from GitHub aien-dev/aien-architecture-mv#289, by drakestapleton
Base 134920d2ee7850f7a32edab142ea395769ced999 · Head 90296b212437af79bae65acf572b7c7012f62e32
drakestapleton wrote on 2026-10-20 14:59 UTC
What this does
Adds tools/name-check, a small shell script that fails a change when it adds a retired name (Aienix, or AIENOS used in prose) outside history paths, plus its own test (23 cases, worker reports PASS) and an ARCH-NAME-CHECK gate entry. Follows ADR 0038 (#287), so it should land after that.
Notes
This touches tests/gates, so the judge needs an operator run (tests/gates/run.sh name-check). The same gate is not added to the other repos yet: each needs its own copy of the script or a pinned reference; that choice is open.
Closing in org cleanup (Drake, 2026-10-29): abandoned; no activity since 2026-10-20 (≥ 7 days), failing CI checks (BLOCKED NOT_RUN PIPELINE_CONFIG_CHANGED) with no follow-up. Reopen if still needed.
Apply it
git checkout -b patch-1efd53eea83e6ba7134920d2ee7850f7a32edab142ea395769ced999
curl -fsSL https://interplane.io/drakestapleton/aien-architecture-mv/patches/1efd53eea83e6ba7.patch | git am
diff --git a/tests/gates/arch-name-check.gate b/tests/gates/arch-name-check.gate
new file mode 100644
index 0000000..3e35fa8
--- /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 == 23"]
+ 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..96a4cf6
--- /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: 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
new file mode 100755
index 0000000..7ea585b
--- /dev/null
+++ b/tools/name-check/name-check.sh
@@ -0,0 +1,76 @@
+#!/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; glossary lines starting "_Avoid_:". 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='(?<![A-Za-z0-9_\-/.@$])'
+R='(?![A-Za-z0-9_]|[-./][A-Za-z0-9])'
+pat="${L}(Aienix|AIENIX|AIENOS|Aienos)${R}|Aienix"
+
+# Quoted text keeps its words: `code spans` (also one left open to the end of the line),
+# "quotations" and “curly quotations” of older documents or of program output.
+unquote() { LC_ALL=C sed -E 's/`[^`]*`//g; s/`.*$//; s/"[^"]*"//g; s/\xe2\x80\x9c([^\xe2]|\xe2[^\x80]|\xe2\x80[^\x9d])*\xe2\x80\x9d//g'; }
+
+bad=0 file=""
+while IFS= read -r line; do
+ case "$line" in
+ "+++ 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}" | unquote | grep -qP "$pat"; then
+ word=$(printf '%s\n' "${line:1}" | unquote | grep -oP "$pat" | head -1)
+ echo "name-check: $file:$n: retired name '$word' (use Aienux for the kernel, AienOS for the whole system)"
+ bad=1
+ fi
+ n=$((n + 1)) ;;
+ " "*) n=$((n + 1)) ;;
+ esac
+done < <(git diff --no-color --no-ext-diff -U0 "$mb" HEAD)
+
+if [ "$bad" -ne 0 ]; then echo "name-check: FAIL"; exit 1; fi
+echo "name-check: PASS (added lines since $(git rev-parse --short "$mb"))"
diff --git a/tools/name-check/test.sh b/tools/name-check/test.sh
new file mode 100755
index 0000000..d8ec137
--- /dev/null
+++ b/tools/name-check/test.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+# Offline test of name-check.sh: builds throwaway git repos under mktemp.
+# Red cases must fail (exit 1), green cases must pass (exit 0). No network.
+set -euo pipefail
+here=$(cd "$(dirname "$0")" && pwd)
+nc="$here/name-check.sh"
+tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT
+pass=0 fail=0
+
+# case NAME WANT_EXIT PATH TEXT: commit TEXT to PATH on top of a clean base, run the check
+case_() {
+ local name="$1" want="$2" path="$3" text="$4" d="$tmp/$1" got=0
+ git init -q "$d"
+ git -C "$d" -c user.name=t -c user.email=t@t commit -q --allow-empty -m base
+ mkdir -p "$d/$(dirname "$path")"
+ printf '%s\n' "$text" > "$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"
+case_ glossary-avoid 0 CONTEXT.md "_Avoid_: Aienix (retired), AIENOS, Aienos"
+# green: quoted older text and program output keep their words
+case_ quoted-text 0 docs/q.md 'the roadmap says "Nothing in AIENOS is qualified" today'
+case_ code-span 0 docs/c.md 'the banner `AIENOS Standalone` appears'
+case_ open-code-span 0 docs/o.md 'Expect the rescue banner `AIENOS Standalone Hardware'
+case_ curly-quote 0 docs/u.md "he wrote “Aienix is the tree” once"
+# red: an old name outside the quotes still fails
+case_ outside-quote 1 docs/p.md 'AIENOS says "hello"'
+
+echo "name-check tests: $pass passed, $fail failed"
+[ "$fail" -eq 0 ]