Close startup and recovery transaction gaps

This commit is contained in:
Sucukdeluxe
2026-08-13 21:37:00 +02:00
parent c1003074cd
commit 1dd0e32709
6 changed files with 69 additions and 23 deletions
+27
View File
@@ -28,6 +28,7 @@ test('main process wires bounded startup recovery into real load and crash paths
assert.match(source, /createStartupRecoveryCoordinator/);
assert.match(source, /startupRecoveryCoordinator\.loadInitial/);
assert.match(source, /startupRecoveryCoordinator\.rendererCrashed/);
assert.match(source, /startupRecoveryCoordinator\.rendererInitializationFailed/);
assert.match(source, /startupRecoveryCoordinator\.rendererReady/);
assert.match(source, /createStartupFailureDocument/);
});
@@ -284,6 +285,32 @@ test('renderer crash recovery reloads once and cannot enter an infinite reload l
assert.equal(revealCalls, 1);
});
test('renderer initialization failures share the bounded recovery path', async () => {
const failures = [];
let reloadCalls = 0;
const coordinator = createStartupRecoveryCoordinator({
load() {},
async reload() {
reloadCalls++;
},
reveal() {},
async showFailure(failure) {
failures.push(failure);
},
close() {}
});
await coordinator.rendererInitializationFailed({ message: 'first failure' });
await coordinator.rendererInitializationFailed({ message: 'second failure' });
assert.equal(reloadCalls, 1);
assert.deepEqual(failures, [{
phase: 'renderer-initialization',
attempt: 2,
details: { message: 'second failure' }
}]);
});
test('a successful renderer ready event reveals content and resets crash recovery', async () => {
const crashes = [
{ reason: 'crashed', exitCode: 21 },