Skip to content

refactor(hosts): one ingest adapter for fetched rows - #27216

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/d4-d4-f2a
Oct 10, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/d4-d4-f2a

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​161 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​155
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​160 $\color{#cf222e}{\Huge{\mathbf{−}}}$​119 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41

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

  • Before: repoWithFetchedOwner, setupWithFetchedOwner, folderWorkspaceWithFetchedOwner and projectGroupWithFetchedOwner each 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.
  • After: all of them go through adoptFromEndpoint(target, { kind, row }) in src/renderer/src/store/adopt-from-endpoint.ts. Each kind keeps its own arm, because the fields that carry the owner differ:
    • repos keep their connectionId (on a server's row it names that server's SSH target),
    • project host setups get the server as hostId and drop connectionId,
    • project groups and folder workspaces get a stamped executionHostId (folder workspaces fall back to their project group's host).
  • The four old functions and project-group-owner-stamping.ts are 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 kind is 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.ts is 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 and pnpm run check:code-quality:changed pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0f5a7ab2-8ffa-49f4-bb09-4f9446be1c77

📥 Commits

Reviewing files that changed from the base of the PR and between 6af18ab and 9e37c5f.


📒 Files selected for processing (17)
  • src/renderer/src/components/workspace-surface-projection.ts
  • src/renderer/src/lib/connection-context.test.ts
  • src/renderer/src/store/adopt-from-endpoint.test.ts
  • src/renderer/src/store/adopt-from-endpoint.ts
  • src/renderer/src/store/folder-workspaces/folder-workspace-catalog.ts
  • src/renderer/src/store/folder-workspaces/folder-workspace-mutations.ts
  • src/renderer/src/store/project-groups/project-group-catalog.ts
  • src/renderer/src/store/project-groups/project-group-mutations.ts
  • src/renderer/src/store/project-groups/project-group-owner-stamping.ts
  • src/renderer/src/store/projects/project-catalog-null-field-ingest.test.ts
  • src/renderer/src/store/projects/project-host-routing.ts
  • src/renderer/src/store/projects/project-host-setup-actions.ts
  • src/renderer/src/store/repos/owner-routing.ts
  • src/renderer/src/store/repos/repo-add-actions.ts
  • src/renderer/src/store/repos/repo-catalog-merge.ts
  • src/renderer/src/store/repos/repo-update.ts
  • src/shared/execution-host.ts

💤 Files with no reviewable changes (1)
  • src/renderer/src/store/project-groups/project-group-owner-stamping.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.



📝 Walkthrough

Walkthrough

The change adds adoptFromEndpoint to assign host ownership to repo, project-group, project-host setup, and folder-workspace rows. Catalog and mutation flows now use this function instead of entity-specific fetched-owner helpers. Tests cover adoption across local and environment targets.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 9e37c

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 | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 4.35% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 16 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: consolidating fetched-row ownership handling into one ingest adapter.
Description check Passed The description is complete and aligned with the template. It explains the change, rationale, scope, testing, visual proof, compatibility considerations, and checklist status. The missing linked issue…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrcaWin
OrcaWin merged commit bbe9a11 into main Oct 10, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant