inspector/clients/web/src/test
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Cliff Hall e1c8f71924
fix(storage): await store-file writes instead of polling (#1412) (#1413)
* fix(storage): await store-file writes instead of polling (#1412)

OAuth persistence is Zustand `persist` → file-storage adapter →
writeStoreFile, which the persist middleware invokes fire-and-forget:
saveTokens updates the in-memory store synchronously while the file
write lags. Tests verified persistence by polling the state file with a
2s/50ms `waitForStateFile()` budget, which flaked under full-suite load
(the file was written, the poll just didn't observe it in time).

Make the write completion awaitable instead:
- Track in-flight writeStoreFile() promises per resolved path in
  store-io and add flushStoreFileWrites(filePath?) to await them (also
  useful for graceful shutdown). Writes to the same path are chained so a
  flush awaits every queued write.
- Convert the OAuth E2E, node storage, and file-storage-adapter tests
  from poll loops (waitForStateFile / vi.waitFor on existsSync /
  setTimeout) to `await flushStoreFileWrites(path)` + a single read.
- Remove the now-unused waitForStateFile() test helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(storage): doc load-bearing sync registration; rename stale debug env

Address @claude review on #1413:
- Document that writeStoreFile()'s synchronous pendingWrites registration is
  load-bearing for flushStoreFileWrites(), in both the storage adapter's
  setItem callsite and the pendingWrites docblock, so future refactors don't
  introduce an await before registration and silently re-flake the tests.
- Rename the stale DEBUG_WAIT_FOR_STATE_FILE test env var to DEBUG_PERSIST_PATH
  (waitForStateFile was removed in this PR).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 11:55:24 -04:00
..
core feat(apps): render running MCP Apps end-to-end (#1370) (#1403) 2026-06-01 18:01:44 -04:00
fixtures feat(apps): add AppListItem and AppDetailPanel groups (#1261) (#1273) 2026-05-04 10:28:58 -04:00
integration fix(storage): await store-file writes instead of polling (#1412) (#1413) 2026-06-02 11:55:24 -04:00
lib feat(export): wire History + Logs export JSON handlers (#1354) (#1367) 2026-05-27 19:06:28 -04:00
server chore(web): silence benign config-load dep warnings in npm run dev (#1408) 2026-06-01 19:48:12 -04:00
renderWithMantine.tsx test(coverage): bootstrap vitest unit infra and add tests at 90%+ per file (#1245) (#1269) 2026-05-01 15:15:32 -04:00
setup.ts feat(sort): add SortToggle for Logs, History, and Network (#1371) (#1372) 2026-05-29 14:47:19 -04:00