Tighten recovery toast test cleanup

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
brennanb2025
2026-06-24 15:02:41 -07:00
co-authored by Orca
parent 07ee754310
commit 282c627e32
2 changed files with 27 additions and 15 deletions
@@ -49,6 +49,8 @@ function classifyErrorMessage(message: string): string {
const normalized = message.toLowerCase()
const looksLikeJsonParseFailure =
normalized.includes('json') || normalized.includes('not valid json')
// Why: recovery should catch broken emitted JS chunks without treating
// ordinary data-parse failures as app-shell corruption.
if (
(!looksLikeJsonParseFailure &&
(normalized.includes('unexpected token') ||
@@ -59,6 +61,8 @@ function classifyErrorMessage(message: string): string {
) {
return 'syntax'
}
// Why: browsers report dynamic import failures differently, but these all
// indicate a missing/stale chunk that a guarded reload may repair.
if (
normalized.includes('failed to fetch dynamically imported module') ||
normalized.includes('error loading dynamically imported module') ||
@@ -77,6 +81,8 @@ function classifyErrorCategory(messageClass: string, errorName: string): string
if (messageClass === 'syntax') {
return 'syntax'
}
// Why: webpack-style chunk failures can arrive as a name without a useful
// message, so keep the name as a narrow fetch fallback.
if (messageClass === 'fetch' || errorName === 'ChunkLoadError') {
return 'fetch'
}
+21 -15
View File
@@ -78,20 +78,26 @@ test('explains guarded renderer recovery once after reload or restart markers',
)
.toBeNull()
await orcaPage.evaluate(async () => {
await window.api.settings.set({ uiLanguage: 'es' })
})
await seedRecoveryMarker(orcaPage, 'session', 'lazy-chunk-reload')
await orcaPage.reload()
await waitForRendererBoot(orcaPage)
try {
await orcaPage.evaluate(async () => {
await window.api.settings.set({ uiLanguage: 'es' })
})
await seedRecoveryMarker(orcaPage, 'session', 'lazy-chunk-reload')
await orcaPage.reload()
await waitForRendererBoot(orcaPage)
await expect(orcaPage.getByText('Orca se recargó para recuperarse')).toBeVisible()
await expect(
orcaPage.getByText('Se recuperó de un error de carga recargando la interfaz de la app.')
).toBeVisible()
await expect
.poll(() =>
orcaPage.evaluate((key) => window.sessionStorage.getItem(key), SESSION_NOTIFICATION_KEY)
)
.toBeNull()
await expect(orcaPage.getByText('Orca se recargó para recuperarse')).toBeVisible()
await expect(
orcaPage.getByText('Se recuperó de un error de carga recargando la interfaz de la app.')
).toBeVisible()
await expect
.poll(() =>
orcaPage.evaluate((key) => window.sessionStorage.getItem(key), SESSION_NOTIFICATION_KEY)
)
.toBeNull()
} finally {
await orcaPage.evaluate(async () => {
await window.api.settings.set({ uiLanguage: 'en' })
})
}
})