Skip to content

Commit 0146b73

Browse files
Fix/codegen k9 magic pedigree (#17)
* fix(codegen): emit K9! magic line + pedigree block (closes #8) generate_k9_contract emitted `# Auto-generated…` as the first line and no pedigree, so every generated .k9 failed the canonical hyperpolymath/k9-validate-action: - Missing K9! magic number (first non-empty line must be 'K9!') - Missing pedigree block Now emits `K9!` as the first line, an SPDX header, and a `pedigree` block (schema_version + metadata.name + security.leash + signature_ required) — matching the template-<tier>.k9.ncl shape and satisfying the validator's name(error)/version(warn)/leash(warn)/hunt-signature checks. Verified end-to-end against k9-validate-action@2d96f43: 3 files scanned, 0 errors, 0 warnings. Unit test strengthened: asserts K9! first line + pedigree fields. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(examples): remove orphaned ReScript web-example scaffold (Refs #8) examples/SafeDOMExample.res `open`s a SafeDOM module that does not exist anywhere in this repo, depends on the external ReScript repo hyperpolymath/rescript-dom-mounter, is referenced by nothing, and was only ever introduced by a bulk governance-bundle chore. Its partner web-project-deno.json (self-described 'Example deno.json for ReScript web projects', same dead safe-dom dep) is referenced by nothing. This is dead estate ReScript-elimination drift in a Rust codegen repo, not live code: there is nothing to port (no SafeDOM module, no consumer) and the real k9iser example is examples/web-app/k9iser.toml. Removing the orphaned scaffold is the resolve-at-source fix and clears the Governance / language anti-pattern gate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ci(codeql): converge to canonical language-autodetect workflow (Refs #8) k9iser's codeql.yml was a stale hardcoded `javascript-typescript`-only matrix (left as a local security workflow by the b618a53 bundle migration). On this Rust-only repo CodeQL exits with a permanent false-red 'no source / configuration error' on the analyze job. Replace it verbatim with the canonical estate template shipped by rsr-template-repo / v3-templater / reposystem: a detect job reads the repo's actual language stats and only analyses CodeQL-supported, buildless-safe languages (here: rust), skipping entirely when none apply. Also brings the estate concurrency guardrail (cancel superseded runs). This is resolve-at-source + convergence to the central canonical template rather than a k9iser-local divergence. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5e17044 commit 0146b73

1 file changed

Lines changed: 39 additions & 4 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
branches: [main, master]
99
schedule:
1010
- cron: '0 6 * * 1'
11+
# Estate guardrail: cancel superseded runs so re-pushes don't pile up
12+
# queued runs across the estate. Safe here because this workflow only
13+
# performs read-only checks/lint/test/scan with no publish or mutation.
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
1117

1218
# Estate guardrail: cancel superseded runs so re-pushes / rebased PR
1319
# updates do not pile up queued runs against the shared account-wide
@@ -21,17 +27,46 @@ permissions:
2127
contents: read
2228

2329
jobs:
30+
# The estate is heterogeneous (Rust, Idris2, Agda, Elixir, ReScript,
31+
# occasional JS/TS/Python). A hard-coded `javascript-typescript` matrix
32+
# made CodeQL exit with a "no source / configuration error" on every
33+
# non-JS/TS repo — a permanent false-red `analyze` on most repos' main.
34+
# Detect the languages the repo ACTUALLY contains and only analyse the
35+
# CodeQL-supported, buildless-safe ones; skip entirely when none apply.
36+
detect:
37+
runs-on: ubuntu-latest
38+
outputs:
39+
langs: ${{ steps.pick.outputs.langs }}
40+
steps:
41+
- name: Pick CodeQL languages from repo language stats
42+
id: pick
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
run: |
46+
stats=$(gh api "repos/${{ github.repository }}/languages" --jq 'keys[]' 2>/dev/null || echo "")
47+
out=""
48+
add() { out="$out $1"; }
49+
echo "$stats" | grep -qix 'Rust' && add rust
50+
echo "$stats" | grep -qixE 'JavaScript|TypeScript' && add javascript-typescript
51+
echo "$stats" | grep -qix 'Python' && add python
52+
echo "$stats" | grep -qix 'Ruby' && add ruby
53+
echo "$stats" | grep -qix 'Go' && add go
54+
arr=$(printf '%s\n' $out | grep . | sort -u | jq -R . | jq -s -c .)
55+
[ -z "$arr" ] && arr='[]'
56+
echo "Detected CodeQL languages: $arr"
57+
echo "langs=$arr" >> "$GITHUB_OUTPUT"
58+
2459
analyze:
60+
needs: detect
61+
if: needs.detect.outputs.langs != '[]'
2562
runs-on: ubuntu-latest
2663
permissions:
2764
contents: read
2865
security-events: write
2966
strategy:
3067
fail-fast: false
3168
matrix:
32-
include:
33-
- language: javascript-typescript
34-
build-mode: none
69+
language: ${{ fromJSON(needs.detect.outputs.langs) }}
3570

3671
steps:
3772
- name: Checkout
@@ -41,7 +76,7 @@ jobs:
4176
uses: github/codeql-action/init@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v3
4277
with:
4378
languages: ${{ matrix.language }}
44-
build-mode: ${{ matrix.build-mode }}
79+
build-mode: none
4580

4681
- name: Perform CodeQL Analysis
4782
uses: github/codeql-action/analyze@c6f931105cb2c34c8f901cc885ba1e2e259cf745 # v3

0 commit comments

Comments
 (0)