use crate::harness_runtime::{Artifact, Delivery, Previous, Shape, Software};
pub(crate) const ARTIFACTS: &[Artifact] = &[
Artifact {
platform: "linux/arm64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.154.0-linux-arm64.tgz",
bytes: 122_610_794,
sha256: "sha256:a2315b5f64bfeaff79b71e0d35505ba8c22cc1e96cab9dc950b614c804105b24",
shape: Shape::GzipTar,
member: "package/vendor/aarch64-unknown-linux-musl/bin/codex",
},
Artifact {
platform: "linux/x86_64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.154.0-linux-x64.tgz",
bytes: 129_654_638,
sha256: "sha256:e27c83a49e6031685ee7f956c12aad5f16484d3a80181dd3fea930fb96b3832b",
shape: Shape::GzipTar,
member: "package/vendor/x86_64-unknown-linux-musl/bin/codex",
},
Artifact {
platform: "macos/arm64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.154.0-darwin-arm64.tgz",
bytes: 116_501_639,
sha256: "sha256:2a98662d79316a59993c7233e3e25a1aa1d42da4b45904585d33a5a7da1cade1",
shape: Shape::GzipTar,
member: "package/vendor/aarch64-apple-darwin/bin/codex",
},
Artifact {
platform: "macos/x86_64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.154.0-darwin-x64.tgz",
bytes: 124_308_807,
sha256: "sha256:92c493533c53c433c4d94252251daba4f379ccba06a9964d260abb47a535dce1",
shape: Shape::GzipTar,
member: "package/vendor/x86_64-apple-darwin/bin/codex",
},
Artifact {
platform: "windows/arm64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.154.0-win32-arm64.tgz",
bytes: 132_888_437,
sha256: "sha256:a072b19e67fd65f2827c925a9d3c89b1a55da70b8e24cc21b81c800a77cb3d53",
shape: Shape::GzipTar,
member: "package/vendor/aarch64-pc-windows-msvc/bin/codex.exe",
},
Artifact {
platform: "windows/x86_64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.154.0-win32-x64.tgz",
bytes: 142_162_836,
sha256: "sha256:27eedae55e37ed1da4078b36a6ef9e4ffe8546a60fd6df5ee6408fdd16aff8ea",
shape: Shape::GzipTar,
member: "package/vendor/x86_64-pc-windows-msvc/bin/codex.exe",
},
];
pub(crate) const PREVIOUS_ARTIFACTS: &[Artifact] = &[
Artifact {
platform: "linux/arm64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.153.4-linux-arm64.tgz",
bytes: 121_707_000,
sha256: "sha256:439c0dd0d6923f607b4e5cd1e3079c12f0b86f6e5007f07e377d6ad25e2d7bb9",
shape: Shape::GzipTar,
member: "package/vendor/aarch64-unknown-linux-musl/bin/codex",
},
Artifact {
platform: "linux/x86_64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.153.4-linux-x64.tgz",
bytes: 129_272_137,
sha256: "sha256:54818cb9fce3360cc6e44cfc5a96952cd5c1243efb43cbe488e11dda84663e08",
shape: Shape::GzipTar,
member: "package/vendor/x86_64-unknown-linux-musl/bin/codex",
},
Artifact {
platform: "macos/arm64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.153.4-darwin-arm64.tgz",
bytes: 115_672_312,
sha256: "sha256:535d301b49131abfda3264f959fb0defa40bbc306976d98ddbc15c424636c55c",
shape: Shape::GzipTar,
member: "package/vendor/aarch64-apple-darwin/bin/codex",
},
Artifact {
platform: "macos/x86_64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.153.4-darwin-x64.tgz",
bytes: 123_544_033,
sha256: "sha256:5e468958503c60e940b1b1af3fe2064c16fd141f1607111caf99f2c0a0e80725",
shape: Shape::GzipTar,
member: "package/vendor/x86_64-apple-darwin/bin/codex",
},
Artifact {
platform: "windows/arm64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.153.4-win32-arm64.tgz",
bytes: 132_173_674,
sha256: "sha256:6d0bf07e04810f0ed4ad2984f6c9f0547bb9e0e1bb1f8fe9ecce0de3376bbfef",
shape: Shape::GzipTar,
member: "package/vendor/aarch64-pc-windows-msvc/bin/codex.exe",
},
Artifact {
platform: "windows/x86_64",
url: "https://registry.npmjs.org/@openai/codex/-/codex-0.153.4-win32-x64.tgz",
bytes: 141_495_386,
sha256: "sha256:05f473573f38b3f4dc9484e6807a511a1bb0e128dfa50816dafc5f79e553cdca",
shape: Shape::GzipTar,
member: "package/vendor/x86_64-pc-windows-msvc/bin/codex.exe",
},
];
pub(crate) const SOFTWARE: Software = Software {
version: "0.154.0",
command: "codex",
delivery: Delivery::Artifacts(ARTIFACTS),
unsupported: &[],
previous: Some(Previous {
version: "0.153.4",
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/codex-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"
);
}
}
}
}