use crate::harness_runtime::{Artifact, Delivery, Previous, Shape, Software};
pub(crate) const ARTIFACTS: &[Artifact] = &[
Artifact {
platform: "linux/arm64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-arm64/-/claude-code-linux-arm64-2.1.288.tgz",
bytes: 110_330_238,
sha256: "sha256:a4e46f12f30ec01b978e3aa1a78fbc9c2fdd3a6478d0cc068c4a8f7d23cb5b75",
shape: Shape::GzipTar,
member: "package/claude",
},
Artifact {
platform: "linux/x86_64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64/-/claude-code-linux-x64-2.1.288.tgz",
bytes: 110_072_430,
sha256: "sha256:b54d6a2c6bdd78f2c83139d1223598641686aab9e562c47cf537dd200653fa90",
shape: Shape::GzipTar,
member: "package/claude",
},
Artifact {
platform: "macos/arm64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-arm64/-/claude-code-darwin-arm64-2.1.288.tgz",
bytes: 100_276_471,
sha256: "sha256:7cb1cbd826e6aa5ffc347e15193776c59373f840f40ec0fe3acfdcae342864da",
shape: Shape::GzipTar,
member: "package/claude",
},
Artifact {
platform: "macos/x86_64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-x64/-/claude-code-darwin-x64-2.1.288.tgz",
bytes: 104_351_206,
sha256: "sha256:eb30a25c70fc07643d6da84a4bab97ea61fb8aae4e73af1ea4d1b9e8dbd453dc",
shape: Shape::GzipTar,
member: "package/claude",
},
Artifact {
platform: "windows/arm64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-arm64/-/claude-code-win32-arm64-2.1.288.tgz",
bytes: 108_829_701,
sha256: "sha256:d9c0e05de9ce0c2eb6075418153efc429c35eed9098bbd704f970b750905a5e7",
shape: Shape::GzipTar,
member: "package/claude.exe",
},
Artifact {
platform: "windows/x86_64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-x64/-/claude-code-win32-x64-2.1.288.tgz",
bytes: 112_945_062,
sha256: "sha256:1c3f4aa857914e6801520d566025d2f1970a70842026bfc4c63da306becbcb48",
shape: Shape::GzipTar,
member: "package/claude.exe",
},
];
pub(crate) const PREVIOUS_ARTIFACTS: &[Artifact] = &[
Artifact {
platform: "linux/arm64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-arm64/-/claude-code-linux-arm64-2.1.285.tgz",
bytes: 107_804_240,
sha256: "sha256:f8a0dc539db3c860bdd12a345a51db798908b089a1696f9720c57776dace4cbf",
shape: Shape::GzipTar,
member: "package/claude",
},
Artifact {
platform: "linux/x86_64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-linux-x64/-/claude-code-linux-x64-2.1.285.tgz",
bytes: 107_536_804,
sha256: "sha256:3fea1abf2d5f42236ebf7e59126698e347ac80437a145dd6e85b87c8c3341ffe",
shape: Shape::GzipTar,
member: "package/claude",
},
Artifact {
platform: "macos/arm64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-arm64/-/claude-code-darwin-arm64-2.1.285.tgz",
bytes: 97_724_687,
sha256: "sha256:071464aa2be9980e0100d1818177ecae784e670c9a2a6d4fbbcf8a0845d4235a",
shape: Shape::GzipTar,
member: "package/claude",
},
Artifact {
platform: "macos/x86_64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-darwin-x64/-/claude-code-darwin-x64-2.1.285.tgz",
bytes: 101_788_383,
sha256: "sha256:61ed50d195a6e433365324cc03db2670ef5aacf640cc736378b8c654f8b62ad9",
shape: Shape::GzipTar,
member: "package/claude",
},
Artifact {
platform: "windows/arm64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-arm64/-/claude-code-win32-arm64-2.1.285.tgz",
bytes: 106_296_985,
sha256: "sha256:382464208d94620197e4d0f5904da5609c54c4726328f6cf9c5aa2b28d28e1fc",
shape: Shape::GzipTar,
member: "package/claude.exe",
},
Artifact {
platform: "windows/x86_64",
url: "https://registry.npmjs.org/@anthropic-ai/claude-code-win32-x64/-/claude-code-win32-x64-2.1.285.tgz",
bytes: 110_419_954,
sha256: "sha256:96890f4585c781fc0c383af9fdba08e9fe2b7da186ebe3bc10d01e1a5131b27c",
shape: Shape::GzipTar,
member: "package/claude.exe",
},
];
pub(crate) const SOFTWARE: Software = Software {
version: "2.1.288",
command: "claude",
delivery: Delivery::Artifacts(ARTIFACTS),
unsupported: &[],
previous: Some(Previous {
version: "2.1.285",
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/claude-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"
);
}
}
}
}