Skip to content

fix(mobile): use loaded branch for untouched worktree base - #23241

Open
only21mil wants to merge 4 commits into
pingdotgg:mainfrom
only21mil:r13/a083-seed-the-worktree-base-after-branch-stat
Open

only21mil wants to merge 4 commits into
pingdotgg:mainfrom
only21mil:r13/a083-seed-the-worktree-base-after-branch-stat

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

On mobile, opening Branches & worktrees before Git status loads can leave the new worktree's base set to main, even after status reports release/stable. Stale thread metadata can leave an old branch in the field instead. Creating the worktree then uses the wrong base or fails if that ref does not exist.

Change

Keep only the user's edit in state. Until the field is edited, derive its value from the current branch so a status response updates the default. Once edited, preserve the entered value, including an empty field.

Scope and approval

This is a very small, focused fix for an obvious bug, under the exception in CONTRIBUTING.md: the sheet's default ignores Git status that arrives after it opens. It changes no product default and no other branch-selection flow. No issue or maintainer approval is claimed. It affects the shared iOS and Android sheet. Branch selection elsewhere is unchanged.

Verification

  • cd apps/mobile && pnpm exec vp test run --project react src/features/threads/git/GitBranchesSheet.test.tsx: base production source fails two cases by submitting main or stale metadata. Candidate passes all four, including edited and cleared input. No timers or polling. This re-adds the sheet test path that test: delete 11k low-signal tests so CI runs faster and flakes less #22557 pruned; it now covers only the late-status default and its edit-preserving counterpart.
  • pnpm --filter @t3tools/mobile typecheck passes. Targeted pnpm exec vp lint and pnpm exec vp fmt --check pass on the sheet, test and mobile test configuration.
  • iOS 26.5 and Android 16.0, fresh isolated state, matching Debug native clients with production JavaScript: pause the owned backend while opening the sheet, then resume it. Base retains main; candidate uses release/stable. Both candidates create a worktree through the UI, and Git confirms its branch starts at the release/stable commit. An edited base also keeps its value after status resumes. Device runs and services were cleaned up.

Not checked:

  • Physical devices and distributed/store builds.

The base retains main alongside the checked-out release/stable branch.

iOS base retains main

Android base retains main

The candidate's untouched base follows the loaded branch.

iOS candidate uses release/stable

Android candidate uses release/stable

Edited bases remain entered: master on iOS and custom-base on Android.

iOS edited base shows master

Android edited base shows custom-base

The regression fails on the base and passes on the candidate.

Regression fails on base

Regression passes on candidate

Prior PRs: Jacob's open #20754 changes jj terminology in this sheet and keeps its one-time base initialization, so it does not fix this stale default; it also rewrites the same initializer lines, so whichever lands second needs a small rebase. Julius Marminge's #22980 and Alex's #22551 change this sheet's header and layout only. This patch reuses no code from them.

Production fix, tests, PR description and images written with GPT-6.1 Sol in T3 Code Nightly.

🤖 Generated with GPT-6.1 Sol in T3 Code Nightly

only21mil and others added 4 commits October 21, 2026 19:23
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d361de21-0d67-45f6-bf54-92610d3464be
📥 Commits

Reviewing files that changed from the base of the PR and between f8e4834 and 02dbeb0.

📒 Files selected for processing: 3
  • apps/mobile/src/features/threads/git/GitBranchesSheet.test.tsx
  • apps/mobile/src/features/threads/git/GitBranchesSheet.tsx
  • apps/mobile/vite.config.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 22, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — The PR is a focused mobile bug fix, but it changes the default base branch used for untouched new-worktree creation when Git status loads asynchronously. That product-default change warrants human review despite the small, tested implementation.

You can add or adjust custom eligibility rules. Learn more.

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:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant