openc7677a4aa16dccdd #378 · opened 2026-11-06 20:41 UTC
Imported from GitHub aien-dev/aien-architecture-mv#378, by drakestapleton
Base ad8d1eb359e7ae86a8ef6613cd3c4479f5676db9 · Head 786202ad33fd1ddb5d760a24e47355112d531714
drakestapleton wrote on 2026-11-06 20:41 UTC
Issue-first tracking
Tracking issue: Refs aien-dev/aien-architecture-mv#370 (residual: the two checkouts of job pinned-omc-gates, added by #374).
Gates advanced and status: ARCH-SCRIPT-TESTS host run PASS (pinned omc). aien-test verify of this workflow change: BLOCKED_OPERATOR (docs/REPOSITORY_EXECUTION_RULES.md section 2a), NOT_RUN by this PR.
Head SHA:786202ad33fd1ddb5d760a24e47355112d531714
Change
.github/workflows/aien-verification.yml lines 141 and 161: actions/checkout@v7 → actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1, the same pin as every other checkout in the file. gh api repos/actions/checkout/git/ref/tags/v7.0.1 → {"sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","type":"commit"}.
tools/workflow-pins/actpins.om (seeded .om, no shell or foreign runtime): reports every uses: whose ref is not exactly 40 lowercase hex. A docker @sha256: digest and a ./ local action count as pinned. Exits 1 on any finding.
There was no existing workflow lint, so no new job was added. The existing script-tests step of ARCH-SCRIPT-TESTS, which the pinned-omc job already runs, now builds actpins with the pinned omc. It first requires the planted fixture tools/workflow-pins/fixtures/unpinned.yml to be refused (9 uses, 5 unpinned, exit 1), then requires .github/workflows/*.yml to report 0 unpinned. New observation: workflow_uses_unpinned == 0. README updated.
Evidence (Spark host, taskset -c 6 nice -n 10 bwrap …, AIEN_OMC = omega.pin omc sha256 734f0a39…6b61; also compiled with omega-mv e5b32567 omc 2c824805…029f, same results)
Run
rc
last output
BEFORE: check on this branch with main's workflow (bash tests/gates/run.sh script-tests)
diff --git a/.github/workflows/aien-verification.yml b/.github/workflows/aien-verification.yml
index c908d24..0ced6c1 100644
--- a/.github/workflows/aien-verification.yml
+++ b/.github/workflows/aien-verification.yml
@@ -138,7 +138,7 @@ jobs:
timeout-minutes: 20
steps:
- name: Checkout the head under test
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# The pin is read from the head under test because the gates check AIEN_OMC against that same
# file; a PR that moves the pin is tested with the compiler it names.
@@ -158,7 +158,7 @@ jobs:
echo "omc pin: $repo@$commit, omc sha256 $omc_sha256"
- name: Checkout the pinned Omega seed (${{ steps.pin.outputs.repo }} @ ${{ steps.pin.outputs.commit }})
- uses: actions/checkout@v7
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ steps.pin.outputs.repo }}
ref: ${{ steps.pin.outputs.commit }}
diff --git a/README.md b/README.md
index 5e16c5e..fe1499e 100644
--- a/README.md
+++ b/README.md
@@ -106,7 +106,7 @@ The Spark runs five gates on every pull request. Each manifest in `tests/gates/`
```sh
bash tests/gates/run.sh crumb-verify # gate CRUMB-VERIFY: the crumbs are current
bash tests/gates/run.sh crumb-tool-test # gate ARCH-CRUMB-TOOL-TEST: the crumb tool tests
-bash tests/gates/run.sh script-tests # gate ARCH-SCRIPT-TESTS: tests of the four checked scripts
+AIEN_OMC=<pinned omc> bash tests/gates/run.sh script-tests # gate ARCH-SCRIPT-TESTS: the four checked scripts, the candidate checkers, and the workflow action-pin check (tools/workflow-pins/actpins.om; NOT_RUN without the pinned compiler)
AIEN_OMC=<pinned omc> bash tests/gates/run.sh doctrine # gate ARCH-DOCTRINE: doctrine consistency (tools/doctrine, seeded .om; NOT_RUN without the pinned compiler)
bash tests/gates/run.sh qualification-status # gate ARCH-QUALIFICATION-STATUS: R16 status wording
```
diff --git a/tests/gates/arch-script-tests.gate b/tests/gates/arch-script-tests.gate
index 0a4dc92..0c81eec 100644
--- a/tests/gates/arch-script-tests.gate
+++ b/tests/gates/arch-script-tests.gate
@@ -1,6 +1,8 @@
# tests/gates/arch-script-tests.gate
# Mirrors hosted: offline tests of scripts/pr-gate.sh, rebase-crumb.sh and the seeded .om candidate checkers
-# tools/candidate/check_candidate.om, check_pins.om with their parity corpus (hosted: AIEN Pinned-omc Gates on ubuntu-24.04-arm; NOT_RUN without the pinned AIEN_OMC)
+# tools/candidate/check_candidate.om, check_pins.om with their parity corpus, and the seeded .om workflow
+# action-pin check tools/workflow-pins/actpins.om over .github/workflows/*.yml (#370)
+# (hosted: AIEN Pinned-omc Gates on ubuntu-24.04-arm; NOT_RUN without the pinned AIEN_OMC)
gate: ARCH-SCRIPT-TESTS
manifest_version: 2
owner: aien-architecture
@@ -9,6 +11,8 @@ requires:
inputs:
- scripts/
- tools/candidate/
+ - tools/workflow-pins/
+ - .github/workflows/
- tools/zero-legacy/omega.pin
- tests/gates/
run:
@@ -16,7 +20,7 @@ run:
args: ["script-tests"]
expects:
exit: 0
- observe: ["script_tests_run == 4", "candidate_parity_different == 0"]
+ observe: ["script_tests_run == 4", "candidate_parity_different == 0", "workflow_uses_unpinned == 0"]
verdict: PASS
timeout: 10m
exactness: EXACT
diff --git a/tests/gates/run.sh b/tests/gates/run.sh
index fd09fd0..8336549 100755
--- a/tests/gates/run.sh
+++ b/tests/gates/run.sh
@@ -81,6 +81,24 @@ case "$step" in
bash "$t"
done
obs script_tests_run 4
+ # Workflow action pins (#370), seeded .om: every `uses:` in .github/workflows/*.yml must name a
+ # 40-hex commit SHA (or a docker sha256 digest, or a ./ local action), never a tag such as @v7.
+ # The planted fixture must be refused with exactly its five unpinned rows first, so a checker
+ # that passes everything cannot pass this step.
+ "$omc" < tools/workflow-pins/actpins.om > "$build/actpins"
+ chmod +x "$build/actpins"
+ fixture_rc=0
+ "$build/actpins" tools/workflow-pins/fixtures/unpinned.yml > "$build/actpins-fixture.log" || fixture_rc=$?
+ cat "$build/actpins-fixture.log"
+ if [ "$fixture_rc" -ne 1 ] || ! grep -qx 'actpins: 9 uses, 5 unpinned' "$build/actpins-fixture.log"; then
+ echo "run.sh: actpins did not refuse its planted fixture as expected (exit $fixture_rc)" >&2
+ exit 1
+ fi
+ pins_rc=0
+ "$build/actpins" .github/workflows/*.yml > "$build/actpins.log" || pins_rc=$?
+ cat "$build/actpins.log"
+ obs workflow_uses_unpinned "$(sed -n 's/^actpins: [0-9]* uses, \([0-9]*\) unpinned$/\1/p' "$build/actpins.log")"
+ [ "$pins_rc" -eq 0 ]
;;
zero-legacy)
# #316: gate.sh independently checks the compiler pin before executing AIEN_OMC.
diff --git a/tools/workflow-pins/actpins.om b/tools/workflow-pins/actpins.om
new file mode 100644
index 0000000..892bd9e
--- /dev/null
+++ b/tools/workflow-pins/actpins.om
@@ -0,0 +1,305 @@
+note SPDX-License-Identifier: Apache-2.0
+note actpins: is every `uses:` of a GitHub workflow pinned to a full commit SHA? (aien-architecture-mv #370)
+note usage: actpins FILE...
+note exit 0 every uses: is pinned; 1 any is not; 64 usage; 65 a file cannot be read or holds 65535 bytes or more.
+note Pinned: `OWNER/REPO[/PATH]@REF` with REF exactly 40 lowercase hex (a commit SHA, which moving a tag
+note cannot change), `docker://IMAGE@sha256:` plus 64 lowercase hex, or `./PATH` (a local action read
+note from the checked-out tree). Anything else, such as `@v7`, `@main` or an empty value, is UNPINNED.
+note A line is a `uses:` line when, after blanks and an optional `- `, it starts with `uses:`; a line whose
+note first non-blank byte is `#` is a comment. The value may be quoted with ' or ".
+note Output: `UNPINNED FILE:LINE: VALUE` per finding, then `actpins: N uses, F unpinned` and
+note `actpins: PASS` or `actpins: FAIL`.
+
+text tuse "usage: actpins FILE...\n"
+text terr "actpins: cannot read, or 65535 bytes or more: "
+text tunp "UNPINNED "
+text tsum "actpins: "
+text tsu2 " uses, "
+text tsu3 " unpinned\n"
+text tpass "actpins: PASS\n"
+text tfail "actpins: FAIL\n"
+text tcol ":"
+text tcs ": "
+text tkey "uses:"
+text tdock "docker://"
+text tsha "sha256:"
+
+global fbuf uchar 65536
+global flen ulong 1
+global name uchar 4096
+global nlen ulong 1
+global nb uchar 24
+global nuses ulong 1
+global nbad ulong 1
+
+fn wnl to void
+put nb 0 10
+r = write 1 nb 0 1
+end
+
+fn wnum v ulong to void
+n = ulong 0
+if eq v 0
+put nb 23 48
+n = 1
+end
+x = v
+while gt x 0 bound 20
+put nb sub 23 n uchar add 48 rem x 10
+x = div x 10
+n = add n 1
+end
+r = write 1 nb sub 24 n n
+end
+
+note read argument k into name and its file into fbuf
+fn load k ulong to bool
+put flen 0 0
+put nlen 0 0
+n = argread k name 0 4095
+if lt n 1
+ret false
+end
+put nlen 0 ulong n
+fd = fopen name 0 ulong n 0 0
+if lt fd 0
+ret false
+end
+r = read int fd fbuf 0 65535
+x = fclose int fd
+if lt r 0
+ret false
+end
+if ge r 65535
+ret false
+end
+put flen 0 ulong r
+ret true
+end
+
+note fbuf at i, before e, starts with text tkey
+fn iskey i ulong e ulong to bool
+m = len tkey
+if gt add i m e
+ret false
+end
+for j ulong m
+if ne get fbuf add i j get tkey j
+ret false
+end
+end
+ret true
+end
+
+fn isdock i ulong e ulong to bool
+m = len tdock
+if gt add i m e
+ret false
+end
+for j ulong m
+if ne get fbuf add i j get tdock j
+ret false
+end
+end
+ret true
+end
+
+fn issha i ulong e ulong to bool
+m = len tsha
+if gt add i m e
+ret false
+end
+for j ulong m
+if ne get fbuf add i j get tsha j
+ret false
+end
+end
+ret true
+end
+
+fn isblank c ulong to bool
+if eq c 32
+ret true
+end
+ret eq c 9
+end
+
+note fbuf[s, e) is exactly m lowercase hex digits
+fn ishex s ulong e ulong m ulong to bool
+if ne sub e s m
+ret false
+end
+i = s
+while lt i e bound 65536
+c = ulong get fbuf i
+d = and ge c 48 le c 57
+h = and ge c 97 le c 102
+if not or d h
+ret false
+end
+i = add i 1
+end
+ret true
+end
+
+note the value fbuf[v, ve) is pinned
+fn pinned v ulong ve ulong to bool
+if ge v ve
+ret false
+end
+if eq get fbuf v 46
+if lt add v 1 ve
+if eq get fbuf add v 1 47
+ret true
+end
+end
+end
+a = ve
+i = v
+while lt i ve bound 65536
+if eq get fbuf i 64
+a = i
+end
+i = add i 1
+end
+if eq a ve
+ret false
+end
+r = add a 1
+if isdock v ve
+if not issha r ve
+ret false
+end
+ret ishex add r len tsha ve 64
+end
+ret ishex r ve 40
+end
+
+note judge the line fbuf[s, e) numbered ln
+fn line s ulong e ulong ln ulong to void
+p = s
+while lt p e bound 65536
+if not isblank ulong get fbuf p
+break
+end
+p = add p 1
+end
+if ge p e
+ret
+end
+if eq get fbuf p 35
+ret
+end
+if eq get fbuf p 45
+if lt add p 1 e
+if isblank ulong get fbuf add p 1
+p = add p 1
+while lt p e bound 65536
+if not isblank ulong get fbuf p
+break
+end
+p = add p 1
+end
+end
+end
+end
+if not iskey p e
+ret
+end
+p = add p len tkey
+if lt p e
+if not isblank ulong get fbuf p
+ret
+end
+end
+while lt p e bound 65536
+if not isblank ulong get fbuf p
+break
+end
+p = add p 1
+end
+v = p
+q = ulong 0
+if lt v e
+c = ulong get fbuf v
+if or eq c 34 eq c 39
+q = c
+v = add v 1
+end
+end
+ve = v
+while lt ve e bound 65536
+c = ulong get fbuf ve
+if gt q 0
+if eq c q
+break
+end
+end
+if eq q 0
+if or isblank c eq c 13
+break
+end
+end
+ve = add ve 1
+end
+put nuses 0 add get nuses 0 1
+if pinned v ve
+ret
+end
+put nbad 0 add get nbad 0 1
+r = write 1 tunp 0 len tunp
+r = write 1 name 0 get nlen 0
+r = write 1 tcol 0 len tcol
+wnum ln
+r = write 1 tcs 0 len tcs
+r = write 1 fbuf v sub ve v
+wnl
+end
+
+fn scan to void
+n = get flen 0
+s = ulong 0
+ln = ulong 1
+while lt s n bound 65536
+e = s
+while lt e n bound 65536
+if eq get fbuf e 10
+break
+end
+e = add e 1
+end
+line s e ln
+ln = add ln 1
+s = add e 1
+end
+end
+
+fn main to int
+if lt argcnt 2
+r = write 2 tuse 0 len tuse
+ret 64
+end
+k = ulong 1
+while lt k ulong argcnt bound 256
+if not load k
+r = write 2 terr 0 len terr
+r = write 2 name 0 get nlen 0
+put nb 0 10
+r = write 2 nb 0 1
+ret 65
+end
+scan
+k = add k 1
+end
+r = write 1 tsum 0 len tsum
+wnum get nuses 0
+r = write 1 tsu2 0 len tsu2
+wnum get nbad 0
+r = write 1 tsu3 0 len tsu3
+if gt get nbad 0 0
+r = write 1 tfail 0 len tfail
+ret 1
+end
+r = write 1 tpass 0 len tpass
+ret 0
+end
diff --git a/tools/workflow-pins/fixtures/unpinned.yml b/tools/workflow-pins/fixtures/unpinned.yml
new file mode 100644
index 0000000..b4e0615
--- /dev/null
+++ b/tools/workflow-pins/fixtures/unpinned.yml
@@ -0,0 +1,14 @@
+# Planted fixture for tools/workflow-pins/actpins.om (#370): tests/gates/run.sh script-tests expects
+# exit 1 and the summary "actpins: 9 uses, 5 unpinned". Rows marked UNPINNED must be reported.
+steps:
+ # uses: actions/commented@v1
+ - uses: ./local/action
+ - uses: "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1" # quoted, pinned
+ - uses: actions/checkout@3D3C42E5AAC5BA805825DA76410C181273BA90B1 # UNPINNED: uppercase hex
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b # UNPINNED: 39 hex
+ uses: org/repo/path@main # UNPINNED: branch
+ - uses: docker://alpine@sha256:0000000000000000000000000000000000000000000000000000000000000000
+ - uses: docker://alpine:3 # UNPINNED: tag
+ - uses: actions/checkout@v7 # UNPINNED: floating tag
+ - usesx: not-a-uses-key@v1
+ - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0