feat(authz): add resident agent operation receipts

This commit is contained in:
冰朔 2026-07-26 15:26:21 +08:00
commit 357ac5e67a
6 changed files with 136 additions and 18 deletions

View file

@ -8,7 +8,7 @@ const path = require("node:path");
const { createApp } = require("./server");
const { authorizeRepoPush } = require("./authorize-repo-push");
test("one helper command completes owner handoff, map acknowledgement, and repo grant", async () => {
test("repo-push helper stops with a server receipt when no safe transport is deployed", async () => {
const mail = [];
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "lake-lamp-repo-push-"));
const mapGate = {
@ -48,10 +48,8 @@ test("one helper command completes owner handoff, map acknowledgement, and repo
const approvalPath = new URL(mail[0].approvalUrl).pathname.replace("/authz", "");
assert.equal((await fetch(`${base}${approvalPath}`, { method: "POST" })).status, 200);
const grant = await grantPromise;
assert.equal(grant.repo, "bingshuo/fifth-domain");
assert.equal(grant.target, "JD-FD-PRIMARY");
assert.ok(lines.some(line => line.startsWith("[LL-REPO-PUSH-GRANTED]")));
await assert.rejects(grantPromise, /repo_push_transport_unavailable/);
assert.ok(lines.some(line => line.startsWith("[LL-REPO-PUSH-TRANSPORT-BLOCKED]")));
assert.ok(fs.existsSync(path.join(directory, "bingshuo__fifth-domain.json")));
} finally {
await new Promise(resolve => app.close(resolve));