Skip to content

fix(config): add #[serde(default)] to partial config sections#1544

Open
CtriXin wants to merge 1 commit intortk-ai:masterfrom
CtriXin:fix/issue-1482-toml-defaults
Open

fix(config): add #[serde(default)] to partial config sections#1544
CtriXin wants to merge 1 commit intortk-ai:masterfrom
CtriXin:fix/issue-1482-toml-defaults

Conversation

@CtriXin
Copy link
Copy Markdown

@CtriXin CtriXin commented Apr 26, 2026

Summary

Partial TOML config sections like [limits] now parse correctly when only some fields are specified.

Root cause: Without #[serde(default)], missing fields in a TOML section cause toml::from_str to return a missing field error. This bubbles up to Config::load(), which silently falls back to full defaults — discarding every user-specified override.

Fix: Added #[serde(default)] to five sub-config structs: TrackingConfig, DisplayConfig, FilterConfig, TelemetryConfig, LimitsConfig. Each already implements Default with correct values, so serde now falls back to those defaults for any missing fields.

Fixes: #1482

Test Plan

  • cargo test config — 14 tests pass
  • Manual: [limits] with only grep_max_results = 500 applies correctly

Partial TOML sections like `[limits]` now parse correctly when only
some fields are specified. Without #[serde(default)], missing fields
caused a parse error that silently discarded the entire section.

Added #[serde(default)] to: TrackingConfig, DisplayConfig,
FilterConfig, TelemetryConfig, LimitsConfig.

Fixes: rtk-ai#1482
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@pszymkowiak pszymkowiak added bug Something isn't working effort-small Quelques heures, 1 fichier good first issue Good for newcomers labels Apr 26, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Adds #[serde(default)] to five partial config structs (TrackingConfig, DisplayConfig, FilterConfig, TelemetryConfig, LimitsConfig) so that TOML sections with only some fields specified parse correctly instead of causing a missing field error that silently falls back to full defaults, discarding user overrides.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #1482


Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort-small Quelques heures, 1 fichier good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial TOML Sub-Config Sections Silently Fall Back to Full Defaults

4 participants