Repository navigation
Conversation
Five sub-config structs (TrackingConfig, DisplayConfig,
FilterConfig, TelemetryConfig and LimitsConfig) don't have
#[serde(default)], so any TOML section that omits a field
fails to parse with a "missing field" error. The error
bubbles up to Config::load, and helpers like limits() call
.unwrap_or_default() on the Result, which silently swaps in
the full default config and throws away every user override.
Say someone writes this:
[limits]
grep_max_results = 500
They expect grep_max_results to be 500 with the rest of the
limits at their defaults. What they actually get is
grep_max_results back at 200 because the partial section
never parsed in the first place.
The fix is to add struct-level #[serde(default)] to each of
the five structs. Every one of them already has a Default
impl with the correct domain values, so the attribute just
delegates to what's already there. No logic moves, no
behaviour changes for fully specified configs, and partial
sections now do what users expect.
Collaborator
📊 Automated PR Analysis
SummaryAdds Review Checklist
Linked issues: #1482 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
1 of 2 tasks
1 task done
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.
Summary
Fixes #1482.
TrackingConfig,DisplayConfig,FilterConfig,TelemetryConfigandLimitsConfig) don't have#[serde(default)], so any partial TOML section fails to parse withmissing field.Config::loadreturns the error, helpers likeconfig::limitscall.unwrap_or_default(), and the user's explicit overrides are silently replaced by the full default config.#[serde(default)]to each of the five structs. Every one of them already implementsDefaultwith the correct domain values, so the attribute delegates to what's already there. No logic changes, no duplicated defaults, backward compatible with fully specified configs.Test plan
cargo fmt --all --check && cargo clippy --all-targets && cargo test: 1684 passed, 0 failed.src/core/config.rs::tests:test_partial_tracking_section_uses_defaultstest_partial_display_section_uses_defaultstest_partial_filters_section_uses_defaultstest_partial_telemetry_section_uses_defaultstest_partial_limits_section_uses_defaultstest_full_limits_section_roundtrip(regression guard for fully specified sections)Files Changed
src/core/config.rs#[serde(default)]to five sub-config structs; add six parsing tests.Related
[telemetry]vs[tracking]. The reporter's second example (partial config) was the real bug but never got addressed.masterinstead ofdevelop. This PR is a clean resubmission againstdevelop.Co-Authored-By AI (Claude Opus 4.7) via Pi