fix(athena): enforce strict schema validation for council members
Add .strict() to CouncilMemberSchema to reject unknown fields like temperature. Remove unused Zod-inferred type exports. Add test verifying unknown fields are rejected. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -111,6 +111,17 @@ describe("CouncilMemberSchema", () => {
|
||||
expect(parsed.variant).toBeUndefined()
|
||||
expect(parsed.name).toBeUndefined()
|
||||
})
|
||||
|
||||
test("rejects member config with unknown fields", () => {
|
||||
//#given
|
||||
const config = { model: "openai/gpt-5.3-codex", temperature: 0.2 }
|
||||
|
||||
//#when
|
||||
const result = CouncilMemberSchema.safeParse(config)
|
||||
|
||||
//#then
|
||||
expect(result.success).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("CouncilConfigSchema", () => {
|
||||
|
||||
@@ -16,7 +16,7 @@ export const CouncilMemberSchema = z.object({
|
||||
model: ModelStringSchema,
|
||||
variant: z.string().optional(),
|
||||
name: z.string().optional(),
|
||||
})
|
||||
}).strict()
|
||||
|
||||
export const CouncilConfigSchema = z.object({
|
||||
members: z.array(CouncilMemberSchema).min(2),
|
||||
@@ -26,7 +26,3 @@ export const AthenaConfigSchema = z.object({
|
||||
model: z.string().optional(),
|
||||
council: CouncilConfigSchema,
|
||||
})
|
||||
|
||||
export type CouncilMemberSchemaType = z.infer<typeof CouncilMemberSchema>
|
||||
export type CouncilConfigSchemaType = z.infer<typeof CouncilConfigSchema>
|
||||
export type AthenaConfigSchemaType = z.infer<typeof AthenaConfigSchema>
|
||||
|
||||
Reference in New Issue
Block a user