mirror of
https://github.com/stablyai/orca.git
synced 2026-09-21 16:02:20 +00:00
* Harden layout validation, watcher lifecycle, and connection robustness - Throw instead of silently skipping when the packaged daemon-entry is missing, preventing layout regressions from passing build checks. - Terminate idle parcel-watcher processes to reclaim native handles and avoid crash-prone native node module teardowns on shutdown. - Bind the persisted WS fallback port first to prevent orphaning active mobile pairings when the preferred port becomes free again. - Cap concurrent disk reads for restored dirty tab verification at three to prevent startup connection bottlenecks on remote SSH workspaces. * Queue file IDs instead of snapshots in restored conflict scans This avoids using stale file snapshots (e.g., outdated disk signatures) if a tab is saved, closed, or re-baselined while waiting in the queue behind the concurrency limit. The live state is now fetched from the store and validated immediately before initiating the disk read.
58 lines
2.1 KiB
JavaScript
58 lines
2.1 KiB
JavaScript
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
import { createRequire } from 'node:module'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
|
|
const require = createRequire(import.meta.url)
|
|
const {
|
|
assertPackagedDaemonEntryExists,
|
|
verifyPackagedDaemonEntryBoots
|
|
} = require('./verify-packaged-daemon-entry.cjs')
|
|
|
|
describe('verify-packaged-daemon-entry', () => {
|
|
let resourcesDir
|
|
|
|
beforeEach(() => {
|
|
resourcesDir = mkdtempSync(join(tmpdir(), 'orca-daemon-entry-verify-'))
|
|
})
|
|
|
|
afterEach(() => {
|
|
rmSync(resourcesDir, { recursive: true, force: true })
|
|
})
|
|
|
|
function writePackagedEntry(source) {
|
|
const entryDir = join(resourcesDir, 'app.asar.unpacked', 'out', 'main')
|
|
mkdirSync(entryDir, { recursive: true })
|
|
writeFileSync(join(entryDir, 'daemon-entry.js'), source)
|
|
}
|
|
|
|
// Why: a silent skip on a missing entry false-passed exactly the packaged
|
|
// layout regression this gate exists to catch (rc.1 daemon-load incident).
|
|
it('throws when the unpacked daemon entry is missing', () => {
|
|
expect(() => assertPackagedDaemonEntryExists(resourcesDir)).toThrow(
|
|
/missing unpacked daemon entry/
|
|
)
|
|
expect(() => verifyPackagedDaemonEntryBoots(resourcesDir)).toThrow(
|
|
/missing unpacked daemon entry/
|
|
)
|
|
})
|
|
|
|
it('passes when the packaged entry loads and reaches argv parsing', () => {
|
|
writePackagedEntry('console.error("Usage: daemon-entry <socket>"); process.exit(1)\n')
|
|
expect(() => verifyPackagedDaemonEntryBoots(resourcesDir)).not.toThrow()
|
|
})
|
|
|
|
it('fails when the packaged entry cannot resolve its module graph', () => {
|
|
writePackagedEntry('require("orca-module-that-does-not-exist")\n')
|
|
expect(() => verifyPackagedDaemonEntryBoots(resourcesDir)).toThrow(
|
|
/failed to load under plain Node/
|
|
)
|
|
})
|
|
|
|
it('fails when the packaged entry never reaches argv parsing', () => {
|
|
writePackagedEntry('process.exit(0)\n')
|
|
expect(() => verifyPackagedDaemonEntryBoots(resourcesDir)).toThrow(/did not reach argv parsing/)
|
|
})
|
|
})
|