H-385: address CDP spike review blockers
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import test from "node:test";
|
||||
|
||||
import { boundedBody, redactHeaders, safeUrl } from "../scripts/m0-spike.mjs";
|
||||
import { boundedBody, redactHeaders, safeUrl, shouldRetryStartup } from "../scripts/m0-spike.mjs";
|
||||
|
||||
test("export policy redacts credentials and bounds bodies", () => {
|
||||
const sensitive = randomUUID();
|
||||
@@ -14,6 +14,10 @@ test("export policy redacts credentials and bounds bodies", () => {
|
||||
"set-cookie": "[REDACTED]",
|
||||
});
|
||||
assert.equal(safeUrl("https://example.test/path?token=secret"), "https://example.test/path?<redacted>");
|
||||
assert.deepEqual(boundedBody("hello", false, 5), { state: "stored", bytes: 5, encoding: "utf8", text: "hello" });
|
||||
assert.deepEqual(boundedBody("hello!", false, 5), { state: "omitted", reason: "size_limit", bytes: 6 });
|
||||
assert.deepEqual(boundedBody(sensitive, false, 100), { state: "fetched", storage: "omitted", reason: "default_body_policy", bytes: Buffer.byteLength(sensitive) });
|
||||
assert(!JSON.stringify(boundedBody(sensitive, false, 100)).includes(sensitive));
|
||||
assert.deepEqual(boundedBody("hello!", false, 5), { state: "size_limit", storage: "omitted", bytes: 6 });
|
||||
assert(shouldRetryStartup("Render process gone."));
|
||||
assert(!shouldRetryStartup("Target closed."));
|
||||
assert(!shouldRetryStartup(undefined));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user