mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 09:07:40 +00:00
* fix(cli): check the runtime source before sending A terminal Orca launches now carries which Orca launched it (ORCA_RUNTIME_SOURCE_ID = the profile's installation id, ORCA_RUNTIME_SOURCE_INCARNATION = the launching runtime id). Before a request is sent, the CLI compares that with the runtime the profile's runtime record names. Same runtime: sent as before. Different runtime: a read-only status.get asks which profile it serves; the same profile (a restart or update) is accepted, anything else is refused before the request reaches it. The vars cross into WSL through WSLENV. The SSH bridge stamps the bridging runtime itself rather than trusting the remote env. The existing orchestration compatibility stamp is untouched. * fix(orcad): drop an inherited runtime source at startup * fix(cli): an explicit switch to another profile is not fenced The stamp also carries the launching runtime's userData path. A CLI that dials a different profile than the one that launched its terminal, and not the platform default an unpinned terminal falls back to, was pointed there on purpose (orca-dev from a packaged Orca's terminal), so the fence does not apply. * refactor(cli): reuse the shared userData path comparison --------- Co-authored-by: m4air <m4air@Mac.localdomain>
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { readRuntimeSourceStamp, stampRuntimeSourceEnv } from './runtime-source-env'
|
|
|
|
describe('runtime source env', () => {
|
|
it('round-trips a stamp and replaces an inherited one', () => {
|
|
const env: Record<string, string | undefined> = {
|
|
ORCA_RUNTIME_SOURCE_ID: 'parent',
|
|
ORCA_RUNTIME_SOURCE_INCARNATION: 'parent-runtime'
|
|
}
|
|
stampRuntimeSourceEnv(env, { sourceId: 'child', incarnation: 'child-runtime' })
|
|
expect(readRuntimeSourceStamp(env)).toEqual({ sourceId: 'child', incarnation: 'child-runtime' })
|
|
})
|
|
|
|
it('clears an inherited stamp when this runtime has none', () => {
|
|
const env: Record<string, string | undefined> = {
|
|
ORCA_RUNTIME_SOURCE_ID: 'parent',
|
|
ORCA_RUNTIME_SOURCE_INCARNATION: 'parent-runtime'
|
|
}
|
|
stampRuntimeSourceEnv(env, null)
|
|
expect(env).toEqual({})
|
|
})
|
|
|
|
it('treats a partial or oversized stamp as no stamp', () => {
|
|
expect(readRuntimeSourceStamp({ ORCA_RUNTIME_SOURCE_ID: 'only-id' })).toBeNull()
|
|
expect(
|
|
readRuntimeSourceStamp({
|
|
ORCA_RUNTIME_SOURCE_ID: 'x'.repeat(4_097),
|
|
ORCA_RUNTIME_SOURCE_INCARNATION: 'runtime'
|
|
})
|
|
).toBeNull()
|
|
})
|
|
})
|