Skip to content

fix(config): preserve symlinked ~/.config/aube/config.toml on write#605

Merged
jdx merged 1 commit into
mainfrom
claude/cranky-merkle-ca0c87
May 11, 2026
Merged

fix(config): preserve symlinked ~/.config/aube/config.toml on write#605
jdx merged 1 commit into
mainfrom
claude/cranky-merkle-ca0c87

Conversation

@jdx

@jdx jdx commented May 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • aube config set/delete wrote into a sibling temp file and renamed it over the path, which replaced a symlinked ~/.config/aube/config.toml with a regular file
  • Resolve the symlink target before calling atomic_write, mirroring the fix #517 shipped for ~/.npmrc
  • Expose symlink_target_or_self as pub(crate) in npmrc.rs so aube_config.rs can reuse it without duplicating

Closes #603.

Test plan

  • cargo test -p aube commands::config::aube_config — new save_preserves_symlink test passes
  • cargo test -p aube commands::npmrc::tests::save_preserves_symlink — existing npmrc symlink test still passes
  • cargo clippy -p aube --all-targets -- -D warnings
  • cargo fmt --check

🤖 Generated with Claude Code


Note

Low Risk
Low risk: narrowly changes the write path resolution for aube config saves and adds a Unix-only regression test; behavior for non-symlink paths should remain unchanged.

Overview
aube config writes now preserve a symlinked ~/.config/aube/config.toml by resolving path to its symlink target before calling atomic_write, avoiding replacing the symlink with a regular file during rename-based atomic saves.

The existing npmrc helper symlink_target_or_self is made pub(crate) for reuse, and a Unix-only test is added to assert symlink preservation and correct content updates.

Reviewed by Cursor Bugbot for commit 99215e3. Bugbot is set up for automated code reviews on this repo. Configure here.

`aube config set/delete` wrote into a sibling temp and renamed it
over the path, which replaced a symlinked config.toml with a regular
file. Follow the symlink target before atomic_write, matching the
fix #517 applied to ~/.npmrc.

Closes #603

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes aube config set/delete silently replacing a symlinked ~/.config/aube/config.toml with a regular file by resolving the symlink target via symlink_target_or_self before calling atomic_write, mirroring the identical fix previously applied to ~/.npmrc in #517.

  • aube_config.rs: calls symlink_target_or_self(path) before atomic_write so the rename lands on the real file rather than clobbering the symlink; error message now reports the resolved path.
  • npmrc.rs: symlink_target_or_self visibility widened to pub(crate) — no logic change.
  • New #[cfg(unix)] test save_preserves_symlink in aube_config.rs verifies the symlink is intact and the real file is updated after a save.

Confidence Score: 5/5

Safe to merge — a narrow, well-tested fix that adds no new code paths beyond what already exists for npmrc.

The change is a two-line fix with a direct regression test. symlink_target_or_self already handles the non-symlink and non-existent-path cases correctly, and canonicalize on a dangling symlink will surface a clear error rather than silently writing to the wrong location. The only behavioral difference on the error path is that the wrap_err message now shows the resolved path instead of the original, which is a net improvement for debuggability.

No files require special attention.

Important Files Changed

Filename Overview
crates/aube/src/commands/config/aube_config.rs Resolves symlink before atomic_write to preserve user-managed symlinks; adds a Unix-gated regression test that covers the exact failure mode.
crates/aube/src/commands/npmrc.rs Visibility of symlink_target_or_self widened from private to pub(crate) so aube_config.rs can reuse it without duplication; no logic change.

Reviews (1): Last reviewed commit: "fix(config): preserve symlinked ~/.confi..." | Re-trigger Greptile

@jdx jdx merged commit 6fc2222 into main May 11, 2026
19 checks passed
@jdx jdx deleted the claude/cranky-merkle-ca0c87 branch May 11, 2026 15:19
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