You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(github): use the singular when one stack layer rebases before an error - #45680
When a GitHub stack rebase ("Update branch" from the stack menu) fails after exactly one layer was updated, the "Could not rebase the stack" toast says 1 layers were rebased. Both cascade error messages hard-code the plural, and GitHubStackRebaseFailedError forwards that message unchanged to the client.
Git failure: in packages/source-control-github, run vp test run src/server/githubStackRebase.test.ts -t "refuses to overwrite a layer pushed after it was reviewed". This uses the existing two-layer real-git fixture, where the push of PR Add open-in-editor feature with Cmd+O shortcut #2 is rejected after PR oxc stack #1 is rebased (completed: 1).
Conflict through the stack action wrapper: run vp test run src/server/githubStackActions.test.ts -t "reports one rebased layer in the singular". Here the second layer's rebase exits non-zero (completed: 1).
Observed: Stack rebase stopped at PR #2 while pushing. 1 layers were rebased. and PR #3 conflicts with the layer below it. 1 layers were rebased; resolve #3 with \gh stack rebase` and push.`
Expected: 1 layer was rebased. Counts of 0 or 2+ keep layers were rebased.
Change
A small shared rebasedLayers(completed) helper in githubStackRebase.ts picks the singular for 1. Both the Git and conflict formatters use it. The stack action wrapper, provider, RPC and web/mobile clients all show this server-built message, so this one change fixes every surface. No translated client copy changes.
Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
Base 58a4e599629d: both regression cases fail with Expected: "... 1 layer was rebased ...", Received: "... 1 layers were rebased ...".
Head: vp test run src/server/githubStackActions.test.ts src/server/githubStackRebase.test.ts gives 14/14 passing. vp run check:changed exits 0 (format, lint, knip, graphql, typecheck, tests).
Runtime transcript (base vs head): https://gist.github.com/saphid/d2bca7092606553a80b43275395cfaac. It builds the real GitHubStackRebaseGitError/GitHubStackRebaseConflictError, wraps each in the real GitHubStackRebaseFailedError, then in the RPC PullRequestOperationError, and prints the toast description the web client derives from it. Base prints 1 layers were rebased. Head prints 1 layer was rebased, and 2 layers were rebased is unchanged.
Not shown: no screenshot of the toast against a live GitHub stack, because that needs a real multi-PR GitHub stack with a forced push rejection or conflict. The toast description is the server message unchanged (see path above). The GitHubStackRebaseFailedError fallback text is also not covered: it only appears when the cause has no message, and these causes always have one.
Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).
Not shown
packages/source-control-github/src/server/githubStackActions.test.ts:368 — The draft’s base repro omits that the regression test and the new assertion in githubStackRebase.test.ts must be applied to 58a4e59 without the production fix. Say so explicitly: the commands alone do not reproduce the failure on untouched main, and they are package tests rather than a scenarios:prove app scenario.
apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx:184 — The draft overstates mobile coverage: mobile sends stack-scoped merge actions but does not expose stack-scoped Update branch. Say the shared server fix covers callers of the stack rebase RPC, and name web/desktop as the current UI entry points.
Macroscope's review found this PR approvable — Updates stack-rebase error messages to use singular wording when exactly one layer was rebased. The change affects message presentation without changing rebase behavior.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review.
Walkthrough
Rebase error messages now say “1 layer was rebased” when exactly one layer completed. Tests verify this wording for rebase conflicts and stale-push errors.
Changes: Rebase error wording
Layer / File(s)
Summary
Format and verify completed-layer messages packages/source-control-github/src/server/githubStackRebase.ts, packages/source-control-github/src/server/githubStackActions.test.ts, packages/source-control-github/src/server/githubStackRebase.test.ts
A shared formatter uses singular wording when exactly one layer completed and plural wording otherwise. Tests check the message for conflict and stale-push cases.
This change fixes the grammar of stack-rebase error messages when exactly one layer was rebased. It has no apparent functional or production risk and is ready to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: when exactly one stack layer is rebased before a stack-rebase error, the message uses the singular "1 layer was rebased". It follows the conventional commit form and i…
Description check
The description covers the problem, the change, scope, and verification, so it follows the template's sections. It states the problem and reproduction steps, explains the shared rebasedLayers helper, …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: when exactly one stack layer is rebased before a stack-rebase error, the message uses the singular "1 layer was rebased". It follows the conventional commit form and is specific to the changeset (githubStackRebase.ts helper and tests).
Full details: Description check
Explanation
The description covers the problem, the change, scope, and verification, so it follows the template's sections. It states the problem and reproduction steps, explains the shared rebasedLayers helper, and links an issue-free scope justification with a small-fix rationale. Verification lists the base and head test results, the check:changed run, and a runtime transcript, and it states what was not checked (live GitHub toast screenshot, fallback text). The template's 'Authored by' line is present as the agent attribution. Minor gap: the reviewer notes flag that the base repro needs the regression tests applied to 58a4e59 without the fix, which the description does not state explicitly.
Resolution
Optional: state explicitly that the two regression tests and their new assertions must be applied to base 58a4e59 without the production fix, since the commands alone do not reproduce the failure on untouched main. Also narrow the mobile claim: mobile does not expose stack-scoped Update branch, and web and desktop are the current UI entry points.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
This branch has not been deployed
No deployments
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
size:XS0-9 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
1 participant
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.
Problem
When a GitHub stack rebase ("Update branch" from the stack menu) fails after exactly one layer was updated, the "Could not rebase the stack" toast says
1 layers were rebased. Both cascade error messages hard-code the plural, andGitHubStackRebaseFailedErrorforwards that message unchanged to the client.Deterministic repro on
origin/main(58a4e599629d)PullRequestStackMenu→runActionRPC withstackNumber→PullRequestService.runAction→GitHubPullRequestApi→runGitHubStackAction→cascadeRebaseStack→GitHubStackRebaseFailedError(forwards the cause'smessage) →GitHubPullRequestProvidersetsPullRequestProviderError.detail = error.message→PullRequestOperationError→ toast description viareadableFailure.packages/source-control-github, runvp test run src/server/githubStackRebase.test.ts -t "refuses to overwrite a layer pushed after it was reviewed". This uses the existing two-layer real-git fixture, where the push of PR Add open-in-editor feature with Cmd+O shortcut #2 is rejected after PR oxc stack #1 is rebased (completed: 1).vp test run src/server/githubStackActions.test.ts -t "reports one rebased layer in the singular". Here the second layer's rebase exits non-zero (completed: 1).Stack rebase stopped at PR #2 while pushing. 1 layers were rebased.andPR #3 conflicts with the layer below it. 1 layers were rebased; resolve #3 with \gh stack rebase` and push.`1 layer was rebased. Counts of 0 or 2+ keeplayers were rebased.Change
A small shared
rebasedLayers(completed)helper ingithubStackRebase.tspicks the singular for 1. Both the Git and conflict formatters use it. The stack action wrapper, provider, RPC and web/mobile clients all show this server-built message, so this one change fixes every surface. No translated client copy changes.Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
58a4e599629d: both regression cases fail withExpected: "... 1 layer was rebased ...",Received: "... 1 layers were rebased ...".vp test run src/server/githubStackActions.test.ts src/server/githubStackRebase.test.tsgives 14/14 passing.vp run check:changedexits 0 (format, lint, knip, graphql, typecheck, tests).GitHubStackRebaseGitError/GitHubStackRebaseConflictError, wraps each in the realGitHubStackRebaseFailedError, then in the RPCPullRequestOperationError, and prints the toast description the web client derives from it. Base prints1 layers were rebased. Head prints1 layer was rebased, and2 layers were rebasedis unchanged.Not shown: no screenshot of the toast against a live GitHub stack, because that needs a real multi-PR GitHub stack with a forced push rejection or conflict. The toast description is the server message unchanged (see path above). The
GitHubStackRebaseFailedErrorfallback text is also not covered: it only appears when the cause has no message, and these causes always have one.Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).
Not shown