feat(registry-manifest): phase 2 — publisher embeds manifests into signed catalog

generate-app-catalog.sh gains opt-in EMBED_MANIFESTS=1: embeds each
apps/<id>/manifest.yml into its catalog entry's `manifest` field (whole document,
top-level app: preserved — exactly what the Rust side deserializes). Default off
so routine catalog regen is unchanged during the migration window; turn on
deliberately, then sign via the existing release-root ceremony. Verified: default
embeds 0; EMBED_MANIFESTS=1 embeds 40 manifests (generated_secrets preserved).

Adds a round-trip guard test: every shipped apps/*/manifest.yml must deserialize
+ validate through catalog_manifest_to_overlay (image apps accepted, build apps
defer to disk) — catches schema drift between disk manifests and the catalog path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
archipelago
2026-06-21 05:46:17 -04:00
co-authored by Claude Opus 4.8
parent 220666d3a9
commit 7bfbe8fe40
2 changed files with 82 additions and 2 deletions
@@ -3761,6 +3761,44 @@ app:
assert!(catalog_manifest_to_overlay("demo", v).is_none());
}
#[test]
fn catalog_overlay_accepts_all_real_image_manifests() {
// Guard the registry-distribution round-trip for the WHOLE shipped app
// set: every apps/*/manifest.yml must deserialize + validate when carried
// through the catalog as a value. Image-only apps must be accepted;
// build-source apps must defer to disk (phase 1 = image-only). Catches
// schema drift between disk manifests and the catalog path.
let apps_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../apps");
if !apps_dir.exists() {
return; // packaged/CI layout without the repo apps/ tree — skip
}
let mut image_apps = 0;
for entry in std::fs::read_dir(&apps_dir).unwrap().flatten() {
let mf = entry.path().join("manifest.yml");
if !mf.exists() {
continue;
}
let m = match AppManifest::from_file(&mf) {
Ok(m) => m,
Err(_) => continue, // a malformed disk manifest is a separate concern
};
let id = m.app.id.clone();
let is_build = m.app.container.build.is_some();
let value = serde_json::to_value(&m).expect("manifest serializes to JSON");
let overlay = catalog_manifest_to_overlay(&id, value);
if is_build {
assert!(overlay.is_none(), "{id}: build-source app must defer to disk");
} else {
assert!(
overlay.is_some(),
"{id}: image-only app must round-trip through the catalog"
);
image_apps += 1;
}
}
assert!(image_apps > 0, "expected at least one image-only manifest");
}
fn manifest_with_container_name(id: &str, image: &str, name: &str) -> AppManifest {
let yaml = format!(
"app:\n id: {id}\n name: {id}\n version: 1.0.0\n container_name: {name}\n container:\n image: {image}\n"