Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/ae-devtools-cli/dev-loop/devloop.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export async function verify(input = {}) {
const {
runner, pin, projectIdentity, consentProvider, trustedScriptOptIn,
scriptProvenance, readOpId = "read.projectSummary", readArgs = {}, requestId,
hostProjectGuard, hostProjectGuardRequired,
hostProjectGuard, hostProjectGuardRequired, consentAudit,
} = input ?? {};
const op = (() => { try { return getOperation(readOpId); } catch { return null; } })();
if (!op || op.mutating) {
Expand All @@ -190,9 +190,14 @@ export async function verify(input = {}) {
: `readOpId '${readOpId}' is a mutating op; verify requires a read-only op`;
return { status: "refused", stage: "adapter", reason: "VERIFY_REQUIRES_READ_OP", detail, opId: readOpId };
}
// Explicit forward list — consentAudit MUST be here: verify dispatches
// are execute-class dispatches and their consent decisions are audit
// events (Issue #403). confirmRender/confirmDestructive/targetGuard
// are intentionally absent: verify only admits non-mutating ops, and
// runOperation's confirm gates and targetGuard never fire for them.
return runOperation({
opId: readOpId, args: readArgs, runner, pin, projectIdentity,
consentProvider, trustedScriptOptIn, scriptProvenance, requestId,
hostProjectGuard, hostProjectGuardRequired,
hostProjectGuard, hostProjectGuardRequired, consentAudit,
});
}
22 changes: 22 additions & 0 deletions packages/ae-devtools-cli/dev-loop/tests/devloop.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ test("execute/verify on null input produce structured refusals, not TypeErrors",
assert.equal(typeof v.reason, "string");
});

test("verify forwards consentAudit — verify dispatches record consent decisions (Issue #403)", async () => {
const f = fixture();
const entries = [];
const consentAudit = {
recordConsentDecision(entry) { entries.push(entry); },
};
const v = await verify({ ...f, consentAudit, requestId: "req-verify-1" });
assert.equal(v.outcome, "COMPLETED");
assert.equal(entries.length, 1);
assert.equal(entries[0].decision, "approved");
assert.equal(entries[0].opId, "read.projectSummary");
assert.equal(entries[0].requestId, "req-verify-1");
assert.equal(entries[0].mutating, false);
});

test("verify surfaces a malformed consentAudit as CONSENT_AUDIT_INVALID (Issue #403)", async () => {
const f = fixture();
const v = await verify({ ...f, consentAudit: { bogus: true } });
assert.equal(v.status, "refused");
assert.equal(v.reason, "CONSENT_AUDIT_INVALID");
});

test("execute adds no approval path: denial still refuses before transport", async () => {
const f = fixture();
const origSend = f.transport.send.bind(f.transport);
Expand Down
Loading