Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -0,0 +1,37 @@
import { describe, expect, it } from "vitest";
import { toSafeErrorLog } from "./safeErrorLog.server";
describe("toSafeErrorLog", () => {
it("keeps only a bounded error identity", () => {
const error = Object.assign(new TypeError("postgres://user:secret@example.test/customer@example.test"), { code: "P2002" });
expect(toSafeErrorLog(error)).toEqual({ errorName: "TypeError", errorCode: "P2002" });
expect(JSON.stringify(toSafeErrorLog(error))).not.toContain("secret");
expect(JSON.stringify(toSafeErrorLog(error))).not.toContain("customer@example.test");
});
it("does not serialize arbitrary thrown values or unbounded codes", () => {
expect(toSafeErrorLog("token=secret")).toEqual({ errorName: "UnknownError" });
expect(toSafeErrorLog(Object.assign(new Error("secret"), { code: "x".repeat(65) }))).toEqual({ errorName: "Error" });
expect(toSafeErrorLog(Object.assign(new Error("secret"), { name: "token=secret", code: "lowercase-secret" }))).toEqual({
errorName: "Error",
});
});
it("rejects secret-shaped uppercase names and codes instead of treating their shape as safe", () => {
const error = Object.assign(new Error("hidden"), {
name: "SECRET_API_KEY",
code: "PASSWORD:SUPERSECRET",
});
expect(toSafeErrorLog(error)).toEqual({ errorName: "Error" });
});
it("retains only explicitly supported operational codes", () => {
expect(toSafeErrorLog(Object.assign(new Error("offline"), { code: "ECONNREFUSED" }))).toEqual({
errorName: "Error",
errorCode: "ECONNREFUSED",
});
});
});