Skip to content

refactor: move the Cargo workspace to the repository root - #565

Draft
JP-Ellis wants to merge 13 commits into
masterfrom
chore/workspace-root
Draft

JP-Ellis wants to merge 13 commits into
masterfrom
chore/workspace-root

Conversation

@JP-Ellis

Copy link
Copy Markdown
Member

Note

Draft for discussion once #564 and the release-process PR have landed. Nothing depends on it.

Goal

Put the Cargo workspace at the repository root, with the crates under crates/. The rust/ directory dates from when the repository held more than one implementation. Tools that expect the workspace at the git root then need workarounds. release-plz's git_only mode, for one, opens the git repository at the workspace directory and fails from a subdirectory.

What changes

  • Moves. All are pure renames, so git log --follow and blame carry across.
    • rust/Cargo.toml, Cargo.lock, .config/, scripts/, Cross.toml, Dockerfile.musl-build and .dockerignore go to the root.
    • rust/pact_* goes to crates/pact_*.
    • rust/README.md becomes crates/README.md.
  • Paths that pointed into rust/.
    • CI working directories and cache workspaces
    • the c/ CMake projects
    • the compatibility suite's path dependencies
    • the pact_ffi CMake target directory and the release scripts, which sit one directory deeper
    • GitHub links in manifests, docs and doc comments
  • compatibility-suite. It stays a separate Cargo project, so the root workspace excludes it.

Two small release scripts (pact_ffi/release-ios.sh, pact_verifier/release-linux.sh) show as delete plus add, because their path edits fall under git's rename-similarity threshold.

Verification

All of these run from the root:

  • cargo nextest run --workspace: 2398/2398
  • doctests
  • cargo check of the compatibility suite
  • pact_ffi/ci-build.sh, with all five examples
  • c/consumer and c/provider against the prebuilt library

Cost

  • Open PRs and local branches need a rebase, though rename detection carries most edits across.
  • External links into blob/master/rust/... break. The links inside this repository are updated.

Rust 1.99.0 miscompiled C `bool` returns from the FFI library; 1.99.1
carries the fix. A root toolchain file makes the test, FFI and release
jobs build with the same compiler as each other and as local builds.

mise pins the auxiliary tools CI installs (nextest, cargo-hack,
cbindgen, just), so local runs can use the same versions.

The nextest `ci` profile reports every failure and kills hung tests.

Assisted-by: Claude Code:claude-opus-5-5
…ents

reqwest is built with `rustls-no-provider`, so building a client panics
unless a rustls crypto provider has been installed for the process.
Library entry points install the ring provider before building their own
clients. Several tests build their own client to call a mock server or
to feed a request into the code under test. Those tests passed only when
an earlier test in the same binary had already installed the provider.

Under nextest, which runs each test in its own process, and under
`cargo test <filter>`, those tests panic with "No rustls crypto
provider is configured". A small helper in each test module now
installs the provider before building the client.

Assisted-by: Claude Code:claude-opus-5-5
The CMake project refused to configure unless `cargo +nightly` existed,
and FindCargo reported nightly's version even though the library builds
with whichever toolchain `cargo` resolves to. With `rust-toolchain.toml`
pinning stable, FindCargo now reports the cargo that actually builds the
library, and the nightly gate is gone.

Header generation still needs nightly. cbindgen's macro expansion passes
`-Zunpretty=expanded`, which stable rejects, so the `rustup run nightly`
call sites stay.

Assisted-by: Claude Code:claude-opus-5-5
The examples under rust/pact_ffi/examples had no CI coverage. The
script builds pact_ffi once in release, the profile that ships, and
installs it under build/install. Each example then runs against that
install, and the C projects under c/ reuse the same install.

Assisted-by: Claude Code:claude-opus-5-5
Corrosion builds pact_ffi in release inside each project's own build
directory, so CI compiled the library twice per OS. With the variable
set, both projects link the install produced by
rust/pact_ffi/ci-build.sh and copy the library beside the executable,
where the run recipe expects it. Without it, local builds keep using
Corrosion.

The new root rust-toolchain.toml pins stable, which would otherwise
apply to the local Corrosion build. Corrosion runs cbindgen with no
toolchain override, and cbindgen's macro expansion needs nightly. The
justfiles therefore default RUSTUP_TOOLCHAIN to nightly, as the READMEs
already required; a caller's own RUSTUP_TOOLCHAIN still wins.

Assisted-by: Claude Code:claude-opus-5-5
Build, FFI and compatibility runs move into test.yml, gated by a single
`CI complete` check:

- Pull requests run once per commit, on Linux, macOS and Windows.
- Draft PRs run nothing heavy until marked ready.
- Caches save only from master, so PR runs restore master's entries
  without filling the repository's 10 GB budget.
- nextest runs the suite, with doctests run separately.
- The V2 matching engine and the ignored mock-server-log test reuse the
  same build.
- Compatibility v1-v4 share one compile per OS.
- pact_ffi builds once per OS, in release with the pinned toolchain, for
  every C example. Nightly is installed only for cbindgen.
- Windows legs build on a Dev Drive.
- A per-feature check replaces the single --no-default-features check.
  It skips pact_matching with `plugins` alone, which pact-plugin-driver
  currently breaks by using chrono's clock without enabling it.

Assisted-by: Claude Code:claude-opus-5-5
The issue title was interpolated straight into a `run:` script. The job
runs for anyone who comments `/jira ticket`, so anyone could open an
issue with a crafted title and execute commands on the runner, which
holds the Jira credentials. The title and the comment body now reach
the shell through environment variables.

Assisted-by: Claude Code:claude-opus-5-5
test.yml replaces the build, FFI and compatibility workflows.

The release build no longer runs on pull requests. Release PRs will
trigger it once the release process moves to PRs.

The remaining workflows pin actions by commit SHA and declare the
token permissions they use.

Assisted-by: Claude Code:claude-opus-5-5
The README badge points at test.yml, and the AppVeyor badge for a
service the repository no longer uses is gone. CLAUDE.md and the
Copilot instructions describe the pinned toolchain, the mise-managed
tools, nextest, and what test.yml covers.

Assisted-by: Claude Code:claude-opus-5-5
The root rust-toolchain.toml takes precedence over the `rustup default`
that dtolnay/rust-toolchain sets, so release builds already resolved to
1.99.1. Only the toolchain named in that action receives the matrix
`targets`, so the aarch64-pc-windows-msvc leg, which cross-compiles on
an x64 runner, would have built without its standard library.

Naming 1.99.1 in the action keeps the targets on the toolchain that
builds. The pact_ffi README now describes the pin in rust-toolchain.toml.

Assisted-by: Claude Code:claude-opus-5-5
The steps after nextest now run even when nextest fails. The
compatibility suite, the musl job and the doctests pass
`--no-fail-fast`, so one failing test binary no longer hides the
results of later ones.

@actions/cache passes GNU tar options such as `--posix`, which Alpine's
busybox tar rejects. rust-cache reports the failure as a warning, so the
musl job always built cold. The job now installs GNU tar.

Assisted-by: Claude Code:claude-opus-5-5
mise pinned cargo-binstall, but the FFI job never installed it, so the
`cargo:` backend fell back to compiling cbindgen from source on every
cold run. The job now installs cargo-binstall alongside cbindgen.

mise.toml enables cargo-quickinstall as a binary source and sets
`binstall_only`, so a missing prebuilt binary fails the install instead
of silently compiling.

Assisted-by: Claude Code:claude-opus-5-5
The workspace lived in rust/, a layout left from when the repository
held more than one implementation. Tooling that expects the workspace at
the git root then needs workarounds. release-plz's git_only mode, for
one, opens the git repository at the workspace directory and fails from
a subdirectory.

The workspace manifest, lockfile, nextest config and helper scripts now
sit at the root. The crates move to crates/. Each is a pure rename, so
`git log --follow` and blame carry across.

Paths that pointed into rust/ follow the move:
- CI working directories and cache workspaces
- the c/ CMake projects and the compatibility suite's path dependencies
- the pact_ffi CMake target directory and the release scripts, now one
  directory deeper
- GitHub links in manifests, docs and doc comments

compatibility-suite stays a separate Cargo project, so the root
workspace excludes it.

Assisted-by: Claude Code:claude-opus-5-5
@JP-Ellis JP-Ellis mentioned this pull request Oct 16, 2026
8 of 9 tasks
@JP-Ellis
JP-Ellis force-pushed the ci/overhaul branch 2 times, most recently from a10e889 to b962629 Compare October 16, 2026 23:30
Base automatically changed from ci/overhaul to master October 17, 2026 01:21

This branch has not been deployed

No deployments
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