Skip to content

refactor(config): remove dead save_config function#287

Merged
sachiniyer merged 1 commit intomainfrom
siyer/remove-dead-save-config
May 9, 2026
Merged

refactor(config): remove dead save_config function#287
sachiniyer merged 1 commit intomainfrom
siyer/remove-dead-save-config

Conversation

@sachiniyer
Copy link
Copy Markdown
Contributor

Summary

  • Deletes the unused save_config function in src/config/storage.rs and its dedicated save_then_load_config round-trip test.
  • Updates concurrent_update_config_does_not_corrupt to seed the config file with update_config(|_| {}) instead of save_config(&Config::default()).
  • Closes Detail bug bug_3b5a0cd5-08da-482d-b222-ce83e5acb944 (linked GH [Detail Bug] Config writes can lose existing data due to truncation before file lock in save_config #269), which reported a truncate-before-lock race in save_config. Fixing the race isn't worth it since the function has no production callers — grep -rn save_config --include='*.rs' showed only the function definition and two #[cfg(test)] sites in the same file.

Note for reviewers

save_config is pub, and although Cargo.toml only declares a [[bin]], the crate also has src/lib.rs, so Cargo auto-builds a library and detail_cli::config::storage::save_config was technically part of the library's public API. We don't publish to crates.io and there are no other consumers of this crate's library surface that we know of, but flagging in case you want to weigh that.

Test plan

  • cargo test — all 289 lib + 17 integration tests pass
  • grep -rn save_config --include='*.rs' returns no matches after the change
  • concurrent_update_config_does_not_corrupt still passes with the new init line

🤖 Generated with Claude Code

Drop save_config and its dedicated round-trip test. The function had no
production callers — the only references were two #[cfg(test)] sites in
the same file. Closes Detail bug bug_3b5a0cd5 / GH issue #269 (truncate-
before-lock race in save_config) by removing the function rather than
fixing the race.

The concurrent_update_config_does_not_corrupt test now seeds the config
file with update_config(|_| {}) instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sachiniyer sachiniyer temporarily deployed to integration-tests May 9, 2026 03:04 — with GitHub Actions Inactive
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@sachiniyer sachiniyer merged commit b7d3284 into main May 9, 2026
13 checks passed
@sachiniyer sachiniyer deleted the siyer/remove-dead-save-config branch May 9, 2026 04:04
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.

1 participant