Skip to content

fix: allow omitted query map fields in config deserialization#645

Merged
gifnksm merged 3 commits into
mainfrom
fix/config-query-defaults
Apr 1, 2026
Merged

fix: allow omitted query map fields in config deserialization#645
gifnksm merged 3 commits into
mainfrom
fix/config-query-defaults

Conversation

@gifnksm
Copy link
Copy Markdown
Owner

@gifnksm gifnksm commented Apr 1, 2026

Summary

Fix config deserialization so query.scheme_alias and query.custom_scheme can be omitted from config files without causing parse failures.

Problem

With a config containing a [query] section but missing scheme_alias, souko failed to parse config with:

  • missing field 'scheme_alias' in 'query'

Changes

  • In src/presentation/config/query.rs, added #[serde(default)] to fields in ConfigRepr:
    • scheme_alias
    • custom_scheme

This allows missing fields to deserialize as empty maps, after which existing defaults/merge behavior in QueryConfig::deserialize continues to work as intended.

Tests

Added regression coverage under presentation::config::tests in src/presentation/config/mod.rs:

  • deserialize_query_without_scheme_alias_applies_overrides_and_merges_defaults
  • deserialize_query_without_custom_scheme_keeps_default_schemes

These tests deserialize nested [query] / [query.custom_scheme] TOML shape and verify effective query parsing behavior after merge.

Validation

  • Ran cargo test successfully.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.09%. Comparing base (a6fc33d) to head (de7ea4d).
⚠️ Report is 4 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)] to ConfigRepr.scheme_alias and ConfigRepr.custom_scheme so missing fields deserialize as empty maps.
  • Added a regression test covering deserialization when scheme_alias is omitted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/presentation/config/query.rs Outdated
Comment thread src/presentation/config/query.rs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/presentation/config/query.rs Outdated
Comment thread src/presentation/config/query.rs Outdated
Comment thread src/presentation/config/query.rs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/presentation/config/mod.rs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gifnksm gifnksm merged commit a453680 into main Apr 1, 2026
61 checks passed
@gifnksm gifnksm deleted the fix/config-query-defaults branch April 1, 2026 14:23
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.

2 participants