Files
mirror 34fa2cd5ca
Skill update round trip / roundtrip (false, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, latest) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
source snapshot 2026-09-02
2026-09-02 02:03:16 +08:00

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
}
}