Skip to content

fix(config): add serde(default) to TeeConfig fields#843

Open
fkztw wants to merge 1 commit intortk-ai:developfrom
fkztw:fix/tee-config-serde-default
Open

fix(config): add serde(default) to TeeConfig fields#843
fkztw wants to merge 1 commit intortk-ai:developfrom
fkztw:fix/tee-config-serde-default

Conversation

@fkztw
Copy link

@fkztw fkztw commented Mar 26, 2026

Summary

  • TeeConfig fields lack #[serde(default)], causing the entire Config deserialization to fail when users specify a [tee] section in config.toml but omit some fields (e.g. max_file_size)
  • Since call sites use Config::load().map(...).unwrap_or_default() to silently handle errors, all user settings (including hooks.exclude_commands) are silently ignored with no warning
  • Add #[serde(default = "...")] to every TeeConfig field so partial [tee] sections deserialize correctly
  • Add tests for partial and empty deserialization

Reproduction

# ~/.config/rtk/config.toml (Linux) or ~/Library/Application Support/rtk/config.toml (macOS)
[hooks]
exclude_commands = ["curl", "helm"]

[tee]
enabled = true
mode = "failures"
max_files = 20
# max_file_size is omitted — this causes the ENTIRE config to fail silently
$ rtk config
Config: ~/Library/Application Support/rtk/config.toml

Error: TOML parse error at line 35, column 1
   |
35 | [tee]
   | ^^^^^
missing field `max_file_size`

When rtk config is not called directly, Config::load() fails silently and falls back to defaults — all user settings are ignored without any warning.

Test plan

  • cargo fmt --all --check — passed
  • cargo clippy --all-targets — no new warnings
  • cargo test --all — 1116 passed, 3 ignored
  • New test_tee_config_partial_deserialize — verifies omitting max_file_size does not fail
  • New test_tee_config_empty_deserialize — verifies a completely empty [tee] section uses defaults

🤖 Generated with Claude Code

@CLAassistant
Copy link

CLAassistant commented Mar 26, 2026

CLA assistant check
All committers have signed the CLA.

@fkztw fkztw changed the base branch from master to develop March 26, 2026 05:01
… parse failure

When users specify a partial [tee] section in config.toml (e.g. omitting
max_file_size), the entire Config fails to deserialize. Because Config::load()
errors are silently swallowed by unwrap_or_default() at call sites, all user
settings (including hooks.exclude_commands) are silently ignored with no
warning.

Add #[serde(default = "...")] to every TeeConfig field so partial [tee]
sections work correctly. Add tests for partial and empty deserialization.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fkztw fkztw force-pushed the fix/tee-config-serde-default branch from 11b6bd9 to c5a3fd2 Compare March 26, 2026 05:02
@aeppling
Copy link
Contributor

Hey

We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes src/ from a flat layout into subfolders.

No logic changes — only file moves and import path updates.

What you need to do

Rebase your branch on develop when receiving this comment:

git fetch origin && git rebase origin/develop

Git detects renames automatically. If you get import conflicts, update the paths:

use crate::git;        // now: use crate::cmds::git::git;
use crate::tracking;   // now: use crate::core::tracking;
use crate::config;     // now: use crate::core::config;
use crate::init;       // now: use crate::hooks::init;
use crate::gain;       // now: use crate::analytics::gain;

Need help rebasing? Tag @aeppling

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.

3 participants