Skip to content

fix(runner): relink a deployed symlink that no longer points at its source - #54

Merged
garygentry merged 1 commit into
mainfrom
fix/stale-symlink-relink
Oct 11, 2026
Merged

garygentry merged 1 commit into
mainfrom
fix/stale-symlink-relink

Conversation

@garygentry

Copy link
Copy Markdown
Owner

Problem

A module whose checksums all match is skipped before deployFiles runs, so shouldDeployFile's "symlink points to wrong location" repair never fires. The checksums hash content, not where the links point.

Seen on gov: the yazi/lazygit canary (#53) installed from ~/workspace/dotfiles-worktrees/main, and that worktree was later removed. ~/.config/zsh/aliases.zsh, functions.zsh and ~/.gitmessage were left dangling. .zshrc sources them only -f, so l, .., mkcd, extract and the rest disappeared without an error. Re-running from ~/.dotfiles wouldn't repair them, because zsh/git were skipped as up-to-date. zsh verify.sh passed too: [[ -L ]] is true for a dangling link.

Fix

  • shouldRunModule: before returning Skip, staleSymlinkDest checks each type: symlink file. If the dest is a symlink to anything other than its source (dangling included), it returns ExecutionUpdateModule and deployFiles relinks it. A dest that is missing or is no longer a symlink is left as before.
  • modules/zsh/verify.sh: a dangling aliases.zsh / functions.zsh counts as an error.

Notes

  • Changing verify.sh changes the zsh module checksum, so every host re-runs zsh once after this is pinned. That's expected.
  • A module now re-runs whenever its link targets differ, which includes every run of the canary flow (worktree, then ~/.dotfiles, then worktree). That is the intended self-heal.

Testing

  • New TestShouldRunModuleStaleSymlink covers correct link, dangling link, link to another file, and absent dest. It fails without the change.
  • go test -race ./..., go vet, and shellcheck modules/zsh/verify.sh pass.

🤖 Generated with Claude Code

…ource

A module whose checksums all match was skipped before deployFiles ran, so
its "symlink points to wrong location" repair never fired. An install run
from a temporary worktree that was later deleted left
~/.config/zsh/aliases.zsh, functions.zsh and ~/.gitmessage dangling, and
every later run from ~/.dotfiles skipped zsh/git as up-to-date. The zsh
verify.sh passed too: [[ -L ]] is true for a dangling link.

shouldRunModule now returns ExecutionUpdateModule when a symlink-type
destination is a symlink to anything but its source (dangling included).
A missing or non-symlink destination is left as before. zsh verify.sh
counts a dangling aliases.zsh / functions.zsh as an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@garygentry
garygentry merged commit b00e820 into main Oct 11, 2026
4 checks passed
@garygentry
garygentry deleted the fix/stale-symlink-relink branch October 11, 2026 19:48
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