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
@@ -286,7 +286,7 @@ export class RuntimeProjectHostSetupController {
if (!identity || getProjectIdForProviderIdentity(identity) !== args.projectId) {
throw new Error('Imported folder does not match the selected project identity.')
}
const updated = store.updateRepo(repo.id, {
const updated = store.updateRepo(repo, {
upstream: {
owner: identity.owner,
repo: identity.repo,
@@ -300,7 +300,7 @@ export class RuntimeProjectHostSetupController {
setup = getProjectHostSetupForRepo(this.listSetups(), repo)
}
const setupMethod = args.setupMethod ?? 'imported-existing-folder'
const updated = store.updateRepo(repo.id, { projectHostSetupMethod: setupMethod })
const updated = store.updateRepo(repo, { projectHostSetupMethod: setupMethod })
if (!updated) {
throw new Error(
`Project setup repo disappeared before setup metadata could be linked: ${repo.id}`