repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

Say what a release guarantees, and admit the Windows cross-toolchain (#109)

928dbac1af35101291361da086e6bac8319bdf6f

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

## What forced this

§8a assigned the release build to `cargo-zigbuild`, whose README states
plainly that **"currently only Linux and macOS targets are supported."**
Both required Windows targets fall outside it — and a GNU-ABI binary is
not a substitute, since it changes the C++ exception model and the C
runtime users link against. So the spec had assigned a job to a tool
that cannot finish it, and had done so by naming a tool at all.

## The call — split by altitude

**`docs/SPEC.md` says what a release must be true of**, and names no
tool:

- one host builds the matrix; CI installs toolchains and calls `xtask`,
holding no build logic (§1);
- **Windows artifacts are MSVC-ABI** — never a GNU substitute, however
much cheaper to produce;
- **glibc artifacts run on distributions older than the build host** —
reach is a property of the release, not of the machine that made it;
- **no target is silently dropped** — each is built or
skipped-with-reason, and a required failure stops the release;
- an unproven cross-build is established by a prototype (§18) before the
matrix claims it.

**`docs/PROJECT-INVARIANTS.md` records the encoding**, because
repository mechanics are its job: the target-family → cross-compiler
table in §8a, and `cargo-xwin`'s fetched MSVC CRT and Windows SDK as the
**third named exception** to the cargo-only rule in §1.

The test applied throughout: *does this sentence survive the tool being
replaced?* "Windows artifacts are MSVC-ABI" does. "`cargo-xwin` builds
Windows" does not — that is a fact about today's ecosystem, not about
smith.

## What this deliberately doesn't do

Doesn't change the target matrix, artifact format, or
required/best-effort statuses. Doesn't widen §1's shape — the exception
covers the *fetched toolchains*, not the cross-compilers, both of which
remain `cargo install`-able.

## The licence, stated not implied

`cargo-xwin` fetches Microsoft's CRT and Windows SDK; using it **accepts
Microsoft's licence**. That is now an owner-approved condition of
shipping Windows artifacts, recorded where it can be reviewed, rather
than an invisible consequence of a tool choice.

## Evidence

[cargo-zigbuild
README](https://github.com/rust-cross/cargo-zigbuild/blob/main/README.md),
checked 2026-07-25 — Linux and macOS only, with minimum-glibc targeting
via a target-triple suffix.
[`cargo-xwin`](https://github.com/rust-cross/cargo-xwin) exists
specifically to cross-compile Rust to Windows MSVC from Linux. Android's
Bionic and the BSDs are outside both tools' stated support and are
marked unproven.

## Surface touched

`docs/SPEC.md` §14 release guarantees; `docs/PROJECT-INVARIANTS.md` §1
exception list and §8a cross-compilation.

## If this ages badly

If the licence fetch becomes untenable, the fallback is a Windows runner
for those two targets alone — not a GNU-ABI artifact, which would
silently change what users run. The §14 guarantees hold either way; only
the §8a table changes.

---------

Co-authored-by: Claude <noreply@anthropic.com>

Changed files (3)

+79 / −7 text lines

Diff layout

docs/PROJECT-INVARIANTS.md

Modified

+44 / −3 text lines

2424**Prohibited:**
2525- Makefile, justfile, package.json, build.sh
2626- Shell scripts in repo root or scripts/
27- Any build step that requires tools not installable via `cargo install`, with two named exceptions: pinned nightly rustup components required by the `cargo-pup` architecture gate, and the `zig` toolchain required by `cargo-zigbuild` for release cross-builds (§8a)
27- Any build step that requires tools not installable via `cargo install`, with three named exceptions, all confined to gates and release builds: pinned nightly rustup components required by the `cargo-pup` architecture gate; the **toolchains** the cross-compilers drive — the `zig` toolchain `cargo-zigbuild` needs, and the host **LLVM/clang** installation `cargo-xwin` needs (it fetches the Microsoft SDK, not the compiler that consumes it); and the **platform SDKs** themselves — the Microsoft C runtime and Windows SDK that `cargo-xwin` fetches, and a macOS SDK where a C dependency's darwin headers demand one (§4, *Cross-compilation*). The cross-compilers themselves are `cargo install`-able; the exception covers the external toolchains and SDKs they drive, nothing else
2929**Scope:** this invariant governs the **Rust workspace** — the app, its crates,
3030and their build. The published **web site** is a separate artifact and is exempt,
254254| `cargo run -p xtask -- mutants` | Run mutation testing (cargo-mutants) | Nightly |
255255| `cargo run -p xtask -- release` | Build release binary for all targets, archive + checksum | Release |
257### Cross-compilation
259SPEC §14 states what a release must guarantee — one host, MSVC-ABI on Windows, a
260glibc floor below the build host, no target silently dropped. This is the encoding
261that currently satisfies it:
263This table is the **single** encoding of how each target is built. §8a and
264`docs/plans/AGENTIC-DEVELOPMENT.md` point here rather than restating it; four
265copies in lockstep is how the `cargo-zigbuild`-builds-everything falsehood
266survived in §8a after §14 had already been corrected.
268| Target family | Cross-compiler | Proven by |
269|---|---|---|
270| Linux (glibc, musl) | `cargo-zigbuild` — supports a minimum-glibc suffix on the target triple | `prototypes/p34` |
271| macOS | `cargo-zigbuild` — needs a macOS SDK only where a C dependency pulls darwin headers | p34, on a **native** runner |
272| Windows (MSVC) | `cargo-xwin` — fetches Microsoft's CRT and Windows SDK; **using it accepts Microsoft's licence**, an owner-approved condition of shipping Windows artifacts | **unproven** — p34 proved zigbuild→windows-*gnu* and *native* MSVC, never `cargo-xwin`; SPEC §18 prototype required before the matrix relies on it |
273| Android (Bionic) | **unproven** — outside both tools' stated support; SPEC §18 prototype decides before the matrix claims it | — |
274| FreeBSD, OpenBSD, riscv64 (best-effort) | **unproven** — same; best-effort targets may be skipped, but the skip is reported | — |
276`cargo-zigbuild` supports Linux and macOS only, which is why Windows needs the
277second tool rather than a GNU-ABI substitute — SPEC §14 forbids that substitution
278outright, so "cheaper to produce" is not an argument available here.
280Both cross-compilers need something the host must already have: `zig` for one,
281an LLVM/clang installation for the other (`cargo-xwin` fetches Microsoft's SDK
282but not the compiler that consumes it). §1 names both as exceptions.
284The **Proven by** column is load-bearing, not commentary: SPEC §14 forbids the
285matrix claiming a target whose cross-build no prototype has exercised. Windows
286MSVC is listed here as the intended encoding and marked unproven — the release
287matrix may not depend on `cargo-xwin` until a §18 prototype builds with it.
288This table is an implementation choice and may change with the ecosystem; the
289guarantees in SPEC §14 may not.
257291### xtask Implementation Rule
258292xtask commands must be thin orchestrators. They delegate to cargo, nextest, clippy, etc. No heavy logic in xtask. No business logic. Just task coordination.
426460### Release Pipeline
4281. `cargo run -p xtask -- release` — builds all targets via cargo-zigbuild, creates archives, generates checksums.
4292. OpenBSD (Tier 3) is best-effort — build natively if possible, skip otherwise.
4621. `cargo run -p xtask -- release` — builds every target, creates archives,
463 generates checksums. Which cross-compiler each target family uses is the §4
464 *Cross-compilation* table, not restated here: no single tool builds them all,
465 and saying otherwise is what sent the release pipeline at `cargo-zigbuild` for
466 Windows, which it does not support.
4672. Best-effort targets — riscv64, FreeBSD, OpenBSD — build natively where
468 possible and are skipped otherwise. A skip is reported, never silent
469 (SPEC §14); a *required* target that fails stops the release.
431471No CI-driven *release* automation yet: no automated distribution, no code
432472signing — these are deferred. The test/lint/coverage CI gates themselves
535575| Date | Change | Author |
536576|------|--------|--------|
577| 2026-07-25 | §4 becomes the single cross-compiler mapping, with a proven-by column; §1 exception widened to the host LLVM `cargo-xwin` needs and repointed at §4; §8a release pipeline stops naming one tool for every target (user-approved) | smith-spec |
537578| 2026-07-19 | §7 switch rebase→squash merge: rebase-merge can't be signed, so squash is the only method that satisfies signed-commits + linear history; one-PR-one-decision keeps squash = one-commit-per-decision (user-directed) | smith-spec |
538579| 2026-07-18 | §1 scope note: Astro site exempt from the package.json ban, confined to `site/`; book stays mdBook (cargo-native) (user-directed) | smith-spec |
539580| 2026-07-18 | §7 require signed commits on `main`, enforced by the branch ruleset (unlocked by going public) (user-approved) | smith-spec |

docs/SPEC.md

Modified

+26 / −0 text lines

26012601- `smith-{triple}-v{version}.{zip|tar.gz}`,
26022602- `checksums-sha256.txt`.
2604**One host builds the matrix.** Producing thirteen targets must not require
2605thirteen build environments. The release is cross-compiled from a single host
2606wherever a target allows it; CI installs toolchains and invokes `xtask release`,
2607holding no build logic of its own (PROJECT-INVARIANTS §1). Which cross-compilers
2608achieve this is an implementation choice, not a spec commitment — it changes as
2609the ecosystem does.
2611Three properties the artifacts must have, whatever builds them:
2613- **Windows artifacts are MSVC-ABI.** A GNU-ABI binary is a different artifact —
2614 different C++ exception handling, different C runtime — so it is never a
2615 substitute for a target the matrix lists as MSVC, however much easier it is to
2616 produce.
2617- **glibc artifacts run on glibc 2.28 or newer** — Debian 10, RHEL 8, Ubuntu
2618 18.10. The floor is a property of the release, not of whatever the build machine
2619 happens to ship: linking against the builder's glibc silently narrows who can run
2620 smith, and by an amount nobody stated. Raising the floor drops users, so it is a
2621 spec change, not a build detail.
2622- **No target is silently dropped.** Each release accounts for every target as
2623 built, or skipped with a reason. A required target that fails to build stops the
2624 release (above); quietly shipping a short matrix is a defect, not a degraded
2625 release.
2627Where a target's cross-build is unproven, a prototype (§18) establishes it before
2628the matrix claims it — an unverified target is a promise, not a platform.
26042630No install scripts, package manifests, distribution metadata, or code signing in v1.
26062632## 15. xtask

docs/plans/AGENTIC-DEVELOPMENT.md

Modified

+9 / −4 text lines

613613 target matrix still cross-builds (proven in `prototypes/p34-ci-pipeline`).
6146143. It opens a release-readiness issue; the **owner approves the version tag** —
615615 the one release touchpoint.
6164. On the `v*` tag, the release workflow builds every §14 triple (`cargo-zigbuild`
617 for linux/windows-gnu, native runners for msvc/darwin), emits
618 `smith-{triple}-v{version}` archives + `checksums-sha256.txt`, and publishes a
619 **GitHub Release**.
6164. On the `v*` tag, the release workflow builds every §14 triple — per the
617 cross-compiler table in PROJECT-INVARIANTS §4, which is the only place that
618 mapping lives — emits `smith-{triple}-v{version}` archives +
619 `checksums-sha256.txt`, and publishes a **GitHub Release**.
621 This step used to name `cargo-zigbuild` for `windows-gnu`. SPEC §14 forbids a
622 GNU-ABI binary standing in for an MSVC target, so that line described a release
623 the spec would reject — and it survived a correction that touched three other
624 sections because the mapping was written out in four places at once.
621626**Why Releases and not Packages:** GitHub Packages hosts registry artifacts
622627(containers, crates, npm). Smith v1 ships standalone binaries + checksums for end