Skip to content

fix(#295): Rebase worktrees onto main before PR to prevent lockfile drift - #301

Merged
admarble merged 2 commits into
mainfrom
feature/295-fix-rebase-worktrees-onto-main-before-pr-to-preven
Feb 19, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/295-fix-rebase-worktrees-onto-main-before-pr-to-preven

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Adds pre-PR rebase onto origin/main for worktree branches to prevent lockfile drift
  • After rebase, detects lockfile changes (ORIG_HEAD..HEAD) and reinstalls dependencies automatically
  • Chain mode: only rebases the final branch (intermediate branches stay based on predecessor)
  • Handles rebase conflicts gracefully (abort, warn, continue)
  • Adds --no-rebase CLI flag for manual workflows

Closes #295

Supersedes #297 (closed due to branch conflict resolution)

Test plan

  • 10 unit tests covering rebaseBeforePR, reinstallIfLockfileChanged, and lockfile detection
  • Build passes on all Node.js versions (18, 20, 22)
  • All 1260 tests pass
  • QA reviewed: READY_FOR_MERGE

…rift

- Add pre-PR rebase step: worktree branches are rebased onto origin/main
  before PR creation (AC-1, AC-2)
- Add lockfile change detection: after rebase, if any lockfile changed
  (package-lock.json, pnpm-lock.yaml, bun.lock, yarn.lock), dependencies
  are automatically reinstalled (AC-3)
- Handle rebase conflicts gracefully: on conflict, abort rebase, warn user,
  and continue with original branch state (AC-4)
- Add --no-rebase flag to skip pre-PR rebase when manual handling preferred (AC-5)
- Add tests for rebaseBeforePR and reinstallIfLockfileChanged functions

Closes #295
… detection

Two QA gaps fixed:

AC-2: In chain mode, only the last issue now triggers rebaseBeforePR.
Intermediate branches stay based on their predecessor, preserving the
chain structure. Added isLastInChain parameter to runIssueWithLogging.

AC-3: Lockfile change detection now uses ORIG_HEAD..HEAD instead of
HEAD~1. After a multi-commit rebase, ORIG_HEAD captures all changes
the rebase introduced (including lockfile updates from main that
appeared in the base, not in replayed commits).

Also replaced tautological lockfile detection test with one that
verifies the correct git ref is used.
@admarble
admarble merged commit 7d0f6c6 into main Feb 19, 2026
6 checks passed
@admarble
admarble deleted the feature/295-fix-rebase-worktrees-onto-main-before-pr-to-preven branch February 19, 2026 20:09
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.

fix: Rebase worktrees onto main before PR to prevent lockfile drift

1 participant