Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,6 @@ jobs:
# re-resolve it instead of failing.
- name: Check the lockfile matches the manifest
run: make check-locked
- name: Check Rust 1.94 compatibility
run: |
rustup toolchain install 1.94.0 --profile minimal
# A stable toolchain rejects the nightly-only `-Z` flag and the
# `[unstable]` codegen-backend gate that .cargo/config.toml carries.
# Cargo reads configuration from the working directory upward, so
# run from outside the repository and name the manifest.
cd "$RUNNER_TEMP"
RUSTFLAGS= cargo +1.94.0 check --manifest-path "$GITHUB_WORKSPACE/Cargo.toml" --locked --all-targets ${{ matrix.cargo_flags }}
- name: Install cargo-nextest
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/proofs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Proofs

# The `kani.rs` modules under `src/` hold nine Kani proof harnesses. Proof code
# that no job runs is a comment, so this workflow runs them: on a pull request
# that touches what they verify or how they are run, and weekly. It is its own
# workflow rather than a job in `ci.yml`, whose triggers are unconditional and
# whose job set is pinned by the workflow contracts.
on:
schedule:
- cron: '23 4 * * 3' # Weekly, Wednesday 04:23 UTC
workflow_dispatch:
pull_request:
paths:
- 'src/**'
- 'build.rs'
- 'migrations/**'
- 'crates/mxd-concurrency/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'cli-defs/**'
- 'tools/kani/**'
- 'tools/rust-prover-tools/**'
- 'Makefile'
- '.github/workflows/proofs.yml'

# A second push to a pull request supersedes the run already in flight; a
# scheduled or dispatched run is never replaced.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

jobs:
kani:
name: Kani
# GitHub-hosted: the job needs no compiler cache and compute there is free.
runs-on: ubuntu-24.04
# A cold run is about four minutes, nearly all of it compilation. The
# ceiling is a runaway guard.
timeout-minutes: 30
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# The shared action installs Kani through the pinned rust-prover-tools,
# which owns the archive digests. tools/kani/VERSION names the release.
- name: Install Kani
uses: leynos/shared-actions/.github/actions/install-prover-tools@88ac795de687eda016db24983f87a25d6db49fdb
with:
tools: kani
runner-image: ubuntu2404
- name: Run the Kani harnesses
run: make kani
4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ members = [
default-members = ["."]
resolver = "2"

[workspace.package]
rust-version = "1.94.0"

[workspace.dependencies]
# Pinned to a git revision because the published 0.2.0 release requires
# diesel-async ^0.7; the upstream default branch has migrated to
Expand All @@ -32,7 +29,6 @@ rstest-bdd-harness-tokio = "0.6.0"
name = "mxd"
version = "0.1.0"
edition = "2024"
rust-version.workspace = true

[[bin]]
name = "mxd"
Expand Down
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help all clean build release fetch test test-doc test-postgres test-sqlite test-wireframe-only test-verification test-fuzz-harness test-rstest-bdd-ui test-rstest-bdd-ui-timeouts validator-sqlite-server validator-postgres-server test-validator-sqlite test-validator-postgres lint lint-postgres lint-sqlite lint-wireframe-only typecheck typecheck-postgres typecheck-sqlite typecheck-wireframe-only fmt check-fmt markdownlint nixie audit rust-audit corpus sqlite postgres sqlite-release postgres-release tlc tlc-handshake spelling test-codescene-boundary test-spelling-gate test-workflow-contracts check-locked test-dependabot-policy test-concurrency check-loom test-loom test-loom-runner warm-postgres interrogate
.PHONY: help all clean build release fetch test test-doc test-postgres test-sqlite test-wireframe-only test-verification test-fuzz-harness test-rstest-bdd-ui test-rstest-bdd-ui-timeouts validator-sqlite-server validator-postgres-server test-validator-sqlite test-validator-postgres lint lint-postgres lint-sqlite lint-wireframe-only typecheck typecheck-postgres typecheck-sqlite typecheck-wireframe-only fmt check-fmt markdownlint nixie audit rust-audit corpus sqlite postgres sqlite-release postgres-release tlc tlc-handshake spelling test-codescene-boundary test-spelling-gate test-workflow-contracts check-locked test-dependabot-policy test-concurrency check-loom test-loom test-loom-runner warm-postgres interrogate install-kani kani

export PATH := $(HOME)/.cargo/bin:$(HOME)/.local/bin:$(HOME)/.bun/bin:$(PATH)

Expand Down Expand Up @@ -396,6 +396,30 @@ test-loom-runner: ## Test the Loom model runner script
python -m pytest tests/loom_runner scripts/run_loom_models.py --doctest-modules \
-c /dev/null --rootdir=. -p no:cacheprovider -p cmd_mox.pytest_plugin

# The shared rust-prover-tools package owns Kani acquisition. CI installs it
# through the shared install-prover-tools action; `install-kani` is the local
# equivalent. The package revision is read from one file, and the Kani release
# from tools/kani/VERSION.
override PROVER_TOOLS_REF := $(strip $(shell awk '/^ref:/ { print $$2; exit }' tools/rust-prover-tools/REF))
PROVER_TOOLS ?= $(UV) tool run --python 3.14 \
--from git+https://github.com/leynos/rust-prover-tools@$(PROVER_TOOLS_REF) prover-tools
# The prebuilt Kani covers Linux x86_64 only, so any other host builds it.
KANI_HOST_KERNEL := $(shell uname -s)
KANI_HOST_MACHINE := $(shell uname -m)
KANI_INSTALL_FLAGS ?= $(if $(and $(filter Linux,$(KANI_HOST_KERNEL)),$(filter x86_64,$(KANI_HOST_MACHINE))),,--compile)
# Kani drives `rustc` through its own bundled toolchain, so the repository's
# nightly flags (`-Zthreads`, `mold`) neither apply nor are honoured there.
# Naming the front-end directly keeps `rustup` from installing the
# repository's own toolchain first.
KANI ?= cargo-kani
KANI_FLAGS ?= -p mxd

install-kani: ## Install the pinned Kani release (front-end in CARGO_HOME/bin, bundle in KANI_HOME)
$(PROVER_TOOLS) kani install --repo-root . $(KANI_INSTALL_FLAGS)

kani: ## Run the Kani proof harnesses on an installed Kani
RUSTFLAGS="-D warnings" $(KANI) kani $(KANI_FLAGS)

# nextest does not execute doctests; run them separately with the
# default (sqlite) backend, mirroring the template's split.
test-doc: ## Run documentation tests
Expand Down
1 change: 0 additions & 1 deletion cli-defs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "cli-defs"
version = "0.1.0"
edition = "2024"
rust-version.workspace = true
description = "Shared CLI type definitions for mxd build and runtime"

[lints]
Expand Down
6 changes: 6 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ too-many-lines-threshold = 70 # default is 100
excessive-nesting-threshold = 4 # default is off

allow-expect-in-tests = true

# The workspace declares no `rust-version`, so Clippy would otherwise suggest
# APIs from the newest nightly (`Option::map_or_default`), which the older
# nightly that Whitaker lints on cannot compile. Clippy's `msrv` keeps its
# suggestions to what both toolchains accept.
msrv = "1.94.0"
29 changes: 24 additions & 5 deletions docs/developers-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1802,11 +1802,12 @@ condition, fails the contract.

## Dependabot and the Cargo toolchain floor

The workspace declares `rust-version = "1.94.0"` because the complete locked
application and test graph includes dependencies whose declared floors reach
Rust 1.94.0. OrthoConfig v0.10.0 itself requires Rust 1.89.0, but that is not
the effective floor for these packages. CI checks the feature lanes on stable
1.94.0 as well as the repository's pinned nightly toolchain.
mxd is a server application, so the workspace declares no `rust-version`: the
repository's pinned nightly toolchain is the only toolchain it supports, and no
other crate in the estate depends on it as a library. The declaration was
removed because Kani's bundled toolchain is older than the one the workspace
builds on, and Cargo refuses to compile a package whose `rust-version` exceeds
the compiler's (see "Kani proofs"). CI no longer checks a separate stable floor.

Dependabot's Cargo updater does not raise `Cargo.toml`. Its
`versioning-strategy` accepts only `lockfile-only` and `auto`. The
Expand Down Expand Up @@ -1896,6 +1897,24 @@ The kernels' unit tests are compiled only outside `--cfg loom`, because a Loom
mutex used outside a Loom model panics. For the same reason the lane selects
the model targets with `--test` and never runs the doctests under Loom.

## Kani proofs

The `kani.rs` modules under `src/` (header validation, transaction reading, the
Wireframe codec, compatibility and compatibility policy) hold nine
`#[kani::proof]` harnesses, compiled only under `cfg(kani)`. `make kani` runs
them with `cargo-kani -p mxd` and fails if any harness does not verify.
`.github/workflows/proofs.yml` runs the same target on pull requests that touch
the code, the Kani pin or the workflow, and weekly.

Kani comes from the shared `rust-prover-tools` package. The package revision is
in `tools/rust-prover-tools/REF` and the Kani release in `tools/kani/VERSION`;
CI installs it with the shared `install-prover-tools` action, and
`make install-kani` does the same on a developer host. Kani compiles the crate
with its own bundled toolchain, which is older than the repository's nightly,
so the workspace declares no `rust-version`: Cargo would otherwise refuse the
package before Kani compiled anything. Verification takes about ten seconds;
most of a run is the compile.

## Spelling policy

`make spelling` enforces en-GB-oxendict spelling over tracked text.
Expand Down
1 change: 1 addition & 0 deletions tests/workflow_contracts/test_gate_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
("loom-check.yml", "check", "make check-loom"),
("loom-check.yml", "check", "make test-concurrency"),
("loom-check.yml", "check", "make test-loom-runner"),
("proofs.yml", "kani", "make kani"),
)


Expand Down
2 changes: 2 additions & 0 deletions tests/workflow_contracts/test_runner_placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
("fuzz.yml", "fuzz"): ("ubuntu-latest",),
("loom-check.yml", "check"): ("ubuntu-latest",),
("loom.yml", "models"): ("ubuntu-latest",),
("proofs.yml", "kani"): ("ubuntu-24.04",),
("release.yml", "metadata"): ("ubuntu-latest",),
("release.yml", "release"): ("ubuntu-latest",),
("tlc-image.yml", "build-and-push"): ("ubuntu-latest",),
Expand Down Expand Up @@ -140,6 +141,7 @@ def is_external_call(calls: str) -> bool:
("fuzz.yml", "fuzz"): 360,
("loom-check.yml", "check"): 30,
("loom.yml", "models"): 30,
("proofs.yml", "kani"): 30,
("release.yml", "metadata"): 30,
("release.yml", "release"): 30,
("tlc-image.yml", "build-and-push"): 120,
Expand Down
1 change: 1 addition & 0 deletions tools/kani/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.67.0
1 change: 1 addition & 0 deletions tools/rust-prover-tools/REF
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: 592558f7183b554fc749696246984c5d7300d029
Loading