fix(deploy): treat finalized manifests as clean no-op

This commit is contained in:
冰朔 2026-08-07 14:54:43 +08:00
commit c28a3da8ea
4 changed files with 73 additions and 4 deletions

View file

@ -29,7 +29,10 @@ function validateManifest(manifest, resource) {
const unit = String(manifest.module && manifest.module.unit || "");
if (!/^[A-Za-z0-9_.@-]+\.service$/.test(unit)) throw new Error("invalid_unit_name");
if (manifest.schema === "guanghu.existing-service-update-request/v1") return validateServiceUpdateManifest(manifest, unit);
if (manifest.status !== "ARCHITECTURE_PACKAGE_READY · INITIAL_PROVISION_PENDING") throw new Error("manifest_not_pending");
if (manifest.status !== "ARCHITECTURE_PACKAGE_READY · INITIAL_PROVISION_PENDING") {
if (/^DEPLOYED(?:_| )/.test(String(manifest.status || ""))) throw new Error("manifest_already_finalized");
throw new Error("manifest_not_pending");
}
if (!manifest.initial_provision || manifest.initial_provision.kind !== "new-architecture-unit") throw new Error("not_initial_architecture_unit");
if (!Array.isArray(manifest.source_paths) || manifest.source_paths.length < 1 || manifest.source_paths.length > 64 || manifest.source_paths.some(item => !safeRelative(item))) throw new Error("invalid_source_paths");
const unitMatches = manifest.source_paths.filter(item => path.basename(item) === unit);