diff --git a/src/lib/openapi/routes/shared.ts b/src/lib/openapi/routes/shared.ts index c88764d41..3c5530c43 100644 --- a/src/lib/openapi/routes/shared.ts +++ b/src/lib/openapi/routes/shared.ts @@ -244,16 +244,15 @@ export function recordRefusal(...alsoRefusesFor: string[]): RefusalResponse { // grant-consent notice and call POST /api/consent/ai (or, on web, POST // /api/consent/ai/web) to mint the receipt. BYOK / local / ChatGPT-OAuth // chains are the user's own egress and never trip this gate. +// +// There is no `consentRequiredResponse` beside this description any more, and +// the absence is deliberate. Every route that could answer it is also a route +// the sharing fence can refuse, and OpenAPI allows one response per status, so +// the two 403s share a single description built by `recordRefusal(...)`. A +// second exported 403 body would be a second way to write the same operation. export const AI_CONSENT_REQUIRED_DESCRIPTION = "AI consent required: no active ConsentReceipt for the server-managed provider. `meta.errorCode` = `consent.ai.required`. Mint a receipt via POST /api/consent/ai before retrying."; -export const consentRequiredResponse = { - "403": { - description: AI_CONSENT_REQUIRED_DESCRIPTION, - content: { "application/json": { schema: errorEnvelope } }, - }, -}; - // ── Module-disabled gate (v1.18.0) ─────────────────────────────────── // Every module-scoped route runs `requireModuleEnabled(userId, key)`, // which returns a 403 when the account has the module turned off — even diff --git a/tests/fixtures/v137/security-principals.ts b/tests/fixtures/v137/security-principals.ts index 121b722f1..400b2355c 100644 --- a/tests/fixtures/v137/security-principals.ts +++ b/tests/fixtures/v137/security-principals.ts @@ -60,19 +60,3 @@ export const SECURITY_PRINCIPALS = { job: { id: "job-owner-idempotency", origin: "owner-request" }, }, } as const satisfies Record; - -export async function mutateThenRestore( - mutate: () => Promise, - restore: (result: T) => Promise, -): Promise { - let result: T | undefined; - let completed = false; - - try { - result = await mutate(); - completed = true; - return result; - } finally { - if (completed) await restore(result as T); - } -}