fix(project-groups): preserve repo owner routing

This commit is contained in:
Brennan Benson
2026-08-10 21:32:04 -07:00
parent aa5a1ceed3
commit ade4e9d3e0
3 changed files with 22 additions and 2 deletions
+6 -1
View File
@@ -1780,7 +1780,12 @@ export function registerRepoHandlers(mainWindow: BrowserWindow, store: Store): v
const group = groupResolver.getGroupForRepo(repoPath)
if (existing) {
if (group) {
store.moveProjectToGroup(existing.id, group.id, projectGroupOrder)
store.moveProjectToGroup(
existing.id,
group.id,
projectGroupOrder,
getRepoExecutionHostId(existing)
)
}
importedProjectIdsByRepoPath.set(normalizedImportRepoPath, existing.id)
results.push({ path: repoPath, projectId: existing.id, status: 'already-known' })
+11
View File
@@ -3953,6 +3953,17 @@ describe('Store', () => {
expect(updated?.projectGroupOrder).toBe(1)
})
it('rejects repo membership in a group owned by another host', async () => {
const store = await createStore()
store.addRepo(makeRepo({ id: 'local-repo', path: '/local' }))
const remoteGroup = store.createProjectGroup({ name: 'Remote', createdFrom: 'manual' })
remoteGroup.executionHostId = 'runtime:env-1'
const updated = store.updateRepo('local-repo', { projectGroupId: remoteGroup.id }, 'local')
expect(updated?.projectGroupId).toBeNull()
})
it('updates repo execution host identity', async () => {
const store = await createStore()
store.addRepo(makeRepo({ id: 'r1' }))
+5 -1
View File
@@ -5030,7 +5030,11 @@ export class Store {
if (
typeof nextGroupId !== 'string' ||
nextGroupId.trim().length === 0 ||
!this.state.projectGroups.some((group) => group.id === nextGroupId)
!resolveProjectGroupMembership(
buildProjectGroupOwnerIndex(this.state.projectGroups),
nextGroupId,
getRepoExecutionHostId(repo)
)
) {
sanitizedUpdates.projectGroupId = null
}