Skip to content

ci: record Cargo-Rail planning evidence - #55

Merged
hadronzoo merged 4 commits into
mainfrom
ci/cargo-rail-evidence
Oct 2, 2026
Merged

hadronzoo merged 4 commits into
mainfrom
ci/cargo-rail-evidence

Conversation

@hadronzoo

@hadronzoo hadronzoo commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Cargo-Rail decides which CI jobs a change needs. Without planning evidence, it cannot prove that a file is outside the Rust build, so it runs the Rust jobs for almost every change. This PR records that evidence on main and gives it to the planner. A change that no compiler reads, such as a Markdown edit, then skips the Rust jobs.

A new "Planning evidence" job in the Check workflow records which workspace files the cargo.build work item reads. It runs on every push to main and never on pull requests, so it is never a required check. It uses rust-cache, because recording works on a warm target directory. It saves the record in the Actions cache under the commit that it describes. CI cost: this job compiles the extension once on every push to main.

Both plan jobs now install the stable toolchain, restore the evidence of the base commit on push and pull requests, and pass it to the planner. A cache miss is normal and only widens the plan to the current behavior. Each plan job creates the evidence directory first, because the planner rejects a missing directory but accepts an empty one. The Quality planner plans every work item on its nightly schedule and on manual dispatch, so the Clippy condition reads only the required work.

Cargo-Rail 0.30.1 has no complete evidence for Clippy or rustdoc. It marks Clippy evidence incomplete when the clippy::cargo lints run cargo metadata, and it never records rustdoc. The Clippy and Documentation jobs therefore route on cargo.build. The build evidence covers the same compiler inputs, because the extension has no cfg(doc) or cfg(test) code.

The evidence binds the Cargo environment, including RUSTFLAGS. The Check workflow set RUSTFLAGS for every job, and the Quality workflow did not. This PR removes that RUSTFLAGS and makes mold the default linker in the jobs that install it. .cargo/config.toml already sets target-cpu=x86-64-v3. The evidence job and both plan jobs then see the same Cargo environment.

The plan jobs drop the since inputs and the full-history fetch. The v10 Action selects the same comparison by default and fetches the history that it needs. The plan and evidence jobs have read-only permissions, and their checkouts do not keep credentials.

The ci work item now holds only the workflows and the Cargo-Rail policy. A new taplo work item routes .taplo.toml to the Format job only. No CI job reads the Makefile, so a Makefile change routes no work.

The extension has no Rust tests, so jobs route on cargo.build in place of cargo.test. The extension is a cdylib, which cannot run doctests, and a comment in its manifest now says so. This PR also deletes three Rust doc examples in the extension, because they only restated the prose above them.

Add a "Planning evidence" job to the Check workflow. It runs on push to
main and on manual dispatch. It records which workspace files the
cargo.build work item reads. It saves the record in the Actions cache
under the commit that it describes.

Both plan jobs now install the stable toolchain, restore the evidence of
the base commit, and give it to the planner. A change that no compiler
reads, such as a Markdown edit, then skips the jobs that route on
cargo.build. A cache miss only widens the plan.

Clippy evidence is not recorded. Cargo-Rail 0.30.1 marks it incomplete,
because the clippy::cargo lints make clippy-driver run cargo metadata.

The evidence binds the Cargo environment. Move RUSTFLAGS from the Check
workflow env to the jobs that install mold. The evidence job and both
plan jobs then see the same Cargo environment.

Remove the since inputs and the full-history fetch from the plan jobs.
The v10 Action selects the same comparison by default and fetches the
history that it needs. The plan and evidence checkouts do not keep
credentials.

Narrow the ci work item to the workflows and the Cargo-Rail policy. A new
taplo work item routes .taplo.toml to the Format job only. No CI job
reads the Makefile, so it routes no work.

The extension has no Rust tests, so route on cargo.build in place of
cargo.test. Note in the extension manifest that the cdylib has no Rust
doctests.

Remove three doc examples that could not compile. Each one called a
function without the Ruby VM setup that it needs. The prose above each
example already says what the example showed.
The planner rejects a missing evidence directory. A cache miss leaves no
directory, so the plan job failed. Create the directory before the
planner runs. An empty directory only widens the plan.
A manual run has no push or pull-request base. The Action then compares
against HEAD~1, which a shallow checkout of a branch does not hold, and
the plan job fails. Plan every work item on workflow_dispatch instead.
Cargo-Rail has no complete evidence for cargo.clippy and cargo.doc, so
jobs that route on them never skip. Route the Clippy and Documentation
jobs on cargo.build. Its evidence covers the same compiler inputs,
because the extension has no cfg(doc) or cfg(test) code.

Remove the workflow_dispatch trigger from the Check workflow, and record
evidence only on push. The Quality planner plans every work item on
schedule and manual dispatch, so the Clippy condition reads only the
required work. Restore evidence only on push and pull requests, because
a scheduled or manual run has no base commit and the key prefix can
match an unrelated commit.

Give the plan and evidence jobs read-only permissions. Remove the jq
step, so that a jq failure cannot skip the cache save. Add rust-cache
to the evidence job, because recording works on a warm target directory.

Use mold as the default linker in place of job-level RUSTFLAGS. The
Cargo configuration already sets target-cpu=x86-64-v3.
@hadronzoo
hadronzoo merged commit af487f9 into main Oct 2, 2026
16 checks passed
@hadronzoo
hadronzoo deleted the ci/cargo-rail-evidence branch October 2, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant