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.158.0-linux-arm64.tgz",
bytes: 154_764_938,
sha256: "sha256:f4ce42757e10140e0b2f0c916e72941c707d3e5d7d90922465df99268cf53f22",
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.158.0-linux-x64.tgz",
bytes: 162_057_445,
sha256: "sha256:3fe84106aaf2fbfc13299068510d34b3d0157eeb9af4b37be8cf5416f485a6bb",
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.158.0-darwin-arm64.tgz",
bytes: 133_524_491,
sha256: "sha256:7849f8aa87c3956823cef082d83b538980a0ced6e468cca4f39c1cf606ea8dae",
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.158.0-darwin-x64.tgz",
bytes: 142_394_998,
sha256: "sha256:72967f856612168cafcc4259ec0c890ea98483982441b51ec09c1811d386b390",
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.158.0-win32-arm64.tgz",
bytes: 151_185_263,
sha256: "sha256:ae7a6d75eac88486db8c6dd36582578c99843930f61710f94088a12366df4789",
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.158.0-win32-x64.tgz",
bytes: 161_635_245,
sha256: "sha256:fffd7f7ce365029b3f1d3607b53e7a2b7334f43affd776a718d782d5df2b890e",
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.157.1-linux-arm64.tgz",
bytes: 142_975_101,
sha256: "sha256:b73d482c0963a69d5cece5fe16e919473359937c22fb4499702ea35870e1824f",
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.157.1-linux-x64.tgz",
bytes: 150_336_017,
sha256: "sha256:7f12677740f439fe4884c7031d9d703e571cecf5ea9fa3a05abd1bbccc2162a8",
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.157.1-darwin-arm64.tgz",
bytes: 132_984_756,
sha256: "sha256:c5196640f2e5e1c9a4e1a1c1247ad32f0cbe6b19e7063db39d1204306344b283",
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.157.1-darwin-x64.tgz",
bytes: 141_687_693,
sha256: "sha256:77b26c00f5398c619f8b036092b064ae7ffe4391ae3b5370c457f93c64e9008c",
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.157.1-win32-arm64.tgz",
bytes: 150_603_367,
sha256: "sha256:634981182d54dcd305de02599336f0c6e2b6d540a549a55eb6191d2bf5292a3a",
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.157.1-win32-x64.tgz",
bytes: 160_979_646,
sha256: "sha256:a3362ca85d6ca27e2f88e6ee0b4790717b5e6909af54bdece49bdbdb41eaa2c6",
shape: Shape::GzipTar,
member: "package/vendor/x86_64-pc-windows-msvc/bin/codex.exe",
},
];
pub(crate) const SOFTWARE: Software = Software {
version: "0.158.0",
command: "codex",
delivery: Delivery::Artifacts(ARTIFACTS),
unsupported: &[],
previous: Some(Previous {
version: "0.157.1",
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"
);
}
}
}
}