Skip to content

fix(prepare): Keep dry-run version bumps in the worktree - #954

Merged
BYK merged 2 commits into
masterfrom
fix/dry-run-bump-worktree
Nov 2, 2026
Merged

BYK merged 2 commits into
masterfrom
fix/dry-run-bump-worktree

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #953.

craft prepare --dry-run with automatic version bumping wrote the bump into the user's checkout, not the temporary worktree. So the next dry run computed a higher version.

The cause: findConfigFile() cached the original checkout's .craft.yml path from before isolation. After the dry run moved into the worktree, getReleaseUnitDir() still resolved to the original checkout, and npm version ran there. Worktree mode allowed it.

Changes:

  • findConfigFile() now caches per working directory, so the config path is found again after the dry run moves into or out of the worktree.
  • createDryRunIsolation() now moves into the worktree directory that matches the original working directory, not the worktree root. Without this, a .craft.yml in a subdirectory would not be found once the cache stops hiding the mismatch. Dependency symlinks go to the same place.
  • Cleanup deletes local branches the dry run created. The worktree shares refs with the checkout, so release/<version> stayed behind. Once both runs compute the same version, the second dry run would fail with "Branch already exists".

The new e2e test runs an automatic npm workspace bump twice. It checks that both runs compute the same version, that package.json and git status stay unchanged, and that no release branch is left. The existing worktree test now checks that the release branch is removed, where it used to note that the branch may stay. I checked both behaviors by hand with the built binary: workspace config and subdirectory config, run twice each. I could not run the e2e suite locally because a sandbox git hook rejects its test author identity, so CI is the first full run.

via @BYK.

--

View Session in Sentry

Fixes #953

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0de3e53. Configure here.

Comment thread src/utils/dryRun.ts Resolved
@BYK
BYK merged commit 2598a8f into master Nov 2, 2026
28 checks passed
@BYK
BYK deleted the fix/dry-run-bump-worktree branch November 2, 2026 14:07

This branch was previously deployed

1 inactive deployment
false — 11cd5090 Deployed Nov 2, 2026 by sentry-junior[bot] via Build #3285
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.

prepare --dry-run writes automatic version bumps into the original checkout

1 participant