Skip to content

feat(xtask): cargo xtask ci and install, with pinned gate tools - #9

Draft
LordVoid wants to merge 6 commits into
developmentfrom
feat/xtask-ci-install
Draft

LordVoid wants to merge 6 commits into
developmentfrom
feat/xtask-ci-install

Conversation

@LordVoid

Copy link
Copy Markdown

What

On 2026-10-13 Christian set cargo xtask as the one build entrypoint for every estate repo, with nothing behind it but cargo and rustup. This PR adds that entrypoint to kd beside the existing tooling. Nothing is removed or renamed: the Makefile, the Justfile, lefthook, spec-check, toolchain-check, pin-check, fetch-contracts and every existing CI job are unchanged.

  • Spec first. Spec 0002 gains the EARS clauses XT-1 to XT-9 for the gates. Spec 0004 records the four gate tools, their versions and their licences.
  • xtask/src/gates.rs adds tools, fmt, fmt-check, clippy, test, doc-test, deny, typos, machete, ci and install. toolchain-check is the existing one.
    • ci runs tools, toolchain-check, fmt-check, clippy, test, doc-test, deny, typos and machete, in that order. It stops at the first failure, prints one summary line per step, and exits non-zero when a step fails.
    • install runs ci, then cargo build --release --locked --workspace --exclude xtask --bins.
  • tools installs cargo-deny 0.19.9, typos-cli 1.49.0, cargo-machete 0.9.1 and cargo-nextest 0.9.104 from one const table. It uses cargo install --locked --version X --root .tools --force, and only for a tool that is missing or at another version.
  • CI: one new job, xtask-ci, runs cargo xtask ci on ubuntu-latest, the runner the existing Rust jobs use. It uses SHA-pinned checkout and rust-cache, with .tools cached.
  • Docs: a README "Build" section, and a CHANGELOG line under Unreleased.

Evidence

  • Unit tests, red then green. 16 tests carry their clause in their names.

    • Against stub bodies, 12 of 15 failed first. The 16th test, for the environment fix below, was red on its own before its fix.
    • After the code, 16 of 16 pass on rustc 1.94.1.
  • cargo xtask ci ran on head d8d89a9 in a Linux rust:1.94.1 container. kd's pidfd and prctl code only compiles on Linux. All 9 steps passed:

    step result
    tools ok (built all four from source in 240 s, first run)
    toolchain-check ok (1.94.1)
    fmt-check ok
    clippy ok
    test ok, nextest 69/69
    doc-test ok, 2/2
    deny ok
    typos ok
    machete ok
  • Other checks:

    • cargo xtask spec-check and cargo xtask pin-check pass.
    • actionlint is clean.
    • All new files are 7-bit ASCII (AGENTS.md rule 10).
  • cargo xtask install was not run. Its release-build command line is unit-tested (XT-8), and it starts with the same ci.

Decisions

  • Tool builds. The tools build under Rust 1.94.1 (rustup run --install 1.94.1 cargo install ...). That is the pin here, and the ci-rust image's Rust. typos-cli 1.49.0 needs rustc 1.91.
  • Where the tools go. They install into .tools/, which is already gitignored, and .tools/bin goes first on PATH for every gate.
    • This means no writes to CARGO_HOME, which is read-only on ci-rust, and no change to a developer's own tools.
    • The probe asks the copy the gate would run. On ci-rust, the baked cargo-deny 0.19.9 and typos 1.49.0 already match, so they are not rebuilt.
  • Environment. Gates run without the CARGO_PKG_* and CARGO_MANIFEST_* variables that cargo sets for xtask itself. cargo-machete reads CARGO_PKG_NAME to decide whether cargo started it, and misparses its arguments when it is set (XT-6).
  • Jobs and nextest. -j comes from JOBS, default 2 (spec 0002's -j rule). test uses nextest when it is installed, otherwise cargo test. CI sets NEXTEST_PROFILE=ci, as make ci does.
  • Tool versions. All four contract versions exist on crates.io and are used as given.
  • Ticket. No Linear ticket tracks the cargo-only move.

🤖 Generated with Claude Code

https://claude.ai/code/session_016CEVHJcKc5vyDHPYDF9oVc

LordVoid and others added 6 commits October 14, 2026 04:36
Christian set `cargo xtask` as the one build entrypoint for all estate
repos on 2026-10-13. Spec 0002 now states the xtask gates as EARS
clauses: tools, toolchain-check, fmt, fmt-check, clippy, test,
doc-test, deny, typos, machete, ci and install, and the CI job
xtask-ci. Spec 0004 records the four gate tools and their pins.

The make and just targets stay. Nothing is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3RqcQN6pUxehj669b4mRg
Tests for spec 0002, XT-1 to XT-8, named for the clauses they prove:
command names and parsing (XT-1), the one pinned tool table (XT-2),
version matching, the install command and PATH order (XT-3), the job
count and each gate's command line (XT-6), ci's step order, its stop
at the first failure and its summary lines (XT-7), and install's
release build (XT-8). main.rs dispatches the gate names.

The bodies are stubs, so the tests run red first: 12 of 15 fail on
rustc 1.94.1. The three that pass are the tool table (data) and two
that a stub returning None satisfies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3RqcQN6pUxehj669b4mRg
cargo sets CARGO_PKG_NAME and the other package variables for the
xtask binary. A child inherits them, and cargo-machete reads
CARGO_PKG_NAME to tell whether cargo started it. With the variable
set, `cargo machete --version` treats `machete` and `--version` as
paths and fails. XT-6 now says the gates run without them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3RqcQN6pUxehj669b4mRg
The gates of spec 0002, XT-1 to XT-8, beside spec-check,
toolchain-check, pin-check and fetch-contracts, which keep their
names and behaviour.

- tools: one table pins cargo-deny 0.19.9, typos-cli 1.49.0,
  cargo-machete 0.9.1 and cargo-nextest 0.9.104. A tool that is
  missing or at another version is built with `cargo install --locked
  --version X --root .tools --force` under Rust 1.94.1, and asked
  again; a copy ahead of .tools/bin fails the step.
- Each gate runs from the root with .tools/bin first on PATH, -j JOBS
  (default 2), and without the package variables cargo sets for
  xtask itself (cargo-machete misreads its arguments when
  CARGO_PKG_NAME is set).
- test runs nextest when it is there, else cargo test. nextest reads
  NEXTEST_PROFILE itself.
- ci runs tools, toolchain-check, fmt-check, clippy, test, doc-test,
  deny, typos and machete in that order, stops at the first failure,
  prints one summary line per step and exits non-zero on a failure.
- install runs ci, then `cargo build --release --locked --workspace
  --exclude xtask --bins`.

Green: the 16 gate tests pass on rustc 1.94.1 (12 of 15 were red
against the stubs; the env test was red before its fix).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3RqcQN6pUxehj669b4mRg
One new job on ubuntu-latest, the runner the existing Rust jobs use
(spec 0002, XT-9). rustup installs the rust-toolchain.toml pin,
rust-cache also keeps .tools/ so the pinned tools are built once, and
NEXTEST_PROFILE=ci picks the ci profile. The new actions are pinned by
SHA. The existing jobs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3RqcQN6pUxehj669b4mRg
README names the two commands and what they need (cargo and rustup),
and CHANGELOG records the new gates under Unreleased.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3RqcQN6pUxehj669b4mRg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant