repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

Stand up a throwaway CI to un-gate cross-build and the arch rule

577b55311f0d24159b16fe7ec2e2e6b844977a07

Claude <noreply@anthropic.com> ·

SSH signature · not checked

Browse filesCompare with HEAD

Two Campaign 7 claims — §14's cross-build matrix and §11's arch-gate — were
marked tooling-gated because the local sandbox has no cross toolchain and no
cargo-pup. Asserting them on faith is exactly the kind of unvalidated boundary
the prototype policy exists to catch, so this stands up a real GitHub Actions
run that exercises them on hardware that has the tools.

The workflow cross-compiles a bin pulling the two heaviest native trees
(vendored LuaJIT via mlua, gix) to the musl and windows-gnu triples, builds the
same bin natively on the three required OS runners, and enforces a forbidden
wcore->wai edge — hard via a stable `cargo metadata` gate, best-effort via
cargo-pup so its real schema outcome is captured rather than guessed. It also
times a cold build+test of every prototype crate to seed the §13.1 sub-budget.

Deliberately temporary: it targets the prototype crates because no production
crate exists yet, and is deleted once its evidence lands. Surface:
prototypes/p34-ci-pipeline and .github/workflows/ci-prototype.yml.

Changed files (15)

+288 / −0 text lines

Diff layout

.github/workflows/ci-prototype.yml

Added
new file mode 100644

+125 / −0 text lines

1# TEMPORARY CI prototype (p34) — evidence for SPEC §14 cross-build, §11
2# arch-gate, and §13.1 cold-build sub-budget. Not the production pipeline:
3# it targets the prototype crates because no production crate exists yet.
4# Delete once its PLAN.md result block is recorded.
5name: ci-prototype
6
7on:
8 push:
9 branches: ["claude/specs-progress-n5u27n"]
10 paths:
11 - ".github/workflows/ci-prototype.yml"
12 - "prototypes/p34-ci-pipeline/**"
13 workflow_dispatch: {}
15permissions:
16 contents: read
18jobs:
19 # §13.1 cold-build sub-budget + §17.10 hermeticity: build and test every
20 # prototype crate on a clean runner, record per-crate wall-clock.
21 prototypes:
22 runs-on: ubuntu-latest
23 steps:
24 - uses: actions/checkout@v4
25 - name: toolchain
26 run: rustup default stable && rustc -V && cargo -V
27 - name: build + test each prototype, timed
28 run: |
29 echo "## Prototype cold build+test (§13.1)" >> "$GITHUB_STEP_SUMMARY"
30 echo "| crate | build+test | seconds |" >> "$GITHUB_STEP_SUMMARY"
31 echo "|-------|-----------|---------|" >> "$GITHUB_STEP_SUMMARY"
32 total=0
33 for d in prototypes/p*/; do
34 name=$(basename "$d")
35 [ -f "$d/Cargo.toml" ] || continue
36 start=$SECONDS
37 if cargo test --manifest-path "$d/Cargo.toml" --quiet >/dev/null 2>&1; then
38 status="ok"
39 else
40 status="FAIL"
41 fi
42 dur=$((SECONDS - start))
43 total=$((total + dur))
44 echo "| $name | $status | $dur |" >> "$GITHUB_STEP_SUMMARY"
45 done
46 echo "| **total** | | **$total** |" >> "$GITHUB_STEP_SUMMARY"
48 # §14 cross-build (un-gates P30): does the heavy native tree cross-compile?
49 cross-build:
50 runs-on: ubuntu-latest
51 steps:
52 - uses: actions/checkout@v4
53 - name: toolchain + targets
54 run: |
55 rustup default stable
56 rustup target add x86_64-unknown-linux-musl aarch64-unknown-linux-musl x86_64-pc-windows-gnu
57 - name: zig + cargo-zigbuild
58 run: |
59 pip3 install ziglang
60 cargo install cargo-zigbuild --locked
61 - name: cross x86_64-unknown-linux-musl
62 id: musl_x64
63 continue-on-error: true
64 run: cargo zigbuild --target x86_64-unknown-linux-musl --manifest-path prototypes/p34-ci-pipeline/cross/Cargo.toml
65 - name: cross aarch64-unknown-linux-musl
66 id: musl_arm
67 continue-on-error: true
68 run: cargo zigbuild --target aarch64-unknown-linux-musl --manifest-path prototypes/p34-ci-pipeline/cross/Cargo.toml
69 - name: cross x86_64-pc-windows-gnu
70 id: win_gnu
71 continue-on-error: true
72 run: cargo zigbuild --target x86_64-pc-windows-gnu --manifest-path prototypes/p34-ci-pipeline/cross/Cargo.toml
73 - name: per-target summary
74 run: |
75 echo "## §14 cross-build (mlua vendored + gix)" >> "$GITHUB_STEP_SUMMARY"
76 echo "| target | result |" >> "$GITHUB_STEP_SUMMARY"
77 echo "|--------|--------|" >> "$GITHUB_STEP_SUMMARY"
78 echo "| x86_64-unknown-linux-musl | ${{ steps.musl_x64.outcome }} |" >> "$GITHUB_STEP_SUMMARY"
79 echo "| aarch64-unknown-linux-musl | ${{ steps.musl_arm.outcome }} |" >> "$GITHUB_STEP_SUMMARY"
80 echo "| x86_64-pc-windows-gnu | ${{ steps.win_gnu.outcome }} |" >> "$GITHUB_STEP_SUMMARY"
82 # §14 native matrix: prove the required OS runners exist and the native tree
83 # builds+runs on each (Windows here covers the msvc target zigbuild can't).
84 native-matrix:
85 strategy:
86 fail-fast: false
87 matrix:
88 os: [ubuntu-latest, macos-latest, windows-latest]
89 runs-on: ${{ matrix.os }}
90 steps:
91 - uses: actions/checkout@v4
92 - run: rustup default stable
93 - name: build + run cross bin natively
94 run: cargo run --manifest-path prototypes/p34-ci-pipeline/cross/Cargo.toml
96 # §11 arch-gate (un-gates P32): the stable-metadata gate is the hard
97 # assertion; cargo-pup is attempted best-effort as the nightly source gate.
98 arch-gate:
99 runs-on: ubuntu-latest
100 defaults:
101 run:
102 working-directory: prototypes/p34-ci-pipeline/archgate
103 steps:
104 - uses: actions/checkout@v4
105 - run: rustup default stable
106 - name: metadata gate PASSES the legal graph
107 run: python3 gate.py
108 - name: metadata gate FAILS once the forbidden edge is injected
109 run: |
110 cp wcore/Cargo.toml /tmp/wcore.bak
111 printf 'wai = { path = "../wai" }\n' >> wcore/Cargo.toml
112 if python3 gate.py; then
113 echo "BUG: gate passed an illegal graph"; cp /tmp/wcore.bak wcore/Cargo.toml; exit 1
114 fi
115 cp /tmp/wcore.bak wcore/Cargo.toml
116 echo "gate correctly rejected the injected wcore->wai edge"
117 - name: cargo-pup on pinned nightly (best-effort P32 probe)
118 id: pup
119 continue-on-error: true
120 run: |
121 rustup toolchain install nightly-2026-01-22 --profile minimal || rustup toolchain install nightly --profile minimal
122 cargo +nightly-2026-01-22 install cargo-pup --locked || cargo install cargo-pup --locked
123 cargo +nightly-2026-01-22 pup || cargo pup
124 - name: pup outcome
125 run: echo "cargo-pup probe outcome:: ${{ steps.pup.outcome }}" >> "$GITHUB_STEP_SUMMARY"

.gitignore

Modified

+3 / −0 text lines

1414# Editor / OS
1515*.swp
1616.DS_Store
18# nested prototype build artifacts (e.g. workspace fixtures)
19prototypes/**/target/

prototypes/p34-ci-pipeline/NOTES.md

Added
new file mode 100644

+24 / −0 text lines

1# p34-ci-pipeline
2
3One prototype, three SPEC claims that only a real CI toolchain can settle:
4
5- **§14 cross-build** (was P30, tooling-gated): does the heavy native tree
6 (vendored LuaJIT via `mlua`, `gix`) cross-compile to the required musl and
7 Windows triples through `cargo-zigbuild`? `cross/` is a minimal bin pulling
8 those deps; the `cross-build` job attempts the §14 matrix and reports the
9 first per-target link/build error.
10- **§11 arch-gate** (was P32, tooling-gated): can `cargo-pup` on the pinned
11 nightly express and enforce a forbidden inter-crate edge? `archgate/` is a
12 tiny 3-crate workspace with a `pup.ron` forbidding `wcore -> wai`. The job
13 proves the gate PASSES the legal graph and FAILS once the edge is injected.
14 The same job runs the stable-metadata fallback (`§3.5 xtask arch`) so §11 has
15 an enforcement path even if `cargo-pup` proves unusable.
16- **§13.1 cold-build sub-budget + §17.10 hermeticity**: the `prototypes` job
17 builds and tests every existing prototype crate on a clean runner and records
18 per-crate wall-clock — the first real cold-build numbers the §13.1 budget is
19 meant to be seeded from, and a check that the mocked-everything test policy
20 actually runs green with no TTY / no network.
22The workflow lives at `.github/workflows/ci-prototype.yml`. It is temporary
23evidence, not the production pipeline: it targets the prototype crates because
24no production crate exists yet (spec/planning phase). Result block: `../PLAN.md`.

prototypes/p34-ci-pipeline/archgate/Cargo.lock

Added
new file mode 100644

+19 / −0 text lines

1# This file is automatically @generated by Cargo.
2# It is not intended for manual editing.
3version = 4
4
5[[package]]
6name = "wai"
7version = "0.1.0"
8
9[[package]]
10name = "wcore"
11version = "0.1.0"
13[[package]]
14name = "wharness"
15version = "0.1.0"
16dependencies = [
17 "wai",
18 "wcore",
19]

prototypes/p34-ci-pipeline/archgate/Cargo.toml

Added
new file mode 100644

+8 / −0 text lines

1# Tiny stand-in for the smith crate graph. Legal edges only:
2# wharness -> wcore, wharness -> wai.
3# The §11 rule under test: wcore must never depend on wai (the real spec forbids
4# smith-core -> smith-ai). The CI job injects that forbidden edge and asserts
5# the gate flips from pass to fail.
6[workspace]
7resolver = "2"
8members = ["wcore", "wai", "wharness"]

prototypes/p34-ci-pipeline/archgate/gate.py

Added
new file mode 100644

+39 / −0 text lines

1#!/usr/bin/env python3
2"""Stable-metadata arch gate (the §3.5 `xtask arch` stand-in).
3
4Reads `cargo metadata` and fails (exit 1) if any package declares a dependency
5the rules forbid. No nightly, no cargo-pup — pure Cargo metadata, so it runs on
6the same stable toolchain as everything else. Forbidden edges are hard-coded to
7mirror the real §11 rule set for this fixture.
8"""
9import json
10import subprocess
11import sys
13FORBIDDEN = [("wcore", "wai")] # §11: core must never depend on ai
16def main() -> int:
17 out = subprocess.run(
18 ["cargo", "metadata", "--format-version=1", "--no-deps"],
19 capture_output=True, text=True, check=True,
20 ).stdout
21 meta = json.loads(out)
22 by_name = {p["name"]: p for p in meta["packages"]}
23 violations = []
24 for src, dst in FORBIDDEN:
25 pkg = by_name.get(src)
26 if not pkg:
27 continue
28 if any(d["name"] == dst for d in pkg["dependencies"]):
29 violations.append((src, dst))
30 if violations:
31 for s, d in violations:
32 print(f"ARCH VIOLATION: {s} -> {d} is forbidden by §11", file=sys.stderr)
33 return 1
34 print("arch gate clean: no forbidden inter-crate edges")
35 return 0
38if __name__ == "__main__":
39 sys.exit(main())

prototypes/p34-ci-pipeline/archgate/pup.ron

Added
new file mode 100644

+16 / −0 text lines

1// Best-effort cargo-pup config expressing the §11 forbidden edge wcore -> wai.
2// P32's open question is exactly whether cargo-pup's schema can state this; the
3// CI job runs pup as `continue-on-error` and captures the real outcome, while
4// the stable-metadata fallback gate (§3.5) is the hard assertion. If this RON
5// shape is wrong, that error IS the evidence that §11 should lean on the
6// metadata gate rather than the nightly source lint.
7Pup(
8 lints: [
9 ArchitectureLint(
10 name: "core-must-not-depend-on-ai",
11 forbidden: [
12 (from: "wcore", to: "wai"),
13 ],
14 ),
15 ],
16)

prototypes/p34-ci-pipeline/archgate/wai/Cargo.toml

Added
new file mode 100644

+6 / −0 text lines

1[package]
2name = "wai"
3version = "0.1.0"
4edition = "2021"
5publish = false
6[dependencies]

prototypes/p34-ci-pipeline/archgate/wai/src/lib.rs

Added
new file mode 100644

+1 / −0 text lines

1pub fn ai_marker() -> &'static str { "wai" }

prototypes/p34-ci-pipeline/archgate/wcore/Cargo.toml

Added
new file mode 100644

+7 / −0 text lines

1[package]
2name = "wcore"
3version = "0.1.0"
4edition = "2021"
5publish = false
6# Legal: depends on nothing in-workspace. The §11 rule forbids a wai edge here.
7[dependencies]

prototypes/p34-ci-pipeline/archgate/wcore/src/lib.rs

Added
new file mode 100644

+1 / −0 text lines

1pub fn core_marker() -> &'static str { "wcore" }

prototypes/p34-ci-pipeline/archgate/wharness/Cargo.toml

Added
new file mode 100644

+9 / −0 text lines

1[package]
2name = "wharness"
3version = "0.1.0"
4edition = "2021"
5publish = false
6# Legal wiring crate: allowed to see both leaves.
7[dependencies]
8wcore = { path = "../wcore" }
9wai = { path = "../wai" }

prototypes/p34-ci-pipeline/archgate/wharness/src/lib.rs

Added
new file mode 100644

+1 / −0 text lines

1pub fn wire() -> String { format!("{}+{}", wcore::core_marker(), wai::ai_marker()) }

prototypes/p34-ci-pipeline/cross/Cargo.toml

Added
new file mode 100644

+13 / −0 text lines

1[package]
2name = "p34-cross"
3version = "0.1.0"
4edition = "2021"
5publish = false
6
7# The two heaviest native trees named in §14's cross-build risk: vendored
8# LuaJIT (C, built by cc for the target) and gix (with a rustls transport so
9# no C openssl is dragged in). If these cross-compile to musl/windows, the
10# §14 target matrix is credible.
11[dependencies]
12mlua = { version = "0.10", features = ["luajit", "vendored"] }
13gix = { version = "0.85", default-features = false, features = ["blame", "revision", "sha1"] }

prototypes/p34-ci-pipeline/cross/src/main.rs

Added
new file mode 100644

+16 / −0 text lines

1// Minimal exercise of the two native trees so the cross-build actually links
2// and runs the C code, not just compiles a stub. Prints proof the vendored
3// LuaJIT VM initialized and gix's object hashing is reachable on the target.
4
5fn main() {
6 let lua = mlua::Lua::new();
7 let v: String = lua
8 .load("return _VERSION .. ' ok'")
9 .eval()
10 .expect("luajit eval");
11 println!("lua: {v}");
13 // Touch gix so its object/hash code is linked into the target binary.
14 let oid = gix::hash::ObjectId::empty_blob(gix::hash::Kind::Sha1);
15 println!("gix empty-blob oid: {oid}");
16}