fix: retain renderer exit details in diagnostic logs

Persist Electron renderer exit reasons and exit codes through diagnostic writes, reads, and exports so abnormal window exits can be investigated. Keep older records readable and existing log bounds unchanged.

Validation: 18 focused tests, typecheck, lint, and diff checks passed. Full test run timed out after 60 seconds with a SettingsPanel test failure.

Release note: Diagnostic logs now retain renderer exit reasons and exit codes to help distinguish out-of-memory exits from other window failures.
This commit is contained in:
mesalogo
2026-09-28 11:36:01 +08:00
parent 4e5239256d
commit 61590395ef
5 changed files with 66 additions and 6 deletions
+6 -1
View File
@@ -78,7 +78,12 @@ describe('window recovery', () => {
gone({}, { reason: 'crashed', exitCode: 1 })
expect(dialog.showMessageBox).toHaveBeenCalledTimes(before + 1)
expect(window.webContents.reload).not.toHaveBeenCalled()
expect(observe).toHaveBeenCalledWith(expect.objectContaining({ code: 'desktop.renderer.gone' }))
expect(observe).toHaveBeenNthCalledWith(1, expect.objectContaining({
code: 'desktop.renderer.gone', reason: 'oom', exitCode: 9
}))
expect(observe).toHaveBeenNthCalledWith(2, expect.objectContaining({
code: 'desktop.renderer.gone', reason: 'crashed', exitCode: 1
}))
respond({ response: 0, checkboxChecked: false })
await vi.waitFor(() => expect(window.webContents.reload).toHaveBeenCalledOnce())
gone({}, { reason: 'crashed', exitCode: 1 })