Skip to content

gazelle/common: keep dangling BUILD symlinks across snapshot restore - #6438

Merged
TrapsterDK merged 1 commit into
mainfrom
fix/6214-dangling-symlink-snapshot
Nov 4, 2026
Merged

TrapsterDK merged 1 commit into
mainfrom
fix/6214-dangling-symlink-snapshot

Conversation

@TrapsterDK

Copy link
Copy Markdown
Collaborator

Closes #6214

Change

  • BuildSnapshot.Record stores the link target when the path is a dangling symlink (or a symlink to a directory), instead of recording it as absent.
  • BuildSnapshot.Restore keeps a recorded link that still points at the same target. Otherwise it removes what is there and recreates the link with os.Symlink.
  • New test TestBuildSnapshotDanglingLink covers an intact link, a removed link and a repointed link. It skips on Windows.

Checks

  • tools/dx check --apply //gazelle/common/...: passed.
  • tools/dx test //gazelle/common:common_test -- --test_filter=TestBuildSnapshot: passed.
  • tools/dx check --apply --affected failed in the resolve phase before any check ran. Cause on main: python/tests/fixtures/native_ext/BUILD.bazel loads python_py_test, which //python/rules:defs.bzl does not export. Not touched by this PR.
  • Not run: nested-Bazel and *_consumer_test targets (left to CI). Windows was not run.

Remaining

  • A write through a dangling link creates the link target file. Restore keeps an intact link and does not remove that file. Not covered here.

Assisted by Claude.

…loses #6214)

Record treated a dangling BUILD.bazel symlink as absent, so a failed run
removed the user's link. Record now stores the link target, and Restore
recreates the link only when it is missing or points elsewhere.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9TXHDZrfmzFQ2WT8QAKK
@TrapsterDK
TrapsterDK merged commit a4dc8f6 into main Nov 4, 2026
1 check failed
@TrapsterDK
TrapsterDK deleted the fix/6214-dangling-symlink-snapshot branch November 4, 2026 19:51
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.

gazelle/common: a dangling BUILD symlink survives snapshot Restore

1 participant