Centralize TOML config deserialization (#58198)

## What changed

- Add a non-inlined `TryFrom<toml::Value>` implementation for `ConfigToml` and route callers through it to share the generated deserializer in `codex-config`.
- Reuse the ignored-field deserialization helper for strict validation, returning path-aware errors while preserving existing fallbacks for CLI validation and ignored-config warnings.

GitOrigin-RevId: 0208b314416ad4d3d7fbf3a30560a0c8c4035abd
This commit is contained in:
Dmitriy Kovalenko
2026-10-30 00:36:00 +00:00
committed by copyberry
parent 2f1e4f99e0
commit b91cedc080
6 changed files with 38 additions and 45 deletions
+2 -1
View File
@@ -663,6 +663,7 @@ fn validate_cli_overrides_strictly(
) -> io::Result<()> {
let _guard = AbsolutePathBufGuard::new(base_dir);
let ignored_path = ignored_toml_value_fields::<ConfigToml>(cli_overrides_layer.clone())
.unwrap_or_default()
.into_iter()
.chain(unknown_tui_toml_value_path(cli_overrides_layer))
.next()
@@ -1634,7 +1635,7 @@ pub fn resolve_relative_paths_in_config_toml(
}
// The typed round trip resolves AbsolutePathBuf fields against this layer's directory.
let _guard = AbsolutePathBufGuard::new(base_dir);
let Ok(resolved) = value_from_config_toml.clone().try_into::<ConfigToml>() else {
let Ok(resolved) = ConfigToml::try_from(value_from_config_toml.clone()) else {
return Ok(value_from_config_toml);
};
drop(_guard);