From f4ea4845e9dcdfe96c90346152124ba8e777805b Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Thu, 20 Aug 2026 21:41:31 +0100 Subject: [PATCH] The version test asserts the fact instead of a copy of it `cargo test --workspace` failed on a clean main: devlaunch-test-support asserted `CARGO_PKG_VERSION == "0.3.0"` and the 0.3.1 release did not update the literal. The literal was the bug, not the missed edit. The crate declares `version.workspace = true`, which is what makes CARGO_PKG_VERSION the workspace's version in the first place -- so comparing that variable to a hardcoded string tests only whether somebody remembered to retype the string, and the claim in the test's name ("versioned with the workspace") is a Cargo.toml fact that a literal cannot express. It now reads Cargo.toml and asserts `version.workspace = true`, which cannot go stale because there is no second copy of the version to keep in step. And it failed nothing for a release, which is the other half. The rust job names the crates it tests one at a time -- deliberately, so each carries its own timeout -- and this crate was not among them, so the one command that reaches the test is one only a developer runs. Added as its own step. What is in there is the fake devpod every integration suite uses as its whole devpod, so a gap in it is the one way a fake can do real harm. cargo test --workspace is green, clippy -D warnings and fmt clean. --- .github/workflows/ci.yml | 7 +++++++ rust/devlaunch-test-support/src/lib.rs | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd5a98f0..56e87533 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,6 +171,13 @@ jobs: - name: Test devlaunch-core working-directory: rust run: timeout 600 cargo test --locked -p devlaunch-core -- --test-threads=1 --nocapture + # The steps here name one crate each, which is what lets each carry its own + # timeout -- and what silently left this one uncovered. Its tests are the + # fake devpod the integration suites use as their whole devpod, so a + # fidelity gap in it is the one way a fake can do real harm. + - name: Test devlaunch-test-support + working-directory: rust + run: timeout 300 cargo test --locked -p devlaunch-test-support -- --test-threads=1 --nocapture - name: Test aid (bins + rewrite) working-directory: rust run: timeout 300 cargo test --locked -p aid --bins --test rewrite -- --test-threads=1 --nocapture diff --git a/rust/devlaunch-test-support/src/lib.rs b/rust/devlaunch-test-support/src/lib.rs index c472684d..4efaa829 100644 --- a/rust/devlaunch-test-support/src/lib.rs +++ b/rust/devlaunch-test-support/src/lib.rs @@ -30,8 +30,25 @@ pub use response::Response; #[cfg(test)] mod tests { + /// This crate carries the workspace's version rather than one of its own. + /// + /// Asserted against `Cargo.toml` rather than against a literal. A literal is + /// the same claim written in a way that has to be hand-edited every release + /// and fails nothing until someone runs the one command that reaches it: + /// `version.workspace = true` is what makes `CARGO_PKG_VERSION` the + /// workspace's, so comparing that variable to a hardcoded string only ever + /// tests whether the string was updated. It was not, at 0.3.1 -- + /// `cargo test --workspace` failed on a clean tree, and CI never saw it, + /// because its rust job names the crates it tests one at a time and this is + /// not among them. #[test] fn versioned_with_the_workspace() { - assert_eq!(env!("CARGO_PKG_VERSION"), "0.3.0"); + let manifest = include_str!("../Cargo.toml"); + assert!( + manifest + .lines() + .any(|line| line.split_whitespace().collect::() == "version.workspace=true"), + "devlaunch-test-support must take the workspace version, not name one of its own:\n{manifest}" + ); } }