aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / tools / name-check / README.md
| 1 | # name-check |
| 2 | |
| 3 | Refuses new uses of the retired project names ([ADR 0038](../../docs/adr/0038-names-aienux-kernel-aienos-system.md)): |
| 4 | **Aienux** is the kernel, **AienOS** is the whole system, and **Aienix** is retired. |
| 5 | |
| 6 | `namecheck.om` reads a git diff on standard input and judges every added line: |
| 7 | |
| 8 | - `Aienix` / `AIENIX` are refused everywhere outside quoted text, also inside a longer word or an |
| 9 | identifier (`AIENIX_MODE`): another company uses the name. |
| 10 | - `AIENOS` / `Aienos` are refused when they stand as a word in prose, including prose compounds: |
| 11 | `AIENOS-based`, `AIENOS-Omega`, `AIENOS/Aienux`, `non-AIENOS`. |
| 12 | - Code passes: lowercase names (paths, crates, URLs, the aienos.com address), identifiers that only |
| 13 | contain the word (`AIENOS_DISK`, `AienosCapRef`), labels and path parts where `-` or `/` is |
| 14 | followed by a token of uppercase letters or digits that holds a digit or runs on to the next `-`, |
| 15 | `/` or `_` (`AIENOS-PKV-ENVID-KEY-V1`, the key-derivation label `AIENOS/M5/CORTEX-V1`, the lane |
| 16 | label `AIENOS-PI5`; so `AIENOS-2` and `AIENOS-V2` pass as labels too), path parts joined by |
| 17 | a backslash (`\EFI\AIENOS\MODEL.MAP`) and file names (`AIENOS.md`). These change with their own |
| 18 | tests, never with prose; renaming a key-derivation label would change the derived keys. A path |
| 19 | part after `/` (`Atlas/AIENOS`) also passes: it cannot be told from a directory name. |
| 20 | - Quoted text keeps its words: code spans, double quotes and curly quotes (older documents and |
| 21 | program output are quoted as they were written). A run of backticks closes at the next run of the |
| 22 | same length, as in Markdown (`` ``AIENOS`` `` is a span); a run left open quotes the rest of the |
| 23 | line, because a Markdown span may wrap onto the next line. An unmatched double or curly quote |
| 24 | quotes nothing. The tool reads `-U0` hunks and cannot see where a fenced code block opens, so |
| 25 | lines inside a fence are judged as prose: quote a banner or GRUB entry there with an inline span. |
| 26 | - History is never judged: `evidence/`, `receipts/` (at any depth), `docs/history/`, |
| 27 | `docs/archive/`, `CHANGELOG*` (at any depth), this tool, ADR 0038 itself (its exact path |
| 28 | `docs/adr/0038-names-aienux-kernel-aienos-system.md`, no other file), and glossary lines |
| 29 | starting `_Avoid_:`. |
| 30 | - Other ADRs, dated audits and reports are judged on purpose. They are history and are not edited |
| 31 | (the 2026-11-15 rename left them as written); a new ADR, audit or amendment is new text and uses |
| 32 | the current names, so an added line in an old one is new text too. |
| 33 | - A file's path comes only from its `+++` line inside the diff header (after `diff --git`, before |
| 34 | the first `@@`), so added text that looks like a header cannot move the following lines into an |
| 35 | allowed path. The TAB git adds after a path that holds a space is dropped. |
| 36 | |
| 37 | It prints one line per finding and `name-check: FAIL` (exit 1), or `name-check: PASS (N added |
| 38 | lines checked)` (exit 0; an empty diff, where nothing changed, passes with 0 lines). Exit 2 is a |
| 39 | clean refusal with nothing judged, and one line on standard output names the reason: the input is not a git |
| 40 | diff (an added line or hunk before any `diff --git` header); a `+++` header is neither |
| 41 | `+++ b/PATH` nor `+++ /dev/null` (a diff made with `diff.noprefix`, or a file name git C-quotes |
| 42 | because it holds a `"`, `\` or control byte); the input cannot be read; a path is longer than 4096 |
| 43 | bytes (PATH_MAX); or one line is longer than 16777216 bytes (the largest array the compiler builds). |
| 44 | A file the tool cannot judge is refused, never skipped. |
| 45 | |
| 46 | ## Run it |
| 47 | |
| 48 | ```sh |
| 49 | AIEN_OMC=/path/to/pinned/omc sh tools/name-check/gate.sh . [BASE] |
| 50 | # or through the gate entry point: |
| 51 | AIEN_OMC=/path/to/pinned/omc tests/gates/run.sh name-check |
| 52 | ``` |
| 53 | |
| 54 | `gate.sh` checks `AIEN_OMC` against `../zero-legacy/omega.pin` (otherwise NOT_RUN, exit 3), writes |
| 55 | the change under review to `build/change.diff` (`git diff -U0 --no-textconv --src-prefix=a/ |
| 56 | --dst-prefix=b/` from the merge base of BASE, default `origin/main`, else `HEAD~1`, to `HEAD`; the |
| 57 | fixed prefixes override any `diff.noprefix` or `diff.mnemonicPrefix` setting), and runs `gate.om`. |
| 58 | `gate.om` hashes the compiler again with the native `sha256.om`, builds `namecheck.om`, and requires |
| 59 | six fixtures to give exactly their recorded exit and output, counting those that pass |
| 60 | (`name_check_fixtures`), before it judges the change: |
| 61 | |
| 62 | | Fixture | Exit | Output | What it holds | |
| 63 | |---|---|---|---| |
| 64 | | `fixtures/red.diff` | 1 | `red.out` (22 findings) | every retired form, an `AIENIX_` identifier, compounds, a word outside a quotation, unmatched quotes, line numbers inside a hunk, a fake header line, a path with a space, another file whose name starts like ADR 0038's, a longer path that starts with ADR 0038's exact path | |
| 65 | | `fixtures/green.diff` | 0 | `green.out` | the new names, identifiers, labels, backslash path parts, file names, every history path (also nested, and ADR 0038 under its exact path), the glossary line, each kind of quotation (also double-backtick code spans) | |
| 66 | | `fixtures/long.diff` | 1 | `long.out` | one added line of 1000017 bytes with the retired word at its end (longer than one inner loop) | |
| 67 | | `fixtures/refuse.diff` | 2 | `refuse.out` | a file name git C-quotes | |
| 68 | | `fixtures/nohdr.diff` | 2 | `nohdr.out` | an added line before any `diff --git` header | |
| 69 | | `fixtures/pathmax.diff` | 2 | `pathmax.out` | a `+++` path of 4097 bytes | |
| 70 | |
| 71 | The first four are real `git diff` output made with the same options as `gate.sh`; `nohdr` and |
| 72 | `pathmax` are written by hand, because git cannot produce them. The line-length refusal (a line over |
| 73 | 16777216 bytes) has no fixture, so as not to commit 16 MB; it was checked by hand (exit 2). |
| 74 | |
| 75 | To check another repository's change with the same tool, build it and pipe that repository's diff in |
| 76 | with the same options: |
| 77 | |
| 78 | ```sh |
| 79 | "$AIEN_OMC" < tools/name-check/namecheck.om > /tmp/namecheck && chmod +x /tmp/namecheck |
| 80 | git -C OTHER -c core.quotePath=false diff --no-color --no-ext-diff --no-textconv \ |
| 81 | --src-prefix=a/ --dst-prefix=b/ -U0 "$(git -C OTHER merge-base origin/main HEAD)" HEAD | /tmp/namecheck |
| 82 | ``` |
| 83 | |
| 84 | The gate runs only in this repository. Another repository would need its own copy or a pin of this |
| 85 | tool in its own gate files; that is not done here, because a copied file would have to be kept in |
| 86 | step by hand. |
| 87 | |
| 88 | ## Compilers |
| 89 | |
| 90 | `namecheck.om` and `gate.om` compile with the repository pin, the compiler named in |
| 91 | `tools/zero-legacy/omega.pin` (`gate.sh` refuses any other, NOT_RUN, exit 3). |
| 92 | Every loop bound stays at or under 999999, the largest bound the pinned compiler accepts. A loop that |
| 93 | passes its bound stops the program (trap 4), so each long scan is an outer loop of at most 17 passes |
| 94 | around an inner loop that ends one pass below its bound (17 x 999998 >= 16777216 bytes). |
| 95 | |
| 96 | ## The bash tool it replaces |
| 97 | |
| 98 | This tool replaces the bash `name-check.sh` of the unlanded branch `naming/name-check-gate` |
| 99 | (`90296b21`). On real diffs (the reverts of the twelve naming branches of 2026-11-15, which add |
| 100 | the retired words back on 681 lines) the Omega tool reports every one of the bash tool's 675 |
| 101 | findings, byte for byte, and 6 more: prose compounds such as `AIENOS-native` |
| 102 | that the bash tool passed. It also refuses what the bash tool passed silently: a fake header line |
| 103 | inside added text, a diff made with `diff.noprefix` and C-quoted file names. The bash tool's `--allow GLOB` option is not carried over: no caller used it, and an |
| 104 | allowance outside the tool's own reviewed table would not be reviewed. |