From 42c98cabc7d84fd09832f604fa4adda15c91659c Mon Sep 17 00:00:00 2001 From: joshualitt Date: Wed, 1 Apr 2026 10:24:45 -0700 Subject: [PATCH] refactor(core): Unified context management settings schema (#24391) --- packages/core/src/policy/toml-loader.test.ts | 3 +++ packages/core/src/policy/toml-loader.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/src/policy/toml-loader.test.ts b/packages/core/src/policy/toml-loader.test.ts index 6835e200b4..b9fb4baac6 100644 --- a/packages/core/src/policy/toml-loader.test.ts +++ b/packages/core/src/policy/toml-loader.test.ts @@ -490,6 +490,7 @@ name = "allowed-path" expect(error.errorType).toBe('schema_validation'); expect(error.details).toContain('toolName'); expect(error.details).toContain('Invalid input'); + expect(error.suggestion).toContain('toolName'); }); it('should return a schema_validation error if priority is missing', async () => { @@ -502,6 +503,7 @@ decision = "allow" const error = result.errors[0]; expect(error.errorType).toBe('schema_validation'); expect(error.details).toContain('priority'); + expect(error.suggestion).toContain('toolName'); }); it('should return a schema_validation error if priority is a float', async () => { @@ -598,6 +600,7 @@ priority = 100 expect(error.errorType).toBe('schema_validation'); expect(error.details).toContain('toolName'); expect(error.details).toContain('Invalid input'); + expect(error.suggestion).toContain('toolName'); }); it('should return a schema_validation error if toolName is not a string or array', async () => { diff --git a/packages/core/src/policy/toml-loader.ts b/packages/core/src/policy/toml-loader.ts index 977e8a399a..3cf9dc2a99 100644 --- a/packages/core/src/policy/toml-loader.ts +++ b/packages/core/src/policy/toml-loader.ts @@ -383,7 +383,7 @@ export async function loadPoliciesFromToml( message: 'Schema validation failed', details: formatSchemaError(validationResult.error, 0), suggestion: - 'Ensure all required fields (decision, priority) are present with correct types', + 'Ensure all required fields (decision, priority, toolName) are present with correct types', }); continue; }