Skip to content

Comments

fix: prevent Zod defaults from overwriting values during config merge#205

Open
ariane-emory wants to merge 2 commits intodevfrom
fix/merging-multiple-configs
Open

fix: prevent Zod defaults from overwriting values during config merge#205
ariane-emory wants to merge 2 commits intodevfrom
fix/merging-multiple-configs

Conversation

@ariane-emory
Copy link
Owner

@ariane-emory ariane-emory commented Feb 20, 2026

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR resolves an issue wherein, while merging multiple configuration files (for example, a global and project-local configuration file), if a setting has a default value, the default value is applied immediately after loading the first configuration file, leading to the default value being preferred over a non-default value for the same setting that is present in the second configuration file (for instance, if no foo value is present in the first file, but the default value of foo is 10, and the second configuration file does contain a value 5 for foo, the default value 10 will be used instead of the deliberately set value of 5).

When parsing partial configs, Zod applies .default() values to missing fields.
During config merge (global + project + cli), these defaults would overwrite
explicit values from earlier configs. Solution: strip defaults during parsing,
apply them only to the final merged result.
@ariane-emory ariane-emory force-pushed the fix/merging-multiple-configs branch from 0358476 to f62141d Compare February 20, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant