From 19f5d1345c3c136ec1175a2c2dd16b7059937bd2 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 2 Mar 2026 16:01:29 +0000 Subject: [PATCH] test(perf): cache redact hints and tune guardrail scan concurrency --- src/config/redact-snapshot.test.ts | 5 +++-- src/test-utils/runtime-source-guardrail-scan.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/config/redact-snapshot.test.ts b/src/config/redact-snapshot.test.ts index 8d353c4e2..2911f3091 100644 --- a/src/config/redact-snapshot.test.ts +++ b/src/config/redact-snapshot.test.ts @@ -10,6 +10,7 @@ import type { ConfigFileSnapshot } from "./types.openclaw.js"; import { OpenClawSchema } from "./zod-schema.js"; const { mapSensitivePaths } = __test__; +const mainSchemaHints = mapSensitivePaths(OpenClawSchema, "", {}); type TestSnapshot> = ConfigFileSnapshot & { parsed: TConfig; @@ -757,7 +758,7 @@ describe("redactConfigSnapshot", () => { }); it("contract-covers dynamic catchall/record paths for redact+restore", () => { - const hints = mapSensitivePaths(OpenClawSchema, "", {}); + const hints = mainSchemaHints; const snapshot = makeSnapshot({ env: { GROQ_API_KEY: "gsk-contract-123", @@ -1035,7 +1036,7 @@ describe("realredactConfigSnapshot_real", () => { unrepresentable: "any", }); schema.title = "OpenClawConfig"; - const hints = mapSensitivePaths(OpenClawSchema, "", {}); + const hints = mainSchemaHints; const snapshot = makeSnapshot({ agents: { diff --git a/src/test-utils/runtime-source-guardrail-scan.ts b/src/test-utils/runtime-source-guardrail-scan.ts index cb1003726..0131e07ae 100644 --- a/src/test-utils/runtime-source-guardrail-scan.ts +++ b/src/test-utils/runtime-source-guardrail-scan.ts @@ -22,7 +22,7 @@ const DEFAULT_GUARDRAIL_SKIP_PATTERNS = [ ]; const runtimeSourceGuardrailCache = new Map>(); -const FILE_READ_CONCURRENCY = 32; +const FILE_READ_CONCURRENCY = 16; export function shouldSkipGuardrailRuntimeSource(relativePath: string): boolean { return DEFAULT_GUARDRAIL_SKIP_PATTERNS.some((pattern) => pattern.test(relativePath));