From d211503b6e246f2284d3c4f3e6543599a9df48ca Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 3 Jun 2026 19:32:38 -0500 Subject: [PATCH] chore(fixtures): align Rust fixture editions to main; document the rule The three pre-existing Rust fixtures (broken-rust, perfect-rust, source-only) were on edition 2021; main is edition 2024. The drift is harmless today because the audits parse fixture sources via tree-sitter and never invoke cargo build, but a fixture lagging the main crate is a silent skew that could mask audit regressions on edition-specific syntax in future. Adds an AGENTS.md note under Testing > Test fixtures explaining: - fixtures are intentionally not workspace members (so Cargo's edition.workspace = true inheritance is unavailable); - every fixture Cargo.toml's edition must be set explicitly and must match the main crate's; - bump every fixture in lockstep when main's edition changes. Surfaced during PR #80 review. --- AGENTS.md | 16 ++++++++++++++++ tests/fixtures/broken-rust/Cargo.toml | 2 +- tests/fixtures/perfect-rust/Cargo.toml | 2 +- tests/fixtures/source-only/Cargo.toml | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index de4c3ec..a148d88 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -184,6 +184,22 @@ cargo test # unit + integration tests cargo test -- --ignored # fixture tests (slower) ``` +### Test fixtures + +Rust crates under `tests/fixtures/*/` (e.g. `broken-rust/`, `perfect-rust/`, `source-only/`, `cfg-test-edge-cases/`) are +standalone fake projects the audits run against. They are intentionally **not** workspace members — making them members +would cause `cargo build` from the root to compile every fixture and would apply workspace-level lints, dependencies, +and profile overrides to them, changing what the audits see and defeating the purpose of the fixture. + +Because there is no workspace, Cargo's `field.workspace = true` inheritance is unavailable. The edition on every fixture +`Cargo.toml` must be set explicitly and **must match the main crate's edition** (see the top-level `Cargo.toml`, +currently `edition = "2024"`). When the main crate bumps its edition (e.g. Rust 2027), bump every fixture in lockstep in +the same PR — a fixture lagging behind main is a silent skew that can mask audit regressions on edition-specific syntax. + +The audits themselves parse fixture sources via tree-sitter and do not invoke `cargo build`, so the edition has no +effect on current audit behavior. The lockstep rule exists for the future case where an audit reads edition-specific +constructs, and for the general "the project tests against the edition the project ships with" principle. + ## Spec source (principles) The canonical specification of the 7 agent-readiness principles lives in diff --git a/tests/fixtures/broken-rust/Cargo.toml b/tests/fixtures/broken-rust/Cargo.toml index 80b4754..9aa9b1a 100644 --- a/tests/fixtures/broken-rust/Cargo.toml +++ b/tests/fixtures/broken-rust/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "broken-rust" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] clap = { version = "4", features = ["derive"] } diff --git a/tests/fixtures/perfect-rust/Cargo.toml b/tests/fixtures/perfect-rust/Cargo.toml index 3a17574..5462b73 100644 --- a/tests/fixtures/perfect-rust/Cargo.toml +++ b/tests/fixtures/perfect-rust/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "perfect-rust" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] clap = { version = "4", features = ["derive", "env"] } diff --git a/tests/fixtures/source-only/Cargo.toml b/tests/fixtures/source-only/Cargo.toml index ea97dc8..5495238 100644 --- a/tests/fixtures/source-only/Cargo.toml +++ b/tests/fixtures/source-only/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "source-only" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] clap = { version = "4", features = ["derive"] }