anodizer_core/dist.rs
1//! Canonical basenames for the sidecar manifests anodizer writes into the
2//! `dist/` tree (and the per-`run-<id>/` subdir).
3//!
4//! Every writer, reader, GitHub-release uploader, split/merge loader, and the
5//! determinism-harness preserve allow-list reference these constants instead of
6//! repeating the literal. A sidecar rename is then a single-line edit that the
7//! compiler propagates everywhere — the writer can never drift from the preserve
8//! allow-list that decides which sidecars survive the shard merge (a silent,
9//! one-way-release-fatal failure mode when the two disagree).
10//!
11//! Mirrors the single-source pattern of
12//! `crate::config::attestation::AttestationConfig::SUBJECTS_MANIFEST_NAME`.
13
14/// `dist/metadata.json` — project metadata (name, tag, version, commit, …).
15pub const METADATA_JSON: &str = "metadata.json";
16
17/// `dist/artifacts.json` — the per-artifact manifest array.
18pub const ARTIFACTS_JSON: &str = "artifacts.json";
19
20/// `dist/context.json` — the preserved-dist context the publish-only path reads.
21pub const CONTEXT_JSON: &str = "context.json";
22
23/// `dist/run-<id>/report.json` — the publish run's replay report.
24pub const REPORT_JSON: &str = "report.json";
25
26/// `dist/run-<id>/rollback.json` — the rollback replay's updated state.
27pub const ROLLBACK_JSON: &str = "rollback.json";
28
29/// `dist/run-<id>/summary.json` — the per-run publish summary.
30pub const SUMMARY_JSON: &str = "summary.json";
31
32/// Directory-name prefix of the per-run `dist/run-<id>/` subdir. Shared by
33/// the writer (`run_dir` in the publish stage) and the run-summary scanner
34/// so a prefix rename cannot make the scanner silently return empty — which
35/// would strip `tag rollback`'s published-state guard and every run-summary
36/// display of all on-disk publish evidence.
37pub const RUN_DIR_PREFIX: &str = "run-";
38
39#[cfg(test)]
40mod tests {
41 use super::*;
42
43 /// Pin the on-disk basenames. The whole module exists to stop a
44 /// writer/reader rename from silently desyncing a sidecar; a typo in a
45 /// const here would propagate that typo everywhere, so the literal
46 /// values are asserted directly.
47 #[test]
48 fn sidecar_basenames_are_stable() {
49 assert_eq!(METADATA_JSON, "metadata.json");
50 assert_eq!(ARTIFACTS_JSON, "artifacts.json");
51 assert_eq!(CONTEXT_JSON, "context.json");
52 assert_eq!(REPORT_JSON, "report.json");
53 assert_eq!(ROLLBACK_JSON, "rollback.json");
54 assert_eq!(SUMMARY_JSON, "summary.json");
55 assert_eq!(RUN_DIR_PREFIX, "run-");
56 }
57}