fix: allow omitted query map fields in config deserialization#645
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #645 +/- ##
==========================================
+ Coverage 82.57% 84.09% +1.52%
==========================================
Files 31 31
Lines 1699 1742 +43
Branches 1699 1742 +43
==========================================
+ Hits 1403 1465 +62
+ Misses 233 212 -21
- Partials 63 65 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes config deserialization for the query configuration so that scheme_alias and custom_scheme can be omitted without causing TOML parse failures, relying on default empty maps and existing merge-with-default behavior.
Changes:
- Added
#[serde(default)]toConfigRepr.scheme_aliasandConfigRepr.custom_schemeso missing fields deserialize as empty maps. - Added a regression test covering deserialization when
scheme_aliasis omitted.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Fix config deserialization so
query.scheme_aliasandquery.custom_schemecan be omitted from config files without causing parse failures.Problem
With a config containing a
[query]section but missingscheme_alias, souko failed to parse config with:missing field 'scheme_alias' in 'query'Changes
src/presentation/config/query.rs, added#[serde(default)]to fields inConfigRepr:scheme_aliascustom_schemeThis allows missing fields to deserialize as empty maps, after which existing defaults/merge behavior in
QueryConfig::deserializecontinues to work as intended.Tests
Added regression coverage under
presentation::config::testsinsrc/presentation/config/mod.rs:deserialize_query_without_scheme_alias_applies_overrides_and_merges_defaultsdeserialize_query_without_custom_scheme_keeps_default_schemesThese tests deserialize nested
[query]/[query.custom_scheme]TOML shape and verify effective query parsing behavior after merge.Validation
cargo testsuccessfully.