fix(swift-ios): show cached source-control status immediately - #5975
fix(swift-ios): show cached source-control status immediately#5975saphid wants to merge 9 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
Integrated simulator verification completed after the focused cache tests and passing native CI. The home screen remained responsive while connected to the disposable backend and continued rendering the workspace/thread source-control summary. The cache refresh/fallback behavior itself is covered by the exact-head native tests so this proof does not rely on timing a transient network failure in a screenshot. |
ApprovabilityVerdict: Needs human review This PR introduces a new cache coherence system for VCS status with generation tracking across local/remote status. An unresolved review comment identifies a potential race condition where stale remote data from a previous branch could be paired with current local data after checkout. The scope and complexity of the caching logic changes, combined with the open correctness concern, warrant human review. You can customize Macroscope's approvability policy. Learn more. |
|
Additional integrated simulator proof on iOS 26.5: the home row resolved the real upstream PR from the cached source-control status and visibly rendered the green This follows the focused 221-test pass and the green native CI run. |
| local: VCSLocalStatus, | ||
| remote: VCSRemoteStatus? | ||
| ) -> FeatureSourceControlStatus? { | ||
| guard !local.hasPrimaryRemote || remote != nil else { return nil } |
There was a problem hiding this comment.
a non-nil remote value is not necessarily coherent with this local ref. the server cache updates local status independently and retains the prior remote half, so after checkout the accumulator can combine branch B local data with branch A ahead/behind and PR data. this one-shot caller then returns and unsubscribes before remoteUpdated(B) arrives. tie remote data to a local ref/generation, await a coherent remote refresh after ref changes, or otherwise reject the stale pair; add a localUpdated(A→B) regression test.
|
Addressed the review findings and completed the deferred native verification on exact head Corrections include generation-safe publication, compare-and-swap protection, identity probing, explicit origin errors, remote association tokens, working-tree token handling, and valid observation macro mutation. Verification:
A prior direct Claude Opus 5 high review found seven actionable issues, all addressed in this head. A fresh review of the final head could not run because the Claude session quota remains exhausted until 04:50 AEST. No final-head independent review is claimed. |
c7e7dbd to
3a20582
Compare
|
Follow-up for the hosted CI failures on exact head
Focused verification:
The Vercel marketing result is an authorization failure outside this PR's affected surface. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5590d8c. Configure here.
|
Closing this version while I rebuild the upstream contribution set from the latest base. Clean versions are coming soon. |



Summary
Uses the VCS subscription snapshot for fast cached status, falls back to an explicit refresh on timeout/subscription failure, and preserves toolbar/pull-to-refresh semantics.
Verification
Scope
Targets the active native SwiftUI owner branch (#5178).
Note
Show cached source-control status immediately in iOS before falling back to a full refresh
NativeFeatureClient.sourceControlStatusnow races a VCS status stream against a 2-second timeout, returning cached/streamed status immediately when available and falling back to a full refresh only on timeout or error.VcsStatusBroadcastergains a generation counter per working directory, semaphore-serialized cache transitions, and coherent snapshot reads (readCoherentStatus) to prevent pairing stale remote status with a new local ref.applyGitStatusStreamState(new) replacesapplyGitStatusStreamEventas the client-side accumulator, enforcing generation ordering and clearing remote state on ref changes.GitManager.localStatusnow includescoherenceTokenandremoteAssociationToken(SHA-256 hashes over HEAD OID and remote association), enabling the broadcaster to detect ref changes without a full status read.FeatureSourceControlViewdistinguishes between initial load (sourceControlStatus) and explicit refresh (refreshSourceControlStatus), so pull-to-refresh and the toolbar button always force a fresh fetch.Macroscope summarized 7a1008e.
Note
Medium Risk
Touches VCS cache coherency and concurrent refresh paths used by multiple clients; incorrect generation/token handling could show wrong ahead/behind or PR data, though coverage is heavy.
Overview
Adds generation-aware VCS status streaming so local and remote snapshots are not merged across branch/HEAD/remote changes, and wires fast cached source control on iOS on top of that stream.
Server:
localStatusnow exposes SHA-256coherenceToken/remoteAssociationToken(HEAD, branch, upstream, normalizedoriginURL).VcsStatusBroadcastertracks a per-repo generation, serializes cache updates, rejects stale remote writes, retriesreadCoherentStatuswhen identity shifts, and tags stream events withgeneration. HEAD-only moves can carry forward the last remote snapshot while forcing a remote refresh.Clients: Contracts, shared reducers (
applyGitStatusStreamState), and Swift decode the optional generation field. iOSsourceControlStatuswaits up to 2s on the event stream viaNativeSourceControlStatusAccumulator, then falls back torefreshSourceControlStatus; toolbar/pull-to-refresh use the explicit refresh path. Provider labels no longer fall back to a global provider list when the environment catalog is missing.Reviewed by Cursor Bugbot for commit 7a1008e. Bugbot is set up for automated code reviews on this repo. Configure here.
Delivery: direct
Validated against Theo commit: f98cab5
Depends on: none
Merge order: this PR only
Validation status: Mergeable with runnable checks green; requested review changes remain. The unrelated Vercel authorization failure is a maintainer-side gate.