fix(config): validate unknown fields in LogConfig and warn in ParserConfig#856
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom Mar 22, 2026
Merged
Conversation
…onfig LogConfig was missing , silently ignoring typos like 'log_level' instead of 'level'. Now raises a clear Pydantic validation error listing the unknown field. ParserConfig.from_dict() silently filtered unknown fields. Now logs a warning with 'did you mean?' suggestions using difflib, helping users catch typos like 'dimention' -> 'dimension'. Fixes volcengine#855
|
Failed to generate code suggestions for PR |
qin-ctx
approved these changes
Mar 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Config file validation silently ignores unknown fields, causing subtle misconfigurations where users accidentally misspell field names (e.g. instead of ) without any warning.
Reported in #855
Root Cause
Two gaps in config validation:
LogConfig (Pydantic model) — Missing
extra='forbid'. In Pydantic v2, the default isextra='ignore', which silently drops unknown fields.ParserConfig (dataclass) —
from_dict()filters unknown fields without any notification.Fix
LogConfig — Added
model_config = {extra: forbid}. Now raises a clearValidationErrorlisting the unknown field when a user writes e.g.log_levelinstead oflevel.ParserConfig.from_dict() — Now logs a warning for each unknown field with 'did you mean?' suggestions via
difflib. For example:Unknown config field 'dimention' in EmbeddingModelConfig — did you mean 'dimension'?Unknown config field 'max_concurent' in SomeConfig — ignoringTesting
Why warning for dataclass configs?
Parser configs use Python dataclasses (not Pydantic), so we can't use
extra='forbid'. A warning approach is less disruptive while still surfacing the problem. TheLogConfigfix (strict error) provides the hard rejection the reporter requested for Pydantic-based configs.