open134274008991482d #210 · opened 2026-11-07 05:52 UTC
Imported from GitHub aien-dev/omega-harness#210, by drakestapleton
Base bd107ca15c40b6cdfef0f23afb03a884fe3c8086 · Head f061d394a848e42159cb01e48270aa9b93d7c69b
drakestapleton wrote on 2026-11-07 05:52 UTC
Pending aien-dev/omega-mv#1063 (draft). This documents a checker that is not on main yet. Keep this PR draft until #1063 merges, then update the "pending" wording.
This adds omega-encoding §8 "Critical source profile seed/profile". It covers:
rules B1, B2, B3, E1, X1, P1 and C1;
the output and exit-code contract;
capacities;
seed/profile/check.sh usage;
the om-profile-arm64 workflow;
the new authority return codes 43, 40 (lerr), 76, 77, 78 and 79;
limits.
It also adds the runnable example examples/p10_profile.om and bumps the README example count.
Verification
These checks ran on Linux AArch64 (spark-b87b), core 2, on 2026-11-07.
bash examples/gate.sh /tmp/omc-f4df printed GATE PASS examples=111 pass=111 fail=0, exit 0. /tmp/omc-f4df is git show f4df8239:seed/out/omc, with sha256 3ad9f10f…3194, which is the gate pin.
On omega-mv #1063, build/seed/profile/profile examples/p10_profile.om printed PROFILE-PASS.
Each mutant of the example is refused:
Mutant
Output
bound removed
PROFILE-REFUSED:B1:15
note p10 effect removed
PROFILE-REFUSED:X1:23
result overwritten
PROFILE-REFUSED:E1:34
The expected stdout 285 was checked with Wolfram: Sum[k^2,{k,0,9}] -> 285.
diff --git a/README.md b/README.md
index 7b97e88..1e5b4cc 100644
--- a/README.md
+++ b/README.md
@@ -102,7 +102,7 @@ These host experiments do not qualify device execution or deployment.
## Check the examples yourself
-The examples run on Linux AArch64 hosts only. [`examples/`](examples/) holds 105 programs, each
+The examples run on Linux AArch64 hosts only. [`examples/`](examples/) holds 106 programs, each
`NAME.om` with `NAME.expect` (and `NAME.stdout` when it prints): every trap, one refusal per error
code, the common mistakes and the known defects. `examples/gate.sh` refuses any compiler but the
pinned one, then compiles and runs every program here and in `skills/*/examples/`:
@@ -115,7 +115,7 @@ examples/gate.sh omega-src/seed/out/omc
```
It prints `PASS name` or `FAIL name: reason` per program and ends with
-`GATE PASS examples=110 pass=110 fail=0 omc=3ad9f10f...` (exit 0), `GATE FAIL ...` (exit 1), or a hash
+`GATE PASS examples=111 pass=111 fail=0 omc=3ad9f10f...` (exit 0), `GATE FAIL ...` (exit 1), or a hash
refusal (exit 2), for example `GATE FAIL omc sha256 b4f45121..., pinned 3ad9f10f... (omega-mv f4df8239...)`
for the previous pin's compiler. The `omega-encoding` skill (section 0 and section 13) records the observed results
and the negative controls; [`examples/WOLFRAM.md`](examples/WOLFRAM.md) records the Wolfram checks of
diff --git a/examples/p10_profile.expect b/examples/p10_profile.expect
new file mode 100644
index 0000000..420e65e
--- /dev/null
+++ b/examples/p10_profile.expect
@@ -0,0 +1,2 @@
+compile 0
+exit 0
diff --git a/examples/p10_profile.om b/examples/p10_profile.om
new file mode 100644
index 0000000..b2feb5b
--- /dev/null
+++ b/examples/p10_profile.om
@@ -0,0 +1,39 @@
+note p10_profile: annotations read by the critical source profile seed/profile/profile.om
+note (omega-mv #1063, pending). omc treats them as notes; the profile enforces them:
+note "note p10 pure" (no put, pure callees only), "note p10 effect" (host words allowed),
+note bounded while (bound <= 8192) and every assigned call result read before it is lost.
+global ob uchar 24
+note p10 pure
+fn sq v ulong to ulong
+ret mul v v
+end
+note p10 effect
+fn outu v ulong to ulong
+i = ulong 23
+put ob 23 10
+n = v
+while true bound 20
+i = sub i 1
+put ob i uchar add rem n 10 48
+n = div n 10
+if eq n 0
+break
+end
+end
+w = write 1 ob i sub 24 i
+if ne w long sub 24 i
+ret 1
+end
+ret 0
+end
+fn main to int
+s = ulong 0
+for k ulong 10
+s = add s sq k
+end
+e = outu s
+if ne e 0
+ret 1
+end
+ret 0
+end
diff --git a/examples/p10_profile.stdout b/examples/p10_profile.stdout
new file mode 100644
index 0000000..6cf4452
--- /dev/null
+++ b/examples/p10_profile.stdout
@@ -0,0 +1 @@
+285
diff --git a/skills/omega-encoding/SKILL.md b/skills/omega-encoding/SKILL.md
index 94dd8fa..a37bb8c 100644
--- a/skills/omega-encoding/SKILL.md
+++ b/skills/omega-encoding/SKILL.md
@@ -1296,6 +1296,81 @@ the bound ranges below are those of the pin `3a163bc5`, and the cited lines are
- No loop runs forever and recursion is bounded by the 8 MiB stack. A long-running service needs an
explicit epoch/restart design, not a bigger bound.
+### Critical source profile `seed/profile` (pending omega-mv #1063, DRA-419; not on main)
+
+`seed/profile/profile.om` is a seeded-Omega, token-level checker that adapts Holzmann's Power of Ten to
+`.om` units. It is stricter than `omc`, which compiles every B1/B2/B3 refusal fixture. Run it from the
+omega-mv root, because it reads host words from `seed/effects/effects.om`:
+`profile [bounds] [SOURCE ...]`. The sources are concatenated, and stdin is used when no source is
+given. It prints one token:
+
+| Exit | Output | Meaning |
+|---|---|---|
+| 0 | `PROFILE-PASS` | the unit passes |
+| 1 | `PROFILE-REFUSED:<rule>:<line>` | a rule was violated |
+| 2 | | usage error |
+| 3 | `PROFILE-INVALID` | the unit exceeds a capacity |
+| 4 | | I/O error |
+
+Capacities are 65535 bytes, 4095 lines, 16383 tokens, 63-byte tokens and 128 functions. The rules:
+
+- **B1:** a `while` has `bound N` with N ≤ 8192. A `for` count is a literal, a `const`, `len X`, or carries `bound`.
+- **B2:** recursion is allowed only in qualified form. Every function on a cycle takes `depth` first, never assigns it and has no `new`.
+ - An in-cycle call passes `depth`, or a name guarded by `NAME = add depth 1` / `if gt NAME LIM` (LIM ≤ 64) / an optional call to a unit function / `ret`, `exit` or `trap` / `end`.
+ - The stop must close the guard's then-block. An `else` or any other block line inside the guard is refused.
+ - The assignment and the call must sit in the same block instance. No line between them may leave that block or start its `else` arm; equal nesting depth alone is not enough.
+ - An entry from outside the cycle passes a literal or `const` ≤ 64.
+ - The omc/DRA-311 leaf removal then runs over the remaining edges.
+- **E1:** an assigned call or host result is read before it is reassigned or the function returns. The exemption is `note p10 allow E1 <reason>` on the line before.
+- **X1:** host words appear only in a function preceded by `note p10 effect`.
+- **P1:** a function preceded by `note p10 pure` has no `put` and calls only pure functions.
+- **C1:** `requires`, `ensures` and `invariant` need `om2`. `om2 release` is refused.
+- **Assignments:** omc accepts `name [=] value`, so B2, B3 and E1 share one classifier that recognises both spellings. A line assigns when its second token is `=`, or when its first token is not a statement keyword, a unit function or a host word. omc refuses names that shadow a function (error 10) or a host word (error 16). So `nd sub nd 1`, `depth ulong 0`, `b new T N` and `r f 2` are checked like their `=` forms. The canonical B2 guard must still be written `NAME = add depth 1`.
+
+`bounds` mode skips E1 and X1. The seeded driver `seed/profile/check.om` (it replaced `check.sh` at
+#1063 head `b27482f4`; build it with the pinned compiler and run it from the omega-mv root:
+`mkdir -p build/seed && seed/out/omc < seed/profile/check.om > build/seed/profile-check && chmod +x build/seed/profile-check && build/seed/profile-check`)
+runs these checks and prints `PROFILE CHECK PASS` (exit 0), `PROFILE CHECK FAIL failed=N` (exit 1)
+or `NOT_RUN …` (exit 3, wrong or missing omc):
+
+- the 53 fixture, capacity and stop rows;
+- one killed `profile.om` mutant per rule, plus three more for B2 (guard structure and `=`-less assignment);
+- the profile of the `seed/authority` unit (`action`, `store`, `lock`, `dispatch`);
+- the authority gates, including `dispatch-fault-gate`;
+- negative controls with the pre-fix modules.
+
+The `om-profile-arm64` workflow builds and runs `check.om` weekly and on PRs. The fixes that this profile forced add the following codes:
+
+| Code | Where | Meaning |
+|---|---|---|
+| 43 | `lacq` | more than 1000 tries requested |
+| 40 | `ltry` | the owner pid could not be read: `lerr` is 32 (open), 33 (close) or 34 (short read). Before the fix, a live pid 32 was misread as an error. |
+| 76 | `dispatch` | reconcile refused |
+| 77 | `dispatch` | post-effect record write failed |
+| 78 | `dispatch` | release failed |
+| 79 | `dispatch` | `actlost` failed after a generation change |
+
+What the profile does not do:
+
+- It is not path-sensitive and not a typechecker.
+- It does not check callees outside the unit.
+- It makes no whole-kernel claim.
+
+Example: `examples/p10_profile.om` passes both `omc` and the profile. On 2026-11-07, at omega-mv
+#1063 heads `7ae0a1df` (profile sha256 `98c95aff…e613`), `795f5d0d` (`f4d730cb…1671`), `e6974c5d` (`2d19340a…f5f7`) and `b27482f4` (`2d19340a…f5f7`, `PROFILE-PASS` on the example), its mutants were refused:
+
+| Mutant | Output |
+|---|---|
+| bound removed | `PROFILE-REFUSED:B1:15` |
+| effect note removed | `PROFILE-REFUSED:X1:23` |
+| result overwritten | `PROFILE-REFUSED:E1:34` |
+
+Its output, 285, was checked with Wolfram: `Sum[k^2,{k,0,9}] -> 285`.
+Rerun 2026-11-07 on Linux AArch64 with this example added: `bash examples/gate.sh` against omc
+`3ad9f10f…3194` (omega-mv `f4df8239`, the pin of `gate.sh`) printed `GATE PASS examples=111 pass=111
+fail=0`, exit 0. The profile runs used omega-mv `943d9555` omc `5f90edea…f6df` (`OMC_PIN` at that main).
+At `b27482f4` the same gate printed the same line, and `build/seed/profile-check` printed `PROFILE CHECK PASS`, exit 0.
+
### Compiler limits checked at main `bf54b19fa` (2026-10-29; rechecked at `91c83438d` on 2026-10-31)
Checked with main's `seed/out/omc` (sha256 `62775d2a391cfef7cde64e387655caa9809a267093112910ec76bfa568f3712b`)
@@ -2250,7 +2325,7 @@ are `seed/omc/omc.om` at `9920aab1`.
traps of section 11b (exit 20, `omc: line 8: error 7`, `omc: line 5: error 12`).
Each carries `.expect` (and `fnv1a32` also `.stdin` `abc` and the 4 expected bytes in `.stdout`) and
-runs in [`examples/gate.sh`](../../examples/gate.sh) with the 105 programs in the repository's
+runs in [`examples/gate.sh`](../../examples/gate.sh) with the 106 programs in the repository's
`examples/` directory; section 0 records the `e5b32567` rerun of every row below. The portable guide
for writing a first program is [`skills/writing-omega/SKILL.md`](../writing-omega/SKILL.md).