Skip to content

fix: reject apply targets that are symlinks#118

Merged
SutuSebastian merged 1 commit into
mainfrom
fix/apply-preserve-symlinks
May 20, 2026
Merged

fix: reject apply targets that are symlinks#118
SutuSebastian merged 1 commit into
mainfrom
fix/apply-preserve-symlinks

Conversation

@SutuSebastian
Copy link
Copy Markdown
Contributor

Summary

apply phase-2 used temp-file + rename over the requested path. When that path was a symlink, POSIX rename replaced the link with a regular file — silent data-loss for repos that track symlinked sources.

Fix: lstat each target before read/write; emit conflict path is a symlink and skip phase 2 for that row.

Test plan

  • Symlink link.tsreal.ts: apply reports conflict, link stays symlink, target unchanged
  • bun test src/application/apply-engine.test.ts
  • bun run typecheck
  • CI green

Phase-2 rename replaced symlink paths with regular files. Detect symlinks via lstat before read/write and report a conflict instead.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 20, 2026

🦋 Changeset detected

Latest commit: 68efefd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stainless-code/codemap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@SutuSebastian has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 47 minutes and 58 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7015cb6f-d7d8-49ac-a03c-94a393b65902

📥 Commits

Reviewing files that changed from the base of the PR and between 5ee5f2e and 68efefd.

📒 Files selected for processing (3)
  • .changeset/fix-apply-symlink-conflict.md
  • src/application/apply-engine.test.ts
  • src/application/apply-engine.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/apply-preserve-symlinks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@SutuSebastian SutuSebastian merged commit 665c19a into main May 20, 2026
12 checks passed
@SutuSebastian SutuSebastian deleted the fix/apply-preserve-symlinks branch May 20, 2026 15:25
@github-actions github-actions Bot mentioned this pull request May 20, 2026
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