mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 00:03:52 +00:00
* fix(cli): migrate managed WSL launchers to native exe * refactor(cli): reconcile managed WSL registrations * fix(cli): harden WSL registration reconciliation * fix(cli): serialize and harden WSL CLI registration lifecycle - Cap per-distro concurrent repairs and add a filesystem lock so two Orca installs can't race the same distro's launcher/bridge files - Skip re-adopting a legacy managed launcher when its bridge is user- owned, avoiding a doomed install retried on every startup - Track per-distro reconciliation against launcher target + app version so unchanged registrations aren't re-probed each boot - Replace command install with a single atomic rename instead of a move-based backup, closing a window where no orca-ide exists - Remove the registry invalidate-on-persist-failure path now that writes are atomic and repair is disk-authoritative - Add brief negative caching to WSL distro discovery to bound wsl.exe respawns on persistently broken hosts - Extract keyed-promise-queue as a shared serialization primitive
59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { runSerializedWslCliRegistrationOperation } from './wsl-cli-registration-operation'
|
|
|
|
describe('runSerializedWslCliRegistrationOperation', () => {
|
|
it('serializes operations for distro names with different casing', async () => {
|
|
let releaseFirst!: () => void
|
|
const events: string[] = []
|
|
const first = runSerializedWslCliRegistrationOperation('Ubuntu', async () => {
|
|
events.push('first-start')
|
|
await new Promise<void>((resolve) => {
|
|
releaseFirst = resolve
|
|
})
|
|
events.push('first-end')
|
|
})
|
|
|
|
await vi.waitFor(() => expect(events).toEqual(['first-start']))
|
|
const second = runSerializedWslCliRegistrationOperation(' ubuntu ', async () => {
|
|
events.push('second')
|
|
})
|
|
await Promise.resolve()
|
|
expect(events).toEqual(['first-start'])
|
|
|
|
releaseFirst()
|
|
await Promise.all([first, second])
|
|
expect(events).toEqual(['first-start', 'first-end', 'second'])
|
|
})
|
|
|
|
it('allows different distros to progress independently', async () => {
|
|
let releaseUbuntu!: () => void
|
|
const events: string[] = []
|
|
const ubuntu = runSerializedWslCliRegistrationOperation('Ubuntu', async () => {
|
|
events.push('ubuntu-start')
|
|
await new Promise<void>((resolve) => {
|
|
releaseUbuntu = resolve
|
|
})
|
|
})
|
|
const debian = runSerializedWslCliRegistrationOperation('Debian', async () => {
|
|
events.push('debian')
|
|
})
|
|
|
|
await debian
|
|
expect(events).toEqual(['ubuntu-start', 'debian'])
|
|
releaseUbuntu()
|
|
await ubuntu
|
|
})
|
|
|
|
it('releases the queue after an operation fails', async () => {
|
|
await expect(
|
|
runSerializedWslCliRegistrationOperation('Ubuntu', async () => {
|
|
throw new Error('interop failed')
|
|
})
|
|
).rejects.toThrow('interop failed')
|
|
|
|
await expect(
|
|
runSerializedWslCliRegistrationOperation('ubuntu', async () => 'recovered')
|
|
).resolves.toBe('recovered')
|
|
})
|
|
})
|