Commit 16160f8
feat(scripts+ci): swap governance TS-allowlist check to AffineScript-compiled .deno.js (#311)
**Depends on: #310**
Second half of the seed-PR plan from #283: once the `.affine` source
actually compiles + runs (#310), wire the workflow at the
AffineScript-compiled output.
## Changes
1. **`scripts/check-ts-allowlist.deno.js`** (NEW, 344 lines)
- Generated by `affinescript compile --deno-esm` from the post-#310
`.affine` source. Self-contained Deno-ESM bundle: inlined runtime shims
for codegen-known externs (walkRecursive, regexMatch, readTextFile,
exit, consoleError) + the `split` / `ends_with` helpers. Auto-invokes
`await main()` at module load — same shape Deno runs the existing .ts
with.
2. **`.github/workflows/governance-reusable.yml:193`**
- `deno run ... check-ts-allowlist.ts` → `...
check-ts-allowlist.deno.js`
- Comment block explains the dual-target window: .ts kept for the
regression suite (`scripts/tests/check-ts-allowlist-test.sh`) and for
parallel-validation; retirement is a separate follow-up after the
validation window.
## Why ship the compiled artifact (vs compile-in-CI)
Compile-in-CI would require an AffineScript toolchain in the workflow
(OCaml + dune + affinescript repo as a dep). The compiler is
deterministic for this surface; committing the output keeps CI
provider-free and matches the precedent in
`affinescript/tests/codegen-deno/*.deno.js` (committed golden files).
Drift between source and committed output is the obvious risk. Follow-up
will add a `just check-ts-allowlist-drift` recipe (recompile + diff)
wired into a non-blocking CI lint.
## Verification
End-to-end runtime test of the compiled output (matches the runtime fix
in PR #310 commit b046787):
| fixture | exit | output |
|---|---|---|
| empty dir | 0 | success line |
| `src/Foo.ts` violation | 1 | error block + file list |
| `mod.ts` (filename ok) | 0 | success line |
| `scripts/x.ts` (dir ok) | 0 | success line |
## Test plan
- [ ] CI green on this branch — note AS scanner / Hypatia / SPARK
Theatre Gate may need to acknowledge the new committed `.deno.js` as a
generated artifact (ignore findings tagged as generated)
- [ ] `scripts/tests/check-ts-allowlist-test.sh` still passes against
the unchanged .ts archetype (no behavioural change to .ts)
- [ ] Caller repos using `governance-reusable.yml` show green "Check for
TypeScript" steps after merge
Refs #239 (umbrella TS→AffineScript), #241 (STEP 2 tail-batch-1).
Follow-up plan: add drift-detection lint, then a separate PR retires the
.ts archetype after the parallel-validation window.
Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent af5cd0c commit 16160f8
3 files changed
Lines changed: 369 additions & 4 deletions
File tree
- .github/workflows
- docs
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
194 | 201 | | |
195 | 202 | | |
196 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| |||
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
233 | 241 | | |
234 | 242 | | |
235 | 243 | | |
236 | 244 | | |
237 | 245 | | |
238 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
239 | 253 | | |
240 | 254 | | |
0 commit comments