Repository navigation
perf: coalesce SSH git status reads - #11696
Conversation
987a3d7 to
b212c0b
Compare
|
Too many files changed for review (1900 files, 100 file limit). |
|
Rebased onto current Correctness fix on top of the original change: the Tests were carried across #14728's test-file split: the lease tests now live in Note: #11697 is stacked on this branch and will need rebasing/retargeting once this merges. |
The request payload carries branchLineTotalMergeBase but the lease key did not, so a strict refresh asking for the total could join an in-flight poll that omitted it (blanking the branch-header chip) or reuse a pre-commit fork point. Mirrors the guard already on the local path in git/status.ts.
b212c0b to
8474df1
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthrough
Merge Risk: ⚪ Minimal · up to The change coalesces concurrent SSH Git status reads while preserving cancellation, mutation fencing, and fork-point correctness; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
* perf: coalesce SSH git status reads * fix(ssh): key status leases by branch-line-total fork point The request payload carries branchLineTotalMergeBase but the lease key did not, so a strict refresh asking for the total could join an in-flight poll that omitted it (blanking the branch-header chip) or reuse a pre-commit fork point. Mirrors the guard already on the local path in git/status.ts.
Summary
Coalesce concurrent SSH Git status reads across callers with distinct cancellation signals.
Each caller gets an independent lease over one client-side
git.statusRPC. The RPC aborts only after its final live lease cancels, and SSH mutations fence status joins before and after execution. Leases are in-flight only — the entry is deleted on settle, so there is no result cache and no stale-badge failure mode.The focused concurrency test measures 10 concurrent, separately signalled status calls collapsing to 1 SSH
git.statusRPC.Fork-point key fix
The original revision of this PR had a defect that merged textually clean: the
git.statusrequest payload carriesbranchLineTotalMergeBase, but the lease key did not hash it. Two real callers disagree on that field —git-status-refresh.ts:121-138(automatic poll) and:250-267(strict user-triggered refresh) each read the gate independently — so a refresh asking for the branch-line total could join an in-flight poll that omitted it and render a response with nobranchLineTotal, blanking the branch-header chip. After a commit moved the merge base, a refresh with the new base could also join an in-flight read using the old one and show a pre-commit number.The key now includes the fork point, mirroring the guard already on the local path (
src/main/git/status.ts:249-251, whose inline comment warns about exactly this).Rebase notes
nwparker/perf-coalesce-git-statustomain; the parent (perf: coalesce cancellable git status reads #11691) has since merged andGitStatusReadLeaseOwnernow lives insrc/shared/.ssh-git-provider.test.tsinto per-area files after this PR was opened. The lease tests were carried into a newssh-git-provider-status-lease.test.ts, and the{ signal: expect.any(AbortSignal) }assertion updates were applied tossh-git-provider-status.test.tsandssh-git-provider-worktree.test.ts(6 tests failed without them).ORCA_SSH_GIT_STATUS_COALESCING_BENCH_JSON) was dropped rather than carried into the split file.mainand a rebase once this merges.Mutation fencing
runWithGitReadInvalidationfences a strict superset of whatmainfenced asrunWithDiffDedupeClear: all 16 of main's methods, plusstageFile,unstageFile,discardChanges,bulkStageFiles,bulkUnstageFiles, andbulkDiscardChanges— the mutations that change status output and therefore must not be joinable across a write.Screenshots
No visual change.
Testing
pnpm typecheck(all three tsconfigs: node, cli, web)src/main/providers+src/main/git— 2,459 passed, 6 skippedpnpm check:max-lines-ratchet,pnpm check:reliability-gatesoxlint+oxfmtThe new fork-point test was verified non-vacuous: it fails against the source without the key fix (
× isolates status reads by branch-line-total fork point) and passes with it.Remote / cross-platform review
No new RPC method, payload field, command, path, authentication, secret, dependency, or persistence surface. The lease always passes a provider-owned shared
AbortSignaltomux.request, but that only registers a local abort listener (ssh-channel-multiplexer.ts:277) — nothing goes on the wire and no relay upgrade is required, so mixed client/host versions are unaffected. No Git commands or options change, so the Git 2.25 floor is untouched. Lease state is scoped to oneSshGitProviderinstance and removed after settlement or invalidation.Known residual: the key does not normalize Windows path casing, so two callers using different casing for the same worktree perform separate reads. That costs a duplicate read, never a wrong result, and matches the local path's existing behavior.
Notes
This is the third focused extraction from draft PR #11539.