use crate::harness_runtime::{Artifact, Delivery, Previous, Shape, Software};
pub(crate) const ARTIFACTS: &[Artifact] = &[
Artifact {
platform: "linux/arm64",
url: "https://x.ai/cli/grok-1.0.34-linux-aarch64",
bytes: 136_090_504,
sha256: "sha256:39ab87666877d64ef3a40aa60fbe0c3b6a6acd7001b78fe60e2c76bb6cfc4a94",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "linux/x86_64",
url: "https://x.ai/cli/grok-1.0.34-linux-x86_64",
bytes: 163_035_648,
sha256: "sha256:be5905e107d2b8b5f3c142d21ecfe4c8fd32a913d2fd551b788707930c4dc80d",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "macos/arm64",
url: "https://x.ai/cli/grok-1.0.34-macos-aarch64",
bytes: 143_016_096,
sha256: "sha256:9cd26b579840f0f5c9148a8059ad651904c08b41b7f2ef0b4ec04b9ba898844e",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "macos/x86_64",
url: "https://x.ai/cli/grok-1.0.34-macos-x86_64",
bytes: 160_175_824,
sha256: "sha256:4125f6a9a7524396430f8904a0855100d12a921fcfca4f4380853a39f4ff1d03",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "windows/arm64",
url: "https://x.ai/cli/grok-1.0.34-windows-aarch64.exe",
bytes: 130_807_112,
sha256: "sha256:3173495c68e15b5e30d97cdd81c138e80ccbe564d444b7d3a518d8f2d9a2a59e",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "windows/x86_64",
url: "https://x.ai/cli/grok-1.0.34-windows-x86_64.exe",
bytes: 151_293_256,
sha256: "sha256:021d8f7f6bdf9db48b6c87e799cd99130a76c463e6e6a3161510839aed016d94",
shape: Shape::Raw,
member: "",
},
];
pub(crate) const PREVIOUS_ARTIFACTS: &[Artifact] = &[
Artifact {
platform: "linux/arm64",
url: "https://x.ai/cli/grok-1.0.31-linux-aarch64",
bytes: 135_462_856,
sha256: "sha256:42705891cfbe56076eb61b3c87592302729f72b017b713946e3b3a507a3146af",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "linux/x86_64",
url: "https://x.ai/cli/grok-1.0.31-linux-x86_64",
bytes: 162_293_824,
sha256: "sha256:d37fa3e50c5509a12af4bb4fc4f3c6bb2eadfc28f8f3e88dc21935b47e4e342f",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "macos/arm64",
url: "https://x.ai/cli/grok-1.0.31-macos-aarch64",
bytes: 142_384_128,
sha256: "sha256:6444143255f8c5095d26b40ebd362bbedee76bddb98fa8f634efe871fde8ba23",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "macos/x86_64",
url: "https://x.ai/cli/grok-1.0.31-macos-x86_64",
bytes: 159_439_936,
sha256: "sha256:9c02e59cff998bb0d003a7c345cae3d25dae84dcbb818b647bf6b191dcca3664",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "windows/arm64",
url: "https://x.ai/cli/grok-1.0.31-windows-aarch64.exe",
bytes: 130_216_776,
sha256: "sha256:7484fc86249d9e5207cac355139cf6c0d352acb3fc99a024e90440ebb66ccf10",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "windows/x86_64",
url: "https://x.ai/cli/grok-1.0.31-windows-x86_64.exe",
bytes: 150_586_696,
sha256: "sha256:73d2c31b90a21140fbe1c62d3c3efde541a3e254cf0f2571dc86addadb483eba",
shape: Shape::Raw,
member: "",
},
];
pub(crate) const SOFTWARE: Software = Software {
version: "1.0.34",
command: "grok",
delivery: Delivery::Artifacts(ARTIFACTS),
unsupported: &[],
previous: Some(Previous {
version: "1.0.31",
artifacts: PREVIOUS_ARTIFACTS,
}),
};
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used, clippy::panic)]
use crate::harness_runtime::{Delivery, Shape};
use super::SOFTWARE;
fn measured() -> serde_json::Value {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../../references/grok-baseline.json");
serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap()
}
#[test]
fn every_artifact_compiled_in_is_the_one_the_baseline_measured() {
let block = &measured()["software_artifacts"];
assert_eq!(block["version"], SOFTWARE.version);
assert_eq!(block["command"], SOFTWARE.command);
let Delivery::Artifacts(compiled) = SOFTWARE.delivery else {
assert_eq!(block["shape"], "manager");
assert!(block["platforms"].as_object().unwrap().is_empty());
return;
};
let published = block["platforms"].as_object().unwrap();
assert_eq!(
compiled.len(),
published.len(),
"the table and the baseline disagree on how many platforms exist"
);
for artifact in compiled {
let entry = &published[artifact.platform];
assert_eq!(entry["url"], artifact.url, "{}", artifact.platform);
assert_eq!(entry["bytes"], artifact.bytes, "{}", artifact.platform);
assert_eq!(entry["sha256"], artifact.sha256, "{}", artifact.platform);
let member = entry.get("member").and_then(serde_json::Value::as_str);
assert_eq!(
member.unwrap_or(""),
artifact.member,
"{} names a different member",
artifact.platform
);
assert_eq!(
artifact.shape == Shape::Raw,
member.is_none(),
"{} disagrees about whether the bytes are the program",
artifact.platform
);
}
}
#[test]
fn the_version_this_build_can_move_between_is_the_one_measured_before_it() {
let baseline = measured();
let recorded = baseline.get("previous_software_artifacts");
let Some(earlier) = SOFTWARE.previous else {
assert!(
recorded.is_none(),
"the baseline records a previous release and this build names none"
);
return;
};
let block = recorded.unwrap_or_else(|| {
panic!("this build names a previous release the baseline does not record")
});
assert_eq!(block["version"], earlier.version);
assert_ne!(
earlier.version, SOFTWARE.version,
"a second pin equal to the first is one version wearing two names"
);
let published = block["platforms"].as_object().unwrap();
assert_eq!(
earlier.artifacts.len(),
published.len(),
"the previous table and the baseline disagree on how many platforms exist"
);
for artifact in earlier.artifacts {
let entry = &published[artifact.platform];
assert_eq!(entry["url"], artifact.url, "{}", artifact.platform);
assert_eq!(entry["bytes"], artifact.bytes, "{}", artifact.platform);
assert_eq!(entry["sha256"], artifact.sha256, "{}", artifact.platform);
}
}
#[test]
fn a_platform_the_vendor_does_not_publish_is_listed_rather_than_missing() {
let block = &measured()["software_artifacts"];
let unpublished: Vec<&str> = block
.get("unpublished")
.and_then(serde_json::Value::as_array)
.map(|entries| {
entries
.iter()
.filter_map(serde_json::Value::as_str)
.collect()
})
.unwrap_or_default();
assert_eq!(unpublished, SOFTWARE.unsupported);
}
#[test]
fn no_release_calls_a_platform_both_published_and_unpublished() {
let baseline = measured();
for name in ["software_artifacts", "previous_software_artifacts"] {
let Some(block) = baseline.get(name) else {
continue;
};
let published = block["platforms"].as_object().unwrap();
let unpublished = block
.get("unpublished")
.and_then(serde_json::Value::as_array)
.into_iter()
.flatten()
.filter_map(serde_json::Value::as_str);
for platform in unpublished {
assert!(
!published.contains_key(platform),
"{name}: {platform} is both published and unpublished"
);
}
}
}
}