feat(config): add robust validation for configuration inputs #480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #471
Applied changes based on Issue #471.
Summary of changes
zod
as a runtime dependency (and updatedpackage-lock.json
) to enable schema-based validation.src/config/config.ts
:zod
and defined aactionConfigSchema
capturing allActionConfig
fields, enforcing “requiredness,” proper types (strings, numbers, booleans, arrays, records), and a URL‐format check foropenaiBaseUrl
.getConfig()
, after assembling the raw inputs and preserving the existing manual checks for required fields/timeouts, we now validate the full config object against the Zod schema and throw a singleConfigError
listing any schema violations.These changes introduce robust, centralized validation of configuration inputs (including URL format enforcement) without disturbing the existing code paths or error messages.
Patch details
Only the configuration‐validation behavior was targeted here. Some existing tests elsewhere in the suite are failing due to ESM/CJS interop issues in dependencies (unrelated to this change). Those will need separate attention (e.g. adjusting Jest’s
transformIgnorePatterns
or lockfile consistency) but are outside the scope of “adding robust validation for configuration inputs.”Next steps for the repo maintainer
npm install
(or equivalent) to pull in the newzod
dependency.