fix(repo): untrack node_modules symlinks that dodged the dir-only ignore pattern - #869
Open
lilyshen0722 wants to merge 1 commit into
Open
fix(repo): untrack node_modules symlinks that dodged the dir-only ignore pattern#869lilyshen0722 wants to merge 1 commit into
lilyshen0722 wants to merge 1 commit into
Conversation
…ore pattern backend/node_modules (#818) and frontend/node_modules (#867) are committed SYMLINKS pointing at an absolute path inside one operator worktree. They got past .gitignore because 'node_modules/' (trailing slash) matches only directories — a symlink named node_modules sails through 'git add -A'. Measured blast radius before this fix: - docker builds: SAFE. .dockerignore patterns are filepath.Clean'd, so 'node_modules/' excludes the symlink from the context (verified empirically with positive+negative controls; the live backend image at e55f0c2 was already built from a symlink-carrying tree and succeeded). - CI: SAFE. npm ci removes the symlink before installing; PR checks on both carrier PRs passed. - every other checkout: NOT safe. 'git pull' exits 0 and silently replaces a real, populated node_modules directory with the dangling symlink (ignored files are expendable to checkout — reproduced in a scratch repo). On the one machine where the target resolves, everything silently uses a May-24 worktree's dependencies instead of the tree's own: version skew with no error anywhere. Fix: untrack both symlinks (git rm --cached — the author's local links are untouched) and drop the trailing slash so the pattern matches the symlink form too. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two committed symlinks are on
main, both pointing at absolute paths inside one operator worktree (.claude/worktrees/sprint-2026-05-24-installable-projection/…):backend/node_modulesfrontend/node_modulesWhy gitignore didn't stop them
.gitignore:7isnode_modules/— the trailing slash makes it directory-only. A symlink namednode_modulesis not a directory to the matcher, sogit add -Apicks it up. (Docker's ignore file is immune to the same trap because itfilepath.Cleans patterns, stripping the slash.)Measured blast radius (each claim executed, not inferred)
.dockerignorenode_modules/present the symlink isCTX-EXCLUDED; without it,CTX-PRESENT. Production-scale corroboration: the live backend image (e55f0c21, deployed 01:27Z tonight) was built from a symlink-carrying tree and succeeded — the failure mode (COPY . .clobbering/app/node_modulesbeforenpx tsc) is loud and did not fire.npm ciremoves the entry before installing; both carrier PRs passed checks.git pullexits 0 and silently replaces a real, populatednode_modulesdirectory with the dangling symlink (ignored paths are expendable to checkout). Next build/test in that tree fails with missing modules — or, on the one machine where the target resolves, silently runs against a May-24 worktree's dependencies: version skew with no error anywhere.Fix
git rm --cachedboth symlinks (the author's local links are untouched — only the index entry is removed)..gitignore: drop the trailing slash with a same-file comment naming the defect, so the pattern matches file, dir, and symlink forms and the nextgit add -Acan't re-commit one.Not done here
.dockerignorechanges — verified already safe, and touching them would change a working exclusion.AGENTS.md,.agents/skills,.claude/skills) are untouched.🤖 Generated with Claude Code