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
42 changes: 36 additions & 6 deletions pkgs/fleet/crates/fleet/src/gh_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 5 additions & 0 deletions pkgs/fleet/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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<rev7>) instead of the
Expand Down