Repository navigation
refactor(hosts): one ingest adapter for fetched rows - #27216
Conversation
Repos, project groups, project host setups and folder workspaces fetched from this app or a paired server were each stamped with their owner by a separate function. They now go through adoptFromEndpoint, one adapter with a per-kind arm. Behavior is unchanged; a characterization test was run against the old stampers before they were deleted.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to This refactor routes fetched rows through one ownership adapter and is reported to leave user-visible behavior unchanged. No actionable merge-blocking risk was found. Pre-merge checks |
|
ELI5
When Orca loads a project list from this computer or from a paired Orca server, it labels each row with the machine that owns it. That labelling lived in four near-identical functions, one per kind of row. This PR puts it in one place. Nothing a user sees changes.
What Changed
repoWithFetchedOwner,setupWithFetchedOwner,folderWorkspaceWithFetchedOwnerandprojectGroupWithFetchedOwnereach decided, in their own file, "a row from a paired server belongs to that server; a row from this app keeps the host it names". The folder-workspace catalog also had a fifth, inline copy for rows from this app.adoptFromEndpoint(target, { kind, row })insrc/renderer/src/store/adopt-from-endpoint.ts. Each kind keeps its own arm, because the fields that carry the owner differ:connectionId(on a server's row it names that server's SSH target),hostIdand dropconnectionId,executionHostId(folder workspaces fall back to their project group's host).project-group-owner-stamping.tsare deleted; all 12 call sites now use the adapter.For users: no change. Local, SSH, paired-server and folder workspaces load and are labelled exactly as before.
Why
This is the foundation step for routing work by the owning host instead of the focused "Active Server". The next step stamps live events and optimistic rows through the same adapter, so every row the renderer stores gets its owner from one function. With four copies, a fix to one kind of row (for example, how a server's nested SSH target is kept) could silently miss the others.
Alternatives considered: a single owner rule for every kind was rejected, because the per-kind field differences above are real and changing them would change behavior. Separate exported functions under one module was also possible, but one entry point with a typed
kindis what the follow-up needs to add events and optimistic rows as further kinds.Linked Issue
None (maintainer refactor, part of the host-ownership routing work).
Visual Proof
N/A — internal refactor with no visual or interaction change.
Testing
adopt-from-endpoint.test.tsis a characterization table: every kind × {this app, paired server}, plus nested SSH targets, stale stamps and folder rows that inherit their group's host. It was first run asserting equality with the old four functions (18/18 equal), then the old functions were removed.Focused suites for repos, project groups, project host setups, folder workspaces and connection context: 49 files, 380 tests pass.
pnpm tc, oxlint andpnpm run check:code-quality:changedpass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Security, cross-platform, SSH and backwards compatibility: no change. No wire or persisted format changes; the same fields are stamped with the same values.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)