Skip to content

fix(native): refresh branch refs after cache invalidation - #179

Merged
rynfar merged 4 commits into
nativefrom
nw/144-branch-refresh
Nov 3, 2026
Merged

rynfar merged 4 commits into
nativefrom
nw/144-branch-refresh

Conversation

@rynfar

@rynfar rynfar commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

The native branch picker reused server snapshots after refs changed outside T3 Code. Ref-affecting actions also left mounted lists unchanged, while background refreshes discarded displayed rows and could move keyboard activation to a different branch. A provisional Create highlight could also survive after an exact branch match arrived, and hovering a row painted a different highlight from the target Enter would activate.

Port the environment-wide invalidation revision and per-repository server revision from client-runtime/src/state/vcs.ts, vcsRefInvalidation.ts, and git.ts. The first read after invalidation sends refresh: true, preserving every list input field. Search and pagination share freshness only after a current reply commits; superseded replies cannot mark the snapshot fresh or reach the picker. Unary settlement hooks cover the web's ref-affecting methods, including PR checkout and sourceControl.publishRepository. Stacked-action streams hold the same finalizer through consumption, failure, and interruption, matching vcsAction.ts.

Same-query refreshes retain displayed rows, errors, and mounted page cursors, including a page already being fetched. The client reads those pages again and replaces the listing only after the replacement succeeds. Failed refreshes retain the previous listing. Highlighting and activation use ref/create-item identity, so reordering, removal, or pagination cannot redirect Enter or a stale row click to another ref. New queries, changes to the checkout directory, and environment changes still reset the listing. Automatic search highlighting follows arriving results while a read is pending or the Create row is provisional. A settled ref result anchors background refreshes; keyboard navigation and pointer movement pin the chosen identity immediately. Pointer leave clears a pointer selection, while any keyboard input restores keyboard modality. The component paints that same identity, so visible highlighting and Enter share one source of truth. This policy lives in core and is tested without GPUI.

Closes #144. Ports pingdotgg/t3code#27438 and the ref invalidation from pingdotgg/t3code#29161.

GT-BRANCH stays partial and now tracks #180. Remaining gaps: previous-worktree entries and cleanup; full draft/worktree-base controls; persisted/offline refs and recovery; native PR checkout UI; native repository publishing UI, which remains disabled. PR checkout and publishing RPC invalidation are implemented, but those UI flows are not enabled by this change.

Validation:

  • cargo clippy --workspace --all-targets -- -D warnings passed.
  • cargo test --workspace passed: 88 client tests, 1,107 core tests, 7 conformance replays, and 48 app tests. Validated after rebasing onto native 6e9ce35455. Log: /private/tmp/native-144-r3-rebased-tests.log.
  • Snapshot build, theme generation check, all 42 parity-sync tests, TypeScript conformance generation check, and scoped ledger formatting passed. Clippy log: /private/tmp/native-144-r3-rebased-clippy.log.
  • Failing-first proof: /private/tmp/native-144-list-red.log for the original five cases; /private/tmp/native-144-r1-red.log for nonempty paginated refresh retention and stacked/publishing invalidation. /private/tmp/native-144-r2-red.log proves the pending-Create highlight regression, and /private/tmp/native-144-r2-opening-red.log covers opening with retained rows while a refresh is pending. Core tests cover automatic Create-to-ref transitions, protected explicit selections, pending and failed refreshes, replacement, stale pages, a pending third cursor, highlight identity across pages/reordering/removal, and create-item identity. Fake-server tests cover unary settlement plus stacked-action success, failure, and interruption, including pre-action reply rejection.
  • Hover regression failed first: /private/tmp/native-144-r3-red.log. The core case verifies that hovering pins Enter’s identity across arriving search results, pointer leave clears it, keyboard input ends pointer modality, and repeated movement over the same choice avoids repainting.
  • Pointer before/after captures: /private/tmp/native-144-evidence/r3-before-hover.png, /private/tmp/native-144-evidence/r3-hover.png. /private/tmp/native-144-evidence/r3-leave.png shows pointer leave clearing the highlight; /private/tmp/native-144-evidence/r3-keyboard-hover.png shows keyboard navigation taking over with the pointer still over the old row. MenuRow retains its existing look through a controlled-highlight option.
  • Read-only smoke transcript: /private/tmp/native-144-evidence/refs-probe.log — vcs.listRefs with cwd, limit: 100, refresh: true. The probe example was removed from the PR; the transcript remains evidence.
  • Automatic search before/after captures: /private/tmp/native-144-evidence/r2-before-search.png, /private/tmp/native-144-evidence/r2-after-search.png. Searching for an existing remote branch beyond the initial page now highlights the arriving ref without arrow navigation. Enter was not sent, so no checkout occurred.
  • Offscreen real-client verification against the copied 14658 smoke home: /private/tmp/native-144-evidence/r1-picker.png shows 200 loaded refs and keyboard highlighting. Baseline: /private/tmp/native-144-evidence/before-picker.png. No real branches were created, deleted, or checked out. Real branch-changing action flows were not exercised. Captures stay local under the factory rules.

Built with GPT-6.1 Sol in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant