← Back to PRs

#10056: fix: allow extra fields in HookConfig schema

by 7Sageer open 2026-02-06 02:30 View on GitHub →
stale
## Summary Change `HookConfigSchema` from `.strict()` to `.passthrough()` to allow hook-specific config fields. ## Problem Hooks like `soul-evil` read extra config fields (`chance`, `file`, `purge`), but the Zod schema rejects them: ``` Invalid config: hooks.internal.entries.soul-evil: Unrecognized key: "chance" ``` ## Solution One-line fix in `zod-schema.hooks.ts`: ```diff - .strict(); + .passthrough(); ``` This aligns the schema with the TypeScript type which uses `[key: string]: unknown`. Fixes #10053 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates `src/config/zod-schema.hooks.ts` so per-hook entries under `hooks.internal.entries` are validated with `.passthrough()` rather than `.strict()`. This allows hook-specific configuration keys to be present without failing Zod validation, which aligns runtime validation with the `HookConfig` TypeScript type that permits additional fields. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - The change is a one-line schema adjustment scoped to hook-entry configs; it resolves a concrete validation mismatch without affecting other strict schemas in this file. No behavioral changes occur unless users provide additional keys, which are now correctly permitted by the TypeScript type and consumed by hook implementations. - No files require special attention <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs