mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 16:03:26 +00:00
fix(project-groups): preserve repo owner routing
This commit is contained in:
@@ -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' })
|
||||
|
||||
@@ -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' }))
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user