You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app/src/embed.test.ts intermittently fails CI with an unhandled rejection after the jsdom environment is torn down:
ReferenceError: localStorage is not defined
❯ migrateLegacyDevice src/lib/identity.ts:204:18
❯ loadStoredDevice src/lib/identity.ts:227:26
❯ loadIdentity src/lib/identity.ts:452:27
❯ src/App.tsx:350:30
This error originated in "src/embed.test.ts" test file ... caught after test environment was torn down.
The embed tests mount App, which starts async identity loading (loadIdentity → IndexedDB → localStorage) in an effect. The tests only await a single setTimeout(0) tick, so that work can still be running when Vitest tears down jsdom, and the next localStorage access throws.
Acceptance criteria
The embed tests no longer leave identity loading running past teardown, for example by waiting for it to settle before unmounting or by stubbing loadIdentity in these tests.
Alternatively, or additionally, the identity loading effect in App ignores or cancels work after unmount.
pnpm run test passes reliably with no unhandled rejections, repeated (e.g. 20 consecutive runs of embed.test.ts).
Activity
lsegal commentedon Oct 3, 2026
Starting work on this issue /glorp:45E62B60
Checkpoint issue #5 progress
Fix flaky embed tests: identity loading outlives jsdom teardown