Repository navigation
fix(pr): publish when the migration branch is already on GitHub - #120
Merged
Merged
Conversation
UPT-19 Closing a pull request does not delete its branch, so a later run found uptide/<pkg>-<version> on origin and its plain push was rejected: a verified migration with no PR. Now the branch is reused when it holds only Uptide's commits beyond the base (the App's bot or the legacy uptide[bot]), replaced with --force-with-lease against what was just read; an open Uptide PR on it gets the new description instead of a second PR. A branch with anyone else's commit is never overwritten: the run goes to the next free <branch>-2, -3, ... and the PR body says so. Authors are read from GitHub's compare, since the Action's checkout is shallow. When publishing fails, `uptide pr --json` emits a reason Uptide composed, and the Action's report and job summary name it instead of "the job log has the reason". Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EBZ9skzRkmHe3mYSxTVzyN Signed-off-by: Claude <[email protected]>
Merged
lucasbraum
pushed a commit
that referenced
this pull request
Oct 14, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## [email protected] ### Patch Changes - [#118](#118) [`40b3c1f`](40b3c1f) Thanks [@lucasbraum](https://github.com/lucasbraum)! - The onboarding generator (`uptide/onboarding`, the "Add Uptide" pull request) writes `minReleaseAgeDays` to `uptide.yml`, with a comment, when the settings set it. Before, the setting was kept in the returned config but left out of the file. - [#117](#117) [`d1e7388`](d1e7388) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Let packs inspect declared config and convention files without imports and apply verified multi-file create, delete, write and rename transactions. - [#116](#116) [`4419673`](4419673) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Allow migration packs to require a successful repository build before publication, including subsequent verification runs. - [#120](#120) [`b7e0f42`](b7e0f42) Thanks [@lucasbraum](https://github.com/lucasbraum)! - `uptide pr` (and `fix --pr`) publishes when the migration branch is already on GitHub, as it is after a pull request was closed without merging. A branch holding only Uptide's commits is replaced with `--force-with-lease`, and an open Uptide pull request on it is updated instead of a second one being opened. A branch with anyone else's commit is never overwritten: the run goes to the next free `<branch>-2`, `-3`, … and the pull request says so. When publication fails in the Action, the job summary and run report name the reason. - [#115](#115) [`17cb9a2`](17cb9a2) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Support explicit pack release groups so installed lockstep companions move with their lead even without dependency edges or incompatible peers. Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.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 and why
UPT-19
Closing a pull request does not delete its branch. When a later run found
uptide/<pkg>-<version>already on origin, its plain push was rejected, so a verified migration got no PR. In a real run,fix stripeverified the migration (types 0 → 4 → 0, tests pass) but could not open the PR becauseuptide/stripe-23.0.0was still there from a closed PR.What publishing does now when the branch already exists (
packages/core/src/fix/publish.ts):uptide[bot]. A person's identity never counts, not even the local user's. The branch is replaced with--force-with-leaseagainst the commit just read. If an open Uptide PR uses the branch, its description is refreshed and no second PR is opened. If none is open, a new PR is opened.<branch>-2,-3, … under the same rules, and the PR body opens with a line naming the branch left alone and whose commits are on it.gh api repos/<repo>/compare/<base>...<sha>), because the Action's checkout is shallow. Read locally, main's older history would look like someone else's commits.When publication fails,
uptide pr --jsonnow emits{ error: { code, reason } }. The reason is a sentence Uptide composes, never git or GitHub output. The Action puts it in the report and the job summary, e.g. "verified, but the pull request could not be opened: the branch on GitHub changed while it was being published", instead of "the job log has the reason".How it was verified
packages/core/src/fix/publish-branch.test.tsruns real git against a bare-repo origin. The run's checkout is a shallow clone like the Action's, and main moves on after the old branch was made. Onlyghis faked; its compare answers come from the origin itself. Cases:uptide[bot], is replaced and a new PR is opened;-3, because-2holds a person's commit under a bot commit. The body says so, and a re-run is idempotent;Five of the six fail against the previous
publish.ts.action/run.test.ts: aPublishFailurereason reaches the upgrade'serrorandrenderSummary, and the report stays schema-valid.cli.test.ts:pr --jsonemits the reason, and the full error still goes to stderr.pnpm lint && pnpm typecheck && pnpm testpass. The one lint warning, inreport.test.ts, was already onmain.Checklist
pnpm lint && pnpm typecheck && pnpm testpassdocs/commands/pr.md)pnpm changeset)--yes, and the publish step only fetches what GitHub's API reports; it writes no ref in the user's checkout.🤖 Generated with Claude Code
https://claude.ai/code/session_01EBZ9skzRkmHe3mYSxTVzyN
Generated by Claude Code