fix(trpc,mobile): resolve the default branch server-side, paginate branch listing
Merged
SA
3mo ago+25+25+01234567890123456789-8-8-0123456789
Summary
- Follow-ups to #6651 from CodeRabbit's review (which landed after merge):
cloudWorkspace.create'sbranchis now optional; when omitted the server resolves the repo's actual default viarepoForProjectinstead of a client guessing"main". The mobile create hook now omits the branch when its query hadn't resolved.listRemoteBranchespaginates (up to 10 × 100, early exit on a short page) — a single request made everything past the first hundred branches unfindable, and this repo alone exceeds that.
Testing
bunx tsc --noEmit(trpc, mobile)bun run lint- Behavior change is server-side fallback + pagination; exercised the same code paths against the local API in #6651's verification.
Summary by cubic
Resolve the default branch server-side and paginate branch listing to avoid missing branches. Previously, mobile guessed "main" for cloudWorkspace.create when branch was unresolved and the server listed only the first 100 branches; now the client omits branch, the server selects the repository default (falling back to "main" if unknown), and listRemoteBranches paginates up to 10×100 results.
Review notes
- TRPC:
cloudWorkspace.create.branchis optional; the server resolves viarepoForProject.defaultBranchor uses "main" if unavailable. If a branch is provided, behavior is unchanged. - Mobile:
useCreateCloudWorkspaceomitsbranchwhen the branch query has not resolved. - Pagination:
packages/trpclistRemoteBranchesfetches up to 10 pages (100 per page) and exits early on a short page; no caller changes required. - Clients should stop guessing default branches; omit
branchwhen unknown.
Summary by CodeRabbit
-
New Features
- Cloud workspaces now automatically use the repository’s default branch when no branch is specified.
- Branch selection supports repositories with more than 100 branches by retrieving results across multiple pages.
-
Bug Fixes
- Prevented unresolved branch names from incorrectly defaulting to
mainbefore the repository’s actual default branch is determined.
- Prevented unresolved branch names from incorrectly defaulting to