Skip to content

fix(github): use the singular when one stack layer rebases before an error - #45680

Open
saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:hunter/c-afdcdee8a0
Open

saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:hunter/c-afdcdee8a0

Conversation

@saphid

@saphid saphid commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

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, and GitHubStackRebaseFailedError forwards that message unchanged to the client.

Deterministic repro on origin/main (58a4e599629d)

  • Client path: PullRequestStackMenu → runAction RPC with stackNumber → PullRequestService.runAction → GitHubPullRequestApi → runGitHubStackAction → cascadeRebaseStack → GitHubStackRebaseFailedError (forwards the cause's message) → GitHubPullRequestProvider sets PullRequestProviderError.detail = error.message → PullRequestOperationError → toast description via readableFailure.
  • 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.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 29, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 144c0ce

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.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 144c0

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 58a4e59 and 144c0ce.

Files selected for processing: 3

  • packages/source-control-github/src/server/githubStackActions.test.ts
  • packages/source-control-github/src/server/githubStackRebase.test.ts
  • packages/source-control-github/src/server/githubStackRebase.ts

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant