From 626dfa12b710ac49626781ca0d63d248415c797c Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 12:45:14 -0600 Subject: [PATCH] fix(fleet): resolve the pm-metadata conformance fixture in the derivation layout (#13617) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gh_metadata conformance test built the fixture path as CARGO_MANIFEST_DIR + /../../../../doc/..., which only resolves in a full checkout (pkgs/fleet/crates/fleet -> repo root). In the fleet-smoke derivation the crate sits at fleet/crates/fleet under a source whose fleetSrc fileset carries no doc/ at all, so the test panicked on a missing fixture and the fleet variant build step failed on main. The test now resolves the fixture by the PM_METADATA_V1_FIXTURE override, else by the nearest ancestor of the crate dir carrying doc/.../pm-metadata-v1.json, and still panics loudly when neither finds it — the fixture set stays the enforced conformance oracle. pkgs/fleet/default.nix sets PM_METADATA_V1_FIXTURE in the build env to a store copy of the fixture. Verified: the focused test passes in a real checkout, in a simulated derivation layout with the override set, and in the simulated layout with doc/ as a sibling; without either it fails with the explicit not-found panic. --- pkgs/fleet/crates/fleet/src/gh_metadata.rs | 42 ++++++++++++++++++---- pkgs/fleet/default.nix | 5 +++ 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/pkgs/fleet/crates/fleet/src/gh_metadata.rs b/pkgs/fleet/crates/fleet/src/gh_metadata.rs index de61bd6ee8..7abab3d83a 100644 --- a/pkgs/fleet/crates/fleet/src/gh_metadata.rs +++ b/pkgs/fleet/crates/fleet/src/gh_metadata.rs @@ -2444,14 +2444,44 @@ mod tests { // the stamp assembly round-trip; each `reject` case must fail // closed. Doctrine-projection expectations in the fixture are the // oracle for design §7 slice 2 and are not asserted here. + // The fixture set lives in doc/ at the repository root, while this + // crate sits at pkgs/fleet/crates/fleet in a checkout and at + // fleet/crates/fleet in the fleet derivation source — whose + // fileset carries no doc/ at all (#13617). Resolve it by the + // PM_METADATA_V1_FIXTURE override the derivation sets, else by the + // nearest ancestor of the crate dir that carries the fixture. + // Absence stays a loud failure: the set is the conformance oracle. + fn conformance_fixture_path() -> PathBuf { + const FIXTURE_SUFFIX: &str = + "doc/2026-11-21T17-56-24Z_design_atlas_metadata_schema_v1/fixtures/pm-metadata-v1.json"; + if let Ok(override_path) = std::env::var("PM_METADATA_V1_FIXTURE") { + if !override_path.is_empty() { + return PathBuf::from(override_path); + } + } + let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + for ancestor in manifest_dir.ancestors() { + let candidate = ancestor.join(FIXTURE_SUFFIX); + if candidate.is_file() { + return candidate; + } + } + panic!( + "conformance fixture set not found: no ancestor of {} carries {FIXTURE_SUFFIX} \ + and PM_METADATA_V1_FIXTURE is unset", + manifest_dir.display() + ); + } + #[test] fn pm_metadata_version_conformance_fixtures() { - let path = concat!( - env!("CARGO_MANIFEST_DIR"), - "/../../../../doc/2026-11-21T17-56-24Z_design_atlas_metadata_schema_v1/fixtures/pm-metadata-v1.json" - ); - let raw = std::fs::read_to_string(path) - .unwrap_or_else(|e| panic!("conformance fixture set unreadable at {path}: {e}")); + let path = conformance_fixture_path(); + let raw = std::fs::read_to_string(&path).unwrap_or_else(|e| { + panic!( + "conformance fixture set unreadable at {}: {e}", + path.display() + ) + }); let set: Value = serde_json::from_str(&raw).expect("fixture set is valid JSON"); let cases = set["cases"].as_array().expect("fixture set carries cases"); assert!(!cases.is_empty(), "fixture set must not be empty"); diff --git a/pkgs/fleet/default.nix b/pkgs/fleet/default.nix index ae225d03b9..a0713669f8 100644 --- a/pkgs/fleet/default.nix +++ b/pkgs/fleet/default.nix @@ -120,6 +120,11 @@ let # role there needs ATLAS_ORT_LIB). envAttrs = { FLEET_SOURCE_REV = sourceRev; + # #13617: the gh_metadata conformance test reads the + # pm-metadata v1 fixture set from doc/ at the repository root, + # which the fleetSrc fileset does not carry; point the test at + # this store copy of the fixture instead. + PM_METADATA_V1_FIXTURE = "${../../doc/2026-11-21T17-56-24Z_design_atlas_metadata_schema_v1/fixtures/pm-metadata-v1.json}"; # #8566: the binary's Derived version channel. An explicit # derivedVersion wins; otherwise a real sourceRev yields a # unique prerelease form (0.1.0-dev+g) instead of the