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.259.tgz",
bytes: 97_662_709,
sha256: "sha256:d14a6b349115c12765766d14b6d727a62bfcfb8da3ecd514348ce8788228e1ba",
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.259.tgz",
bytes: 97_244_038,
sha256: "sha256:3fdf03de822d74d43d14eb54d9a2b4dfaa1854a03c38baea1ba871e2b6ebf9d6",
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.259.tgz",
bytes: 87_558_821,
sha256: "sha256:979e70733dd39dad59d837e803a784399299d4b9fbb6c8994c83eefbcb2bf4b8",
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.259.tgz",
bytes: 91_556_534,
sha256: "sha256:3c4192427a7e151599fc1ec3d47dfb0f7610b82f344b2ce0f0bb5cbe5026ac39",
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.259.tgz",
bytes: 96_983_056,
sha256: "sha256:cd9229add3a496d1e3760fc9ac509b7f169996b957c14feb3b8fc42f86e15622",
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.259.tgz",
bytes: 100_064_367,
sha256: "sha256:9857c97cb9bd519286bc59c77813eb3010e36cdffe21a9dd7b4fb184b4f5c8a1",
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.258.tgz",
bytes: 97_075_635,
sha256: "sha256:2f0ad50cd3efd5707323f48b43af22c5cbc045e74cdfc16d25c5a73581f3b196",
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.258.tgz",
bytes: 96_664_469,
sha256: "sha256:037f8a21ae74a29b613f02cd3986cefb0b00fcb14f957a8dab98dc2e3f3fd753",
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.258.tgz",
bytes: 86_968_654,
sha256: "sha256:eba374d2796edf6ed9652b40d4c081a1b7d2c206b5f2aec6187fcb3384087686",
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.258.tgz",
bytes: 90_955_658,
sha256: "sha256:a03bdcd9c7de29fe9f01bed0b8cff3f5a61ada9200536296e2b17f565d0294c2",
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.258.tgz",
bytes: 96_401_609,
sha256: "sha256:67703e7d3f443f5000da112f83a616208999cc74a1d8fb3d12cd462e0f257e81",
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.258.tgz",
bytes: 99_482_091,
sha256: "sha256:347e6c1ea33a18bbdb8add7bdb5f92ef67e0c7d7d816cfa71e5a2883ef17f25d",
shape: Shape::GzipTar,
member: "package/claude.exe",
},
];
pub(crate) const SOFTWARE: Software = Software {
version: "2.1.259",
command: "claude",
delivery: Delivery::Artifacts(ARTIFACTS),
unsupported: &[],
previous: Some(Previous {
version: "2.1.258",
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"
);
}
}
}
}