feat(editor): a clear final state once the engine spent its three recoveries (canvas and action alerts)
This commit is contained in:
1 parent
f0580922b5
commit
0279953e9e
19 files changed
+101
-16
No files matched your search
@@ -74,6 +74,14 @@ export class CoreRuntime {
|
||||
return this.state
|
||||
}
|
||||
|
||||
/**
|
||||
* The recovery cap is spent: no retry can bring the module back on this page (owner
|
||||
* decision 2026-10-15: three attempts, then a clear failure state; a reload starts again).
|
||||
*/
|
||||
get stopped(): boolean {
|
||||
return this.state === 'unavailable' && this.recoveries >= this.maxRecoveries
|
||||
}
|
||||
|
||||
/** Loads the module on first use; true when calls can be made. */
|
||||
ready(): Promise<boolean> {
|
||||
if (this.state === 'ready') return Promise.resolve(true)
|
||||
|
||||
@@ -108,14 +108,26 @@ describe('core runtime', () => {
|
||||
await runtime.ready()
|
||||
trap(runtime)
|
||||
expect(await runtime.ready()).toBe(true)
|
||||
expect(runtime.stopped).toBe(false)
|
||||
trap(runtime)
|
||||
expect(runtime.status).toBe('unavailable')
|
||||
expect(runtime.stopped).toBe(true)
|
||||
expect(await runtime.retry()).toBe(false)
|
||||
expect(runtime.call('core_version', '')).toMatchObject({
|
||||
kind: 'core_unavailable',
|
||||
})
|
||||
})
|
||||
|
||||
it('is not stopped by a load failure, which a retry can still fix', async () => {
|
||||
const runtime = new CoreRuntime({
|
||||
compile: () => Promise.reject(new WebAssembly.CompileError('blocked')),
|
||||
importGlue: () => Promise.reject(new TypeError('offline')),
|
||||
})
|
||||
expect(await runtime.ready()).toBe(false)
|
||||
expect(runtime.status).toBe('unavailable')
|
||||
expect(runtime.stopped).toBe(false)
|
||||
})
|
||||
|
||||
it('reports a load failure and loads again on retry', async () => {
|
||||
const inner = nodeCoreSource('pkg')
|
||||
let failNext = true
|
||||
|
||||
Reference in new issue
Block a user