Repository navigation
perf: coalesce git upstream status reads - #11697
Conversation
987a3d7 to
b212c0b
Compare
c8cf92d to
f11110a
Compare
b212c0b to
8474df1
Compare
f11110a to
2a6a2a9
Compare
The read owner imported the shared/types barrel deleted by #14447, and its push-target key hand-enumerated fields, so a new GitPushTarget field would silently share a lease between two different targets. The destructure now fails to compile if a field is added. Lease tests moved into their own file after #14728 split ssh-git-provider.test.ts.
2a6a2a9 to
073be35
Compare
The 10-caller benchmark only runs under ORCA_GIT_UPSTREAM_COALESCING_BENCH_JSON, so nothing in CI failed when the native/WSL lease was bypassed. Route status.ts through invalidateGitUpstreamStatusReads so the export has a production caller.
|
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 (7)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds shared keyed ownership for Git upstream-status reads. Native and WSL reads use execution identity, worktree path, and upstream-target fields as keys. SSH providers use provider-specific owners. Completed and rejected reads are removed, and invalidation fences reads across Git mutations. Tests cover deduplication, key isolation, recovery, invalidation, and command or RPC counts. Merge Risk: ⚪ Minimal · up to This change coalesces identical in-flight Git upstream-status reads without changing Git commands, persisted state, or public interfaces. The current head is merge-ready after normal checks, with no actionable merge-blocking risk remaining. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 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 git upstream status reads * fix(git): repair upstream lease key imports and guard its field list The read owner imported the shared/types barrel deleted by #14447, and its push-target key hand-enumerated fields, so a new GitPushTarget field would silently share a lease between two different targets. The destructure now fails to compile if a field is added. Lease tests moved into their own file after #14728 split ssh-git-provider.test.ts. * test(git): enforce native upstream coalescing in CI The 10-caller benchmark only runs under ORCA_GIT_UPSTREAM_COALESCING_BENCH_JSON, so nothing in CI failed when the native/WSL lease was bypassed. Route status.ts through invalidateGitUpstreamStatusReads so the export has a production caller.
* perf: coalesce git upstream status reads * fix(git): repair upstream lease key imports and guard its field list The read owner imported the shared/types barrel deleted by stablyai#14447, and its push-target key hand-enumerated fields, so a new GitPushTarget field would silently share a lease between two different targets. The destructure now fails to compile if a field is added. Lease tests moved into their own file after stablyai#14728 split ssh-git-provider.test.ts. * test(git): enforce native upstream coalescing in CI The 10-caller benchmark only runs under ORCA_GIT_UPSTREAM_COALESCING_BENCH_JSON, so nothing in CI failed when the native/WSL lease was bypassed. Route status.ts through invalidateGitUpstreamStatusReads so the export has a production caller.
Summary
Coalesce concurrent upstream-status reads across native, WSL, and SSH execution.
Identical in-flight reads share work by execution host, worktree, and complete push-target identity. Git mutations fence joins before and after execution, while completed or failed reads are never retained as a result cache.
Focused concurrency measurements:
git.upstreamStatusRPCs to 1.Depends on draft PR #11696 and, transitively, draft PR #11691. This PR is stacked so its GitHub diff contains only the upstream-status change.
Screenshots
No visual change.
Testing
pnpm lint(targetedoxlint --deny-warningspassed)pnpm typecheck(pnpm run typecheck:node)pnpm test(5 focused suites, 221 tests passed)pnpm build(pnpm run build:electron-vite)Also passed targeted formatting, max-lines ratchet, and
git diff --check.AI Review Report
Reviewed execution-host isolation, every
GitPushTargetfield, success/error eviction, bounded in-flight retention, native/WSL/SSH mutation fencing, provider-instance isolation, and existing error normalization. No unresolved findings.Cross-platform and remote-workspace review confirmed that native paths remain opaque, WSL distros are distinct identities, SSH providers are per connection, and no Git commands or options changed. Git 2.25 compatibility is therefore unchanged.
Security Audit
No new IPC method, RPC method, command, path, authentication, secret, dependency, or persistence surface is introduced. Existing validated push-target fields form a bounded stable key, and entries are removed after settlement, timeout, or mutation invalidation.
Notes
This is the fourth and final focused extraction from draft PR #11539.
Readiness checklist review (2026-08-15)
Verdict: ship. No P0 or P1. One P1 was found and fixed in this branch; details below.
Fixed during review
P1 — the native/WSL path had no CI-enforced coalescing test. The only test exercising 10 concurrent native callers was gated behind
ORCA_GIT_UPSTREAM_COALESCING_BENCH_JSONand returned early in CI. Verified by bypassingnativeAndWslGitUpstreamStatusReadOwner.readingetUpstreamStatus: all 22 tests inupstream.test.tsstill passed. The remaining native tests are negative or count-neutral cases that hold with or without coalescing. Since the native path is the default for every local worktree, a later change to the key or the owner call would have gone undetected.Added
shares one physical read across ten identical native callers, which gatessymbolic-refbehind a promise, fires ten concurrent reads, and asserts exactly one physical chain plus shared result identity — then asserts a second read after settle issues fresh Git work, so the lease cannot silently become a result cache. Re-running the same bypass now fails withexpected [ …(10) ] to have a length of 1 but got 10.P2 —
invalidateGitUpstreamStatusReadswas a test-only production export.status.tsreached into the singleton directly, leaving two ways to invalidate with only one used in production.invalidateGitReadCachesnow calls the named function, matching the siblinginvalidateGitBranchLineTotalInFlightpattern and keepingstatus.tsoff the owner instance.Verified clean
SshGitProvideris constructed per connection establishment with a new mux and re-registered, so a reconnect cannot inherit a lease from a previous generation. Mutations fence reads before and after viarunWithGitReadInvalidation.InFlightPromiseDedupecaps at 128 entries, drops entries on settle, and clears its timer; overflow callers still run but cannot extend retention. A 30s max-in-flight timer prevents a hung read from pinning an entry. No unsafe casts introduced beyond the pre-existingas GitUpstreamStatuson the mux response.GitPushTargetis exactly{remoteName, branchName, remoteUrl?, remoteCreated?}, matching the exhaustive destructure; theRecord<string, never>spread makes a new field a compile error rather than a silently shared lease. All fourgetUpstreamStatuscall sites (orca-runtime-git,hosted-review-creation,ipc/filesystem, provider contract) route through the coalesced entry point.git.upstreamStatusparams are untouched. No mobile-facing surface touched.Residual risk
signalpassed inGitRuntimeOptionsis dropped at thegetUpstreamStatusboundary because the localGitExecOptionstype does not declare it. This predates the PR —readUpstreamStatusnever honoured a signal — so coalescing does not make cancellation any less effective than it is today.Gates
tsc --noEmitclean ·src/main/git+src/main/providers: 2,473 passed / 6 skipped · oxlint clean · oxfmt clean ·audit:code-quality:type-awareexit 0 ·check:max-lines-ratchetOK ·check:reliability-gatesOK (84 gates)