1// The taxonomy contract: consumers act on the code's classification, never on2// the reason string, and unknown codes fail safe (keep waiting, never3// compensate).45import { assert, assertEquals } from "@std/assert";6import {7 classifyMutationError,8 isPermanentMutationError,9 MUTATION_ERROR_CLASSES,10} from "../src/verdict.ts";1112Deno.test("verdict: permission_denied is permanent", () => {13 assertEquals(classifyMutationError("permission_denied"), "permanent");14 assert(isPermanentMutationError("permission_denied"));15});1617Deno.test("verdict: unknown codes classify transient", () => {18 for (const code of ["", "store_unreachable", "some_future_code", "PERMISSION_DENIED"]) {19 assertEquals(classifyMutationError(code), "transient", `code ${JSON.stringify(code)}`);20 assertEquals(isPermanentMutationError(code), false);21 }22});2324Deno.test("verdict: the registry only holds valid classes", () => {25 for (const [code, klass] of Object.entries(MUTATION_ERROR_CLASSES)) {26 assert(klass === "permanent" || klass === "transient", `code ${code}`);27 }28});