mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 09:08:38 +00:00
test(perf): cache redact hints and tune guardrail scan concurrency
This commit is contained in:
@@ -10,6 +10,7 @@ import type { ConfigFileSnapshot } from "./types.openclaw.js";
|
|||||||
import { OpenClawSchema } from "./zod-schema.js";
|
import { OpenClawSchema } from "./zod-schema.js";
|
||||||
|
|
||||||
const { mapSensitivePaths } = __test__;
|
const { mapSensitivePaths } = __test__;
|
||||||
|
const mainSchemaHints = mapSensitivePaths(OpenClawSchema, "", {});
|
||||||
|
|
||||||
type TestSnapshot<TConfig extends Record<string, unknown>> = ConfigFileSnapshot & {
|
type TestSnapshot<TConfig extends Record<string, unknown>> = ConfigFileSnapshot & {
|
||||||
parsed: TConfig;
|
parsed: TConfig;
|
||||||
@@ -757,7 +758,7 @@ describe("redactConfigSnapshot", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("contract-covers dynamic catchall/record paths for redact+restore", () => {
|
it("contract-covers dynamic catchall/record paths for redact+restore", () => {
|
||||||
const hints = mapSensitivePaths(OpenClawSchema, "", {});
|
const hints = mainSchemaHints;
|
||||||
const snapshot = makeSnapshot({
|
const snapshot = makeSnapshot({
|
||||||
env: {
|
env: {
|
||||||
GROQ_API_KEY: "gsk-contract-123",
|
GROQ_API_KEY: "gsk-contract-123",
|
||||||
@@ -1035,7 +1036,7 @@ describe("realredactConfigSnapshot_real", () => {
|
|||||||
unrepresentable: "any",
|
unrepresentable: "any",
|
||||||
});
|
});
|
||||||
schema.title = "OpenClawConfig";
|
schema.title = "OpenClawConfig";
|
||||||
const hints = mapSensitivePaths(OpenClawSchema, "", {});
|
const hints = mainSchemaHints;
|
||||||
|
|
||||||
const snapshot = makeSnapshot({
|
const snapshot = makeSnapshot({
|
||||||
agents: {
|
agents: {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const DEFAULT_GUARDRAIL_SKIP_PATTERNS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const runtimeSourceGuardrailCache = new Map<string, Promise<RuntimeSourceGuardrailFile[]>>();
|
const runtimeSourceGuardrailCache = new Map<string, Promise<RuntimeSourceGuardrailFile[]>>();
|
||||||
const FILE_READ_CONCURRENCY = 32;
|
const FILE_READ_CONCURRENCY = 16;
|
||||||
|
|
||||||
export function shouldSkipGuardrailRuntimeSource(relativePath: string): boolean {
|
export function shouldSkipGuardrailRuntimeSource(relativePath: string): boolean {
|
||||||
return DEFAULT_GUARDRAIL_SKIP_PATTERNS.some((pattern) => pattern.test(relativePath));
|
return DEFAULT_GUARDRAIL_SKIP_PATTERNS.some((pattern) => pattern.test(relativePath));
|
||||||
|
|||||||
Reference in New Issue
Block a user