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.52-linux-aarch64",
bytes: 160_670_952,
sha256: "sha256:fc32410b6883c15a39b9f33ec04a6bfb7d070b383e5dbad7efbc48c787e5050d",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "linux/x86_64",
url: "https://x.ai/cli/grok-1.0.52-linux-x86_64",
bytes: 188_326_752,
sha256: "sha256:1668414b047e1050a96d25fe17dfc3efe63190fbf66d8cc1c3de8633caf50d11",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "macos/arm64",
url: "https://x.ai/cli/grok-1.0.52-macos-aarch64",
bytes: 172_237_072,
sha256: "sha256:c2caa9895dd763297a75e8fb6077e175d9c5304c53903e52cff8891a1384bbb9",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "macos/x86_64",
url: "https://x.ai/cli/grok-1.0.52-macos-x86_64",
bytes: 185_857_856,
sha256: "sha256:b3f1fa34d88b96cbf471005ef777028abfe7288fe61ff9876629f0bbc2cfe8a5",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "windows/arm64",
url: "https://x.ai/cli/grok-1.0.52-windows-aarch64.exe",
bytes: 144_085_832,
sha256: "sha256:d92cb91801638dab1854b9108510a632b7aabc54147d6dd08b5babf8392c3389",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "windows/x86_64",
url: "https://x.ai/cli/grok-1.0.52-windows-x86_64.exe",
bytes: 169_355_080,
sha256: "sha256:47a5becb08dd0e51f34b60b34eb866086af7f392666f821b350a45f6736ed0cb",
shape: Shape::Raw,
member: "",
},
];
pub(crate) const PREVIOUS_ARTIFACTS: &[Artifact] = &[
Artifact {
platform: "linux/arm64",
url: "https://x.ai/cli/grok-1.0.49-linux-aarch64",
bytes: 146_642_280,
sha256: "sha256:df7e60362b1934b6f09e1e64b6d75a8c94b1bd9bf68c2803da273e4c6ed9a451",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "linux/x86_64",
url: "https://x.ai/cli/grok-1.0.49-linux-x86_64",
bytes: 175_805_280,
sha256: "sha256:2cc2ef5dcaa0509b56cdfb9559e27fabe322a0d893810e5129f507110e9b9c6c",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "macos/arm64",
url: "https://x.ai/cli/grok-1.0.49-macos-aarch64",
bytes: 154_433_376,
sha256: "sha256:184f4cb1ba2a8eefaa2c2f267b9102bdb13c32dce53db7f7e3095b88f5fe0cce",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "macos/x86_64",
url: "https://x.ai/cli/grok-1.0.49-macos-x86_64",
bytes: 172_962_304,
sha256: "sha256:7efdfb4253a5f7a8a71a482ee34afdda106a28936842537c85dac2a8f2819826",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "windows/arm64",
url: "https://x.ai/cli/grok-1.0.49-windows-aarch64.exe",
bytes: 139_079_496,
sha256: "sha256:2e31ca89b0af1485cd23d724093bce2fd1a1c5641f16396572805b6ff0042c65",
shape: Shape::Raw,
member: "",
},
Artifact {
platform: "windows/x86_64",
url: "https://x.ai/cli/grok-1.0.49-windows-x86_64.exe",
bytes: 161_183_560,
sha256: "sha256:39fe9e61788fef98bd3c10c88e7d368f6a010080755a43417f77d7e5c8832b9b",
shape: Shape::Raw,
member: "",
},
];
pub(crate) const SOFTWARE: Software = Software {
version: "1.0.52",
command: "grok",
delivery: Delivery::Artifacts(ARTIFACTS),
unsupported: &[],
previous: Some(Previous {
version: "1.0.49",
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"
);
}
}
}
}