fix(persistence): repo writes take the row's identity, never a bare id (#30616)

* fix(persistence): repo writes take the row's identity, never a bare id

updateRepo(target, updates) now takes Pick<Repo,'id'|'connectionId'|'executionHostId'>
(RepoHostTarget) and resolves the host from it, so a caller that holds the row can no
longer drop its host and write a same-id sibling on another host. The id-only callers
(project host setup controller and IPC handler, folder-to-Git upgrade watch, both
clone paths, registration adoption, fork backfill) pass the row they resolved.

Co-Authored-By: Claude <noreply@anthropic.com>

* test: migrate the remaining Store.updateRepo callers to row targets

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Neil
2026-10-19 00:33:50 -07:00
committed by GitHub
co-authored by Claude
parent cb82bc80da
commit 36ed236394
46 changed files with 380 additions and 294 deletions
@@ -43,7 +43,7 @@ describe('OrcaRuntimeService', () => {
repos.push(repo)
},
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const index = repos.findIndex((repo) => repo.id === id)
if (index === -1) {
return null
@@ -123,7 +123,7 @@ describe('OrcaRuntimeService', () => {
repos.push(repo)
},
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const index = repos.findIndex((repo) => repo.id === id)
if (index === -1) {
return null
@@ -379,7 +379,7 @@ describe('OrcaRuntimeService', () => {
const colorStore = {
...store,
getRepos: () => [existing],
updateRepo: (id: string, repoUpdates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, repoUpdates: Record<string, unknown>) => {
updates.push({ id, updates: repoUpdates })
return upgraded as never
}
@@ -130,7 +130,7 @@ describe('OrcaRuntimeService', () => {
repos.push(repo)
},
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const index = repos.findIndex((repo) => repo.id === id)
if (index === -1) {
return null
@@ -207,7 +207,7 @@ describe('OrcaRuntimeService', () => {
getRepos: () => [...repos] as never,
addRepo: (repo: Record<string, unknown>) => repos.push(repo),
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const repo = repos.find((entry) => entry.id === id)
if (!repo) {
return null
@@ -259,7 +259,7 @@ describe('OrcaRuntimeService', () => {
getRepos: () => [...repos] as never,
addRepo: (repo: Record<string, unknown>) => repos.push(repo),
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const repo = repos.find((entry) => entry.id === id)
if (!repo) {
return null
@@ -348,7 +348,7 @@ describe('OrcaRuntimeService', () => {
repos.push(repo)
},
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const index = repos.findIndex((repo) => repo.id === id)
if (index === -1) {
return null
@@ -465,7 +465,7 @@ describe('OrcaRuntimeService', () => {
repos.push(repo)
},
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const index = repos.findIndex((repo) => repo.id === id)
if (index === -1) {
return null
@@ -506,7 +506,7 @@ describe('OrcaRuntimeService', () => {
repos.push(repo)
},
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const index = repos.findIndex((repo) => repo.id === id)
if (index === -1) {
return null
@@ -539,7 +539,7 @@ describe('OrcaRuntimeService', () => {
repos.push(repo)
},
getRepo: (id: string) => repos.find((repo) => repo.id === id) as never,
updateRepo: (id: string, updates: Record<string, unknown>) => {
updateRepo: ({ id }: { id: string }, updates: Record<string, unknown>) => {
const index = repos.findIndex((repo) => repo.id === id)
if (index === -1) {
return null