Skip to content

Commit c9e9027

Browse files
ci(governance): non-blocking drift check for check-ts-allowlist .affine/.deno.js (closes #312) (#318)
## Summary - Adds `just check-ts-allowlist-drift` recipe — re-compiles `scripts/check-ts-allowlist.affine` and diffs against committed `scripts/check-ts-allowlist.deno.js`. - Adds non-blocking (`continue-on-error: true`) CI step in `governance-reusable.yml` that runs the same diff and surfaces a `::warning::` on drift. Skipped gracefully (exit 0) when AffineScript compiler isn't on the runner. - Pointer comment in `check-ts-allowlist.affine` header so maintainers see the drift recipe at the obvious place. Non-blocking until the compiler output is hash-pinned per compiler version (compiler currently stamps a moving "Generated by AffineScript compiler" header). Promotion to blocking is a separate follow-up. ## Closes - #312 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 78ab5c5 commit c9e9027

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/governance-reusable.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,33 @@ jobs:
199199
# the .ts is a separate follow-up after the dual-target window.
200200
run: deno run --allow-read --no-lock .standards-checkout/scripts/check-ts-allowlist.deno.js
201201

202+
- name: check-ts-allowlist source/compile drift (informational)
203+
# Non-blocking — informational until the AffineScript compiler
204+
# output is hash-pinned per compiler version. The compiler header
205+
# currently stamps "Generated by AffineScript compiler" which is
206+
# a moving target as the codegen evolves, so spurious diff =
207+
# "compiler bumped" vs real diff = "someone edited .affine
208+
# without recompiling". Promotion to blocking is gated on a
209+
# compiler-version pin landing (see standards#312).
210+
continue-on-error: true
211+
run: |
212+
if ! command -v affinescript >/dev/null 2>&1; then
213+
echo "::notice::affinescript compiler unavailable on runner — skipping drift check"
214+
exit 0
215+
fi
216+
tmp="$(mktemp /tmp/check-ts-allowlist-drift.XXXXXX.deno.js)"
217+
if ! affinescript compile --deno-esm -o "$tmp" .standards-checkout/scripts/check-ts-allowlist.affine; then
218+
echo "::warning::affinescript compile failed — drift check skipped"
219+
rm -f "$tmp"
220+
exit 0
221+
fi
222+
if diff -u .standards-checkout/scripts/check-ts-allowlist.deno.js "$tmp"; then
223+
echo "✅ check-ts-allowlist .affine source and .deno.js compiled output are in sync"
224+
else
225+
echo "::warning::check-ts-allowlist.deno.js drifted from check-ts-allowlist.affine — re-run \`just check-ts-allowlist-drift\` locally and recommit the .deno.js"
226+
fi
227+
rm -f "$tmp"
228+
202229
# Shared escape hatch for the banned-language-file checks below.
203230
# Honours three exemption mechanisms (see
204231
# standards/docs/EXEMPTION-MECHANISMS.adoc):

Justfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,19 @@ help-me:
125125
@echo "Include the output of 'just doctor' in your report."
126126

127127

128+
# Verify scripts/check-ts-allowlist.deno.js matches what compiling
129+
# scripts/check-ts-allowlist.affine produces. Run after editing the
130+
# .affine source. Exit 0 = in sync; non-zero with diff = drifted.
131+
# See standards#312.
132+
check-ts-allowlist-drift:
133+
@command -v affinescript >/dev/null 2>&1 || { echo "affinescript compiler not on PATH — skipping drift check"; exit 0; }
134+
@tmp="$$(mktemp /tmp/check-ts-allowlist-drift.XXXXXX.deno.js)"; \
135+
affinescript compile --deno-esm -o "$$tmp" scripts/check-ts-allowlist.affine; \
136+
diff -u scripts/check-ts-allowlist.deno.js "$$tmp"; \
137+
rc=$$?; \
138+
rm -f "$$tmp"; \
139+
exit $$rc
140+
128141
# Print the current CRG grade (reads from READINESS.md '**Current Grade:** X' line)
129142
crg-grade:
130143
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \

scripts/check-ts-allowlist.affine

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
//
66
// Step 2 of the estate-wide TypeScript → AffineScript migration campaign
77
// (hyperpolymath/standards#239 umbrella, #241 tail-batch-1 issue).
8+
//
9+
// Compiled output: scripts/check-ts-allowlist.deno.js (committed). After
10+
// editing this file, re-run `just check-ts-allowlist-drift` to verify the
11+
// committed .deno.js matches what compiling this source produces. The
12+
// governance reusable runs the same check in CI as a non-blocking
13+
// informational step (standards#312).
814

915
use Deno::{
1016
readTextFile, walkRecursive, exit, consoleError,

0 commit comments

Comments
 (0)