Repository navigation
fix(mobile): show child worktrees under a pinned parent in the Pinned section - #20984
JHXSMatthew wants to merge 1 commit into
Conversation
… section The mobile Pinned section was built from explicitly pinned rows only and skipped lineage nesting, so children of a pinned parent never appeared. Mirror desktop's getPinnedSectionWorktrees: an explicitly pinned row carries its visible descendants into Pinned, a pinned child never pulls its unpinned parent in, edges never cross hosts, stale instance lineage is rejected, and the walk is iterative for deep chains. The edge universe is the full catalog so filtered-out middle generations still bridge to visible descendants. Lineage nesting and collapse now apply to the Pinned section like every other section. Fixes stablyai#20674
📝 WalkthroughWalkthroughThe change exports lineage-edge construction and adds Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🟡 Moderate · up to When a filtered child sits between a pinned parent and visible grandchild, the grandchild can render outside its parent hierarchy and remain visible after collapse. Resolve this before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Warning Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 5391290c-25eb-4528-a988-61498006898f
📒 Files selected for processing (5)
mobile/src/worktree/mobile-workspace-lineage.tsmobile/src/worktree/pinned-section-worktrees.test.tsmobile/src/worktree/pinned-section-worktrees.tsmobile/src/worktree/workspace-list-sections.test.tsmobile/src/worktree/workspace-list-sections.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- New
mobile/src/worktree/pinned-section-worktrees.ts—getPinnedSectionWorktrees(allWorktrees, visibleWorktrees, isPinnedWorktree)seeds from visible pinned rows, then pulls in visible descendants of a pinned ancestor through the full-catalog lineage edges, so a filtered-out middle generation still bridges. Pinned child does not pull its unpinned parent; host-qualified edges and stale-instance guards are inherited from the shared edge builder. Iterative andseen-guarded. mobile/src/worktree/mobile-workspace-lineage.ts— pure extraction of the edge-building loop intobuildMobileWorkspaceLineageEdges(), consumed byapplyMobileWorkspaceLineage. Ordering, host isolation, and stale-instance rejection are unchanged.mobile/src/worktree/workspace-list-sections.ts— Pinned membership now comes from the helper over(worktrees, sorted, predicate)and is nested/collapsed throughmakeSection(..., collapsedGroups). Pinned remains an overlay:canonicalGroupWorktreesis stillsorted, so canonical sections and counts are untouched.- Tests —
pinned-section-worktrees.test.ts(11 cases) plus 4buildSectionscases. Assertions are exacttoEqualon ids/depths, so each would fail without the change (descendants, no parent pull-up, dedupe, bridge, invisible root, client-side pin, SSH-host isolation, stale lineage, cycles, 6,000-deep chain).
I verified parity against desktop's getPinnedSectionWorktrees / appendWorktreeRows: desktop also rebuilds edges only among the rows in the pinned subset, so a bridged descendant whose middle parent is absent lands at depth 0 — mobile's applyMobileWorkspaceLineage on the pinned subset behaves identically. Consumers were checked: the section count is rawSection.data.length (now includes descendants, matching desktop's pinned header count), and no consumer assumes every pinned-section row carries isPinned (only isWorktreePinned(actionTarget, pinnedIds) reasons about pin state).
Locally: cd mobile && pnpm vitest run src/worktree/pinned-section-worktrees.test.ts src/worktree/workspace-list-sections.test.ts → 52 passed; pnpm oxlint on the changed sources → clean. On-device Android verification is still noted as pending in the PR body.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Verification result — passed on deviceAutomated (local, macOS / Node 22 / pnpm 12):
Android manual verification: built a release APK from
Ready for review. |
|
Hi @Jinwoo-H — would you have time to review this mobile fix? You've handled most of the recent mobile worktree changes, so it seemed like the right fit. What it does: the Android Pinned section was built from explicitly pinned rows only and skipped the lineage projection, so a pinned parent showed without its children (#20674). It now mirrors desktop's Verification:
One housekeeping note: as this comes from a fork, Mobile Checks / PR Checks are waiting on a maintainer's "Approve and run workflows" — thank you! |

ELI5
In the Android app, pinning a parent worktree moved only that one row into the Pinned section. Its child worktrees stayed behind, so under the pinned parent the hierarchy was gone and the children could only be found down in the normal list. Now the whole family moves together: the pinned parent appears in Pinned with its children nested underneath, exactly like the desktop app.
What Changed
Mobile-only change (React Native app under
mobile/), no wire/RPC changes — the host catalog already carries lineage fields.mobile/src/worktree/pinned-section-worktrees.ts(new):getPinnedSectionWorktrees()— Pinned-section membership mirroring the desktop helpersrc/renderer/src/components/sidebar/pinned-section-worktrees.ts.worktreeInstanceIdmismatch) is rejected.mobile/src/worktree/mobile-workspace-lineage.ts: extracted the existing edge-building logic intobuildMobileWorkspaceLineageEdges()(pure refactor, behavior unchanged) so both the flat-list projection and the new pinned membership share one validation path.mobile/src/worktree/workspace-list-sections.ts: the Pinned section is now built fromgetPinnedSectionWorktrees()instead ofsorted.filter(isPinned), and lineage nesting/collapse is applied to it (collapsedGroups) just like every other section. Pinned remains an overlay — rows still appear in their canonical All/repo/status/PR groups too — so no existing grouping behavior changes.Why
Desktop already implements this exact behavior (and the desktop feature request #5255 remains open separately). The mobile Pinned section was constructed from pinned rows alone and never ran the lineage projection, so a pinned parent was rendered as a leaf. The mobile code already had all the lineage data and the nesting projection; only the Pinned section bypassed it. Reusing the shared, proven edge validation keeps mobile/desktop semantics identical with a minimal diff and requires no protocol change.
Linked Issue
Fixes #20674
Visual Proof
On-device verification passed on a physical Android phone running the 0.0.50 build of this commit (overwrite-installed over 0.0.48): the pinned parent now renders its children nested in the Pinned section. This is a mobile-only interaction change:
Automated coverage of the before/after data shape is in
mobile/src/worktree/pinned-section-worktrees.test.tsand thebuildSectionscases added inmobile/src/worktree/workspace-list-sections.test.ts.Testing
Automated (run locally on macOS, Node 22 + pnpm 12):
buildSectionsintegration tests: pinned parent nests child + grandchild in Pinned with depths[0,1,2]while the overlay keeps them in All; client-side pin; pinned child alone; collapse via the shared lineage collapse state.pnpm test→ 597 files / 5625 tests passed (6 pre-existing skips).pnpm typecheckclean;pnpm lintonly pre-existing warnings in unrelated files;pnpm format:checkclean.A release-configured Android APK was built locally from this exact commit (
expo prebuild+./gradlew assembleRelease, JDK 17): packagecom.stably.orca.mobile, version 0.0.50 (versionCode 16), all ABIs. Its signing certificate uses the identical signing certificate as the official published release APK (verified against the GitHub Releases 0.0.48 APK: same cert SHA-256fac61745…), so it overwrite-installs over a Play/sideloaded official build without clearing data.Manual Android verification — passed on a physical device (overwrite install 0.0.48 → 0.0.50, pairing/data preserved):
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)