fix(authz): validate nested deployment receipts

This commit is contained in:
冰朔 2026-08-06 13:01:15 +08:00
commit f7454964c4
2 changed files with 29 additions and 5 deletions

View file

@ -128,7 +128,14 @@ test("existing service update backs up declared files, restarts, and verifies id
service_update: { kind: "existing-systemd-service", require_existing_unit: true, required_existing_files: ["server.js"] },
unit_source: "server-tools/ai-discovery/guanghu-ai-discovery.service",
files: [{ source: "server-tools/ai-discovery/server.js", destination: "server.js", mode: "0644" }],
runtime_check: { url: "http://127.0.0.1:3922/health", expected: { ok: true, mode: "read-only" } },
runtime_check: {
url: "http://127.0.0.1:3922/health",
expected: {
ok: true,
mode: "read-only",
navigation_source: { anchor_id: "GLW-PUBLIC-NAV-ANCHOR-001", source_degraded: false },
},
},
acceptance_checks: [{ url: "http://127.0.0.1:3922/v1/resolve?id=ICE-GL-ZY001", expected: { canonical_id: "ICE-P-ZY001", redirected: true } }],
};
fs.mkdirSync(path.join(repoDir, "deployment", "requests"), { recursive: true });
@ -146,7 +153,9 @@ test("existing service update backs up declared files, restarts, and verifies id
const result = await provision({ target: "JD-FD-PRIMARY", action: "provision-approved-architecture", resource: `${updateRequestId}@${commit}` }, {
repoDir, releasesDir, unitDir, receiptsDir, installRootOverride: installRoot,
run: async (file, args) => { commands.push([file, args]); return { stdout: args.includes("rev-parse") ? `${commit}\n` : "" }; },
getJson: async url => url.endsWith("/health") ? { ok: true, mode: "read-only" } : { canonical_id: "ICE-P-ZY001", redirected: true },
getJson: async url => url.endsWith("/health")
? { ok: true, mode: "read-only", navigation_source: { anchor_id: "GLW-PUBLIC-NAV-ANCHOR-001", source_degraded: false, source_commit: commit } }
: { canonical_id: "ICE-P-ZY001", redirected: true },
healthDelayMs: 0,
});
assert.equal(result.ok, true);