Repository navigation
fix(renderer): a created or lineage-refreshed worktree replaces only its own host's copy - #30447
Merged
Merged
Conversation
…its own host's copy applyCreatedWorktree merged a create into any same-id row, so a local create could inherit a server twin's stamp (or wipe it). Lineage refresh stamped a server's reply with the focused host and replaced every same-id row, overwriting the local twin. Both now match id and host, and the lineage reply is stamped with the transport it came from.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
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 |
1 of 2 tasks
7 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
A project can exist both on this computer and on a paired Orca server, sometimes with a worktree at the same path on each. These are two different worktrees that happen to share an id. Two places in Orca updated "the worktree with this id" without checking which machine it was on, so an update for one copy could overwrite or relabel the other.
What Changed
store/slices/worktrees/create/created-worktree-state-merge.ts).store/slices/worktrees/metadata/worktree-lineage-refresh.ts).replaceWorktreeInRepoLists(listing/worktree-owner-settings.ts), whose only caller is lineage refresh, now takes the host and matches with the existingworktreeMatchesHostrules.Why
These are point fixes P2 and P3 of the SSH-hardening round 3 design (
round3-design.md§1.2). Both adversarial reviewers flagged them as writers that break the "rows are stamped by the transport they came from" proof that the owner-resolver folds rely on.Matching uses the same predicate the host-scoped listing merge already uses (
worktreeMatchesHostwithworktreeHostMatchOptions), so pre-host unstamped rows keep their existing treatment. This reuses existing code rather than adding a new rule.Wire impact: none (renderer state only).
Linked Issue
None (internal hardening; maintainer PR).
Visual Proof
N/A: no UI change. Twin rows are no longer overwritten in the store.
Testing
New
store/slices/worktrees/host-scoped-row-merges.test.ts. All 3 tests fail on main and pass with the fix:Unit tests, single worker: all of
src/renderer/src/store/slices(395 files, 3,867 tests).pnpm tc:weband the full local pr.yml static job (0 failures, focus-read ratchet pruned 1082 → 1081).Managed-orcad Docker lane dispatched on this head; the link is added when it finishes.
No separate live-host run: twins of the same id across hosts are covered by the unit tests and the Docker lane.
Codex review (
gpt-6.1-sol, high), twice (before and after the ratchet-neutral loop rewrite): no findings.I manually tested these changes locally
Automated tests added/updated, or explained why not below