mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
* fix(projects): setup edits and removals name the host, so a twin on another host is never touched Repo-backed project host setups take the repo id, so a project on two hosts has two setups with one id. Update and delete took the first match by id, so editing or removing the SSH copy could rename or remove the local one. The args gain an optional hostId (older peers strip it and keep the first match). * fix(projects): tolerate only the legacy runtime stamp when a named host misses an independent setup * fix(projects): refuse a twin edit on a server that would act on the wrong twin; read legacy runtime stamps as local * fix(cli): refuse setup --host on a server that would ignore it * refactor(projects): exact host match only; name the host on the wire only for twins on one route * fix(projects): a named host the catalog lacks refuses; settings remove stays by id * refactor(projects): name hosts on the wire only for this computer's catalog; paired servers keep the by-id request
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { findProjectHostSetup } from './project-host-setup-target'
|
|
|
|
const local = { id: 'repo-1', hostId: 'local' as const, repoId: 'repo-1' }
|
|
const ssh = { id: 'repo-1', hostId: 'ssh:box' as const, repoId: 'repo-1' }
|
|
|
|
describe('findProjectHostSetup', () => {
|
|
it('keeps the first match by id when the caller names no host', () => {
|
|
expect(findProjectHostSetup([local, ssh], { setupId: 'repo-1' })).toBe(local)
|
|
})
|
|
|
|
it('picks the named twin', () => {
|
|
expect(
|
|
findProjectHostSetup([local, ssh], {
|
|
setupId: 'repo-1',
|
|
hostId: 'ssh:box'
|
|
})
|
|
).toBe(ssh)
|
|
})
|
|
|
|
it('never falls back to a sibling when the named twin is gone', () => {
|
|
expect(findProjectHostSetup([local], { setupId: 'repo-1', hostId: 'ssh:box' })).toBeUndefined()
|
|
})
|
|
|
|
it('refuses a wrongly named host for an independent setup', () => {
|
|
const provisioned = { id: 'p::gpu', hostId: 'local' as const, repoId: '' }
|
|
expect(
|
|
findProjectHostSetup([provisioned], { setupId: 'p::gpu', hostId: 'ssh:other' })
|
|
).toBeUndefined()
|
|
})
|
|
})
|