* test(e2e): prove the terminal daemon survives a main-process crash on Windows (#7742) Add a win-crash-survival e2e harness (sibling to win-update-e2e) that force-kills ONLY the packaged app's real Electron main (resolved via app.evaluate -> process.pid, /F no /T) and asserts the detached orca-terminal-daemon.exe plus its ConPTY shell survive with no pwsh 0xE9 FailFast, then that a relaunch re-adopts the SAME daemon and the reattached UI binds to the SAME survivor shell (proved via a per-shell env sentinel read back through the restored terminal). This guards the #7742 fix (standalone relocated daemon that outlives main death) against regression. A directional `--expect orphaned` profile fails on a fixed build, keeping the survival assertions honest. Windows-only; reuses win-update-e2e app-driver/daemon-process modules. * test(e2e): harden Windows crash-survival proof * test(ci): keep crash survival gate durable * test(e2e): tolerate restart hydration navigation * test(e2e): prove exact shell input after crash * perf(ci): avoid crash harness installer rebuilds * test(ci): harden crash survival evidence and cost * test(e2e): fail closed on authoritative crash target * test(e2e): fail closed on crash liveness evidence --------- Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
// Resolve one authoritative daemon identity from the userData-scoped process
|
|
// scan and its advisory PID file metadata.
|
|
|
|
/**
|
|
* Require exactly one live, scoped daemon and cross-check any PID-file record.
|
|
* The process command line owns identity; a stale PID file must never turn an
|
|
* unrelated recycled PID into false crash-survival evidence.
|
|
*/
|
|
export function selectScopedDaemon(pidFiles, scannedProcesses) {
|
|
if (scannedProcesses.length !== 1) {
|
|
throw new Error(`expected exactly one userData-scoped daemon, found ${scannedProcesses.length}`)
|
|
}
|
|
|
|
const processRecord = scannedProcesses[0]
|
|
const numericPidFiles = pidFiles.filter((record) => Number.isInteger(record.pid))
|
|
const matchingPidFile = numericPidFiles.find((record) => record.pid === processRecord.pid)
|
|
if (numericPidFiles.length > 0 && !matchingPidFile) {
|
|
throw new Error(
|
|
`daemon PID file does not match scoped live daemon ${processRecord.pid} ` +
|
|
`(recorded: ${numericPidFiles.map((record) => record.pid).join(', ')})`
|
|
)
|
|
}
|
|
|
|
return {
|
|
pid: processRecord.pid,
|
|
appVersion: matchingPidFile?.appVersion ?? null
|
|
}
|
|
}
|