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; }