test: add T1 Hands audit report and baseline results
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

Phase 1 baseline + T1 Hands functional audit:
- Desktop vitest: 174/185 passed (chatStore refactoring)
- Admin vitest: 36/71 passed (API mock issues)
- Cargo check: 0 errors
- T1 Hands: 18/23 TCs executed, health 58→68 (+10)
- Key findings: M3-01/M3-06 fixed, M3-02/M3-04 unfixed
- New P1: LLM API concurrent DATABASE_ERROR
This commit is contained in:
iven
2026-04-05 18:19:32 +08:00
parent 0a3ba2fad4
commit 5877e794fa
9 changed files with 7512 additions and 0 deletions

View File

@@ -0,0 +1,478 @@
[vite:react-babel] We recommend switching to `@vitejs/plugin-react-oxc` for improved performance. More information at https://vite.dev/rolldown
 RUN  v2.1.9 G:/ZClaw_openfang/desktop
stderr | tests/lib/request-helper.test.ts > request-helper > requestWithRetry > should retry on retryable status codes
[RequestHelper] Request failed (503), retrying in 11ms (attempt 1/2)
✓ tests/lib/crypto-utils.test.ts (10 tests) 69ms
stderr | tests/lib/request-helper.test.ts > request-helper > requestWithRetry > should throw after all retries exhausted
[RequestHelper] Request failed (503), retrying in 12ms (attempt 1/2)
stderr | tests/lib/request-helper.test.ts > request-helper > requestWithRetry > should throw after all retries exhausted
[RequestHelper] Request failed (503), retrying in 22ms (attempt 2/2)
stdout | tests/lib/request-helper.test.ts > request-helper > RequestManager > should cancel all requests
[RequestHelper] Cancelled request: test-1
[RequestHelper] Cancelled request: test-2
[RequestHelper] Cancelled request: test-3
✓ tests/lib/request-helper.test.ts (30 tests | 1 skipped) 101ms
stdout | tests/lib/security.test.ts > Security Utils > sanitizeJson > should return null for invalid JSON
[SecurityUtils] JSON sanitize parse failed {
error: SyntaxError: Unexpected token 'o', "not json" is not valid JSON
at JSON.parse (<anonymous>)
at Module.sanitizeJson (G:\ZClaw_openfang\desktop\src\lib\security-utils.ts:549:25)
at G:\ZClaw_openfang\desktop\tests\lib\security.test.ts:356:28
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:533:11
at runWithTimeout (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:39:7)
at runTest (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:1056:17)
 at processTicksAndRejections (node:internal/process/task_queues:104:5)
at runSuite (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:1205:15)
at runSuite (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:1205:15)
}
✓ tests/lib/security.test.ts (58 tests) 250ms
stderr | tests/toml-utils.test.ts > tomlUtils > parse > should throw TomlParseError on invalid TOML
[TOML] Parse error: TomlError: Invalid TOML document: incomplete key-value: cannot find end of key
2: [invalid
^
3: key = value
at parseKey (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/struct.js:38:15)
at Object.parse (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/parse.js:104:21)
at Object.parse (G:\ZClaw_openfang\desktop\src\lib\toml-utils.ts:61:19)
at G:\ZClaw_openfang\desktop\tests\toml-utils.test.ts:72:30
at Proxy.<anonymous> (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+expect@2.1.9/node_modules/@vitest/expect/dist/index.js:1530:11)
at Proxy.<anonymous> (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+expect@2.1.9/node_modules/@vitest/expect/dist/index.js:972:17)
at Proxy.methodWrapper (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.js:1686:25)
at G:\ZClaw_openfang\desktop\tests\toml-utils.test.ts:72:50
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:533:11 {
line: 2,
column: 2,
codeblock: '2: [invalid\n ^\n3: key = value\n'
}
stderr | tests/toml-utils.test.ts > tomlUtils > stringify > should throw TomlStringifyError on invalid data
[TOML] Stringify error: Error: Could not stringify the object: maximum object depth exceeded
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:125:15)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
at stringifyTable (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js:143:46)
stderr | tests/toml-utils.test.ts > tomlUtils > resolveEnvVars > should return empty string for missing env vars
[TOML] Environment variable MISSING_VAR not resolved - no envVars provided
✓ tests/toml-utils.test.ts (14 tests) 22ms
✓ tests/config-parser.test.ts (13 tests) 14ms
stderr | tests/lib/secure-storage.test.ts > secureStorage > error handling > should handle corrupted encrypted data gracefully
[SecureStorage] v2 decryption failed for key: corrupted-key
[SecureStorage] v1 decryption failed for key: corrupted-key
✓ tests/lib/secure-storage.test.ts (11 tests) 258ms
stderr | tests/store/chatStore.test.ts
[IDBStorage] Migration from localStorage failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at migrateFromLocalStorage (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:56:22)
at Object.getItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:98:15)
at Object.getItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:292:33)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:305:20
at hydrate (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:388:53)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:468:5
at createStoreImpl (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/vanilla.mjs:19:32)
at createStore (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/vanilla.mjs:22:53)
[IDBStorage] IndexedDB getItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.getItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:102:26)
 at processTicksAndRejections (node:internal/process/task_queues:104:5)
✓ tests/lib/gateway-security.test.ts (13 tests) 570ms
✓ WebSocket Security > SecurityError > should be throwable with a message 413ms
 tests/stabilization.test.ts (0 test)
stderr | tests/store/chatStore.test.ts > chatStore > setCurrentModel > should update current model
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.setCurrentModel (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:324:39)
at setCurrentModel (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:154:37)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:269:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > newConversation > should clear messages and reset session
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.newConversation (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:203:5)
at newConversation (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:159:37)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:289:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > newConversation > should save current messages to conversations before clearing
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.newConversation (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:203:5)
at newConversation (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:159:37)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:308:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > switchConversation > should switch to existing conversation
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.newConversation (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:203:5)
at newConversation (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:159:37)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:328:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > deleteConversation > should delete conversation by id
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.newConversation (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:203:5)
at newConversation (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:159:37)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:360:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > deleteConversation > should clear messages if deleting current conversation
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.deleteConversation (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:244:7)
at deleteConversation (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:173:30)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:397:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > setCurrentAgent > should update current agent
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.setCurrentAgent (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:289:5)
at setCurrentAgent (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:133:52)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:418:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > setCurrentAgent > should save current conversation when switching agents
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.setCurrentAgent (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:252:7)
at setCurrentAgent (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:133:52)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:444:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > syncAgents > should sync agents from profiles
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.syncAgents (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:320:5)
at syncAgents (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:141:37)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:455:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > syncAgents > should use default agent when no profiles provided
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.syncAgents (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:320:5)
at syncAgents (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:141:37)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:469:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
stderr | tests/store/chatStore.test.ts > chatStore > conversation persistence > should derive title from first user message
[IDBStorage] IndexedDB setItem failed: ReferenceError: indexedDB is not defined
at Module.openDB (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/idb@8.0.3/node_modules/idb/build/index.js:168:21)
at getDB (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:34:17)
at Object.setItem (G:\ZClaw_openfang\desktop\src\lib\idb-storage.ts:117:26)
at Object.setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:298:42)
at setItem (file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:358:20)
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:371:14
at Object.newConversation (G:\ZClaw_openfang\desktop\src\store\chat\conversationStore.ts:203:5)
at newConversation (G:\ZClaw_openfang\desktop\src\store\chatStore.ts:159:37)
at G:\ZClaw_openfang\desktop\tests\store\chatStore.test.ts:645:7
at file:///G:/ZClaw_openfang/desktop/node_modules/.pnpm/@vitest+runner@2.1.9/node_modules/@vitest/runner/dist/index.js:146:14
 tests/store/chatStore.test.ts (36 tests | 10 failed) 36ms
 × chatStore > setCurrentModel > should update current model 7ms
 → expected 'glm-5' to be 'gpt-4' // Object.is equality
 × chatStore > newConversation > should clear messages and reset session 4ms
 → expected 'old-session' to be null
 × chatStore > newConversation > should save current messages to conversations before clearing 1ms
 → expected 0 to be greater than 0
 × chatStore > switchConversation > should switch to existing conversation 1ms
 → Cannot read properties of undefined (reading 'id')
 × chatStore > deleteConversation > should delete conversation by id 1ms
 → Cannot read properties of undefined (reading 'id')
 × chatStore > deleteConversation > should clear messages if deleting current conversation 4ms
 → expected [ { id: 'msg-1', role: 'user', …(2) } ] to deeply equal []
 × chatStore > setCurrentAgent > should update current agent 2ms
 → expected { id: '1', name: 'ZCLAW', …(4) } to deeply equal { id: 'agent-2', …(5) }
 × chatStore > setCurrentAgent > should save current conversation when switching agents 1ms
 → expected [ { id: 'msg-1', role: 'user', …(2) } ] to deeply equal []
 × chatStore > syncAgents > should sync agents from profiles 2ms
 → expected [ { id: '1', name: 'ZCLAW', …(4) } ] to have a length of 2 but got 1
 × chatStore > conversation persistence > should derive title from first user message 1ms
 → Cannot read properties of undefined (reading 'title')
⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯
 FAIL  tests/stabilization.test.ts [ tests/stabilization.test.ts ]
TypeError: Cannot read properties of undefined (reading 'hasHydrated')
  Object.onRehydrateStorage src/store/chatStore.ts:265:42
263| 
264|  // If conversationStore already hydrated (fast path), sync imm…
265|  if (useConversationStore.persist.hasHydrated()) {
 |  ^
266|  syncMessages();
267|  return;
  hydrate node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:387:94
  node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/middleware.mjs:468:5
  createStoreImpl node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/vanilla.mjs:19:32
  createStore node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/vanilla.mjs:22:53
  createImpl node_modules/.pnpm/zustand@5.0.12_@types+react_8b11772aea488cca440c1215797a0d95/node_modules/zustand/esm/react.mjs:15:15
  src/store/chatStore.ts:105:47
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/11]⎯
⎯⎯⎯⎯⎯⎯ Failed Tests 10 ⎯⎯⎯⎯⎯⎯⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > setCurrentModel > should update current model
AssertionError: expected 'glm-5' to be 'gpt-4' // Object.is equality
Expected: "gpt-4"
Received: "glm-5"
  tests/store/chatStore.test.ts:272:34
270| 
271|  const state = useChatStore.getState();
272|  expect(state.currentModel).toBe('gpt-4');
 |  ^
273|  });
274|  });
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > newConversation > should clear messages and reset session
AssertionError: expected 'old-session' to be null
- Expected:
null
+ Received:
"old-session"
  tests/store/chatStore.test.ts:293:32
291|  const state = useChatStore.getState();
292|  expect(state.messages).toEqual([]);
293|  expect(state.sessionKey).toBeNull();
 |  ^
294|  expect(state.isStreaming).toBe(false);
295|  expect(state.currentConversationId).toBeNull();
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > newConversation > should save current messages to conversations before clearing
AssertionError: expected 0 to be greater than 0
  tests/store/chatStore.test.ts:312:42
310|  const state = useChatStore.getState();
311|  // Conversation should be saved
312|  expect(state.conversations.length).toBeGreaterThan(0);
 |  ^
313|  expect(state.conversations[0].messages[0].content).toBe('Test me…
314|  });
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > switchConversation > should switch to existing conversation
TypeError: Cannot read properties of undefined (reading 'id')
  tests/store/chatStore.test.ts:338:66
336|  });
337| 
338|  const firstConvId = useChatStore.getState().conversations[0].id;
 |  ^
339| 
340|  // Switch back to first conversation
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > deleteConversation > should delete conversation by id
TypeError: Cannot read properties of undefined (reading 'id')
  tests/store/chatStore.test.ts:362:61
360|  newConversation();
361| 
362|  const convId = useChatStore.getState().conversations[0].id;
 |  ^
363|  expect(useChatStore.getState().conversations).toHaveLength(1);
364| 
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[6/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > deleteConversation > should clear messages if deleting current conversation
AssertionError: expected [ { id: 'msg-1', role: 'user', …(2) } ] to deeply equal []
- Expected
+ Received
- Array []
+ Array [
+ Object {
+ "content": "Test",
+ "id": "msg-1",
+ "role": "user",
+ "timestamp": 2026-04-05T09:57:37.097Z,
+ },
+ ]
  tests/store/chatStore.test.ts:400:30
398| 
399|  const state = useChatStore.getState();
400|  expect(state.messages).toEqual([]);
 |  ^
401|  expect(state.sessionKey).toBeNull();
402|  expect(state.currentConversationId).toBeNull();
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[7/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > setCurrentAgent > should update current agent
AssertionError: expected { id: '1', name: 'ZCLAW', …(4) } to deeply equal { id: 'agent-2', …(5) }
- Expected
+ Received
 Object {
- "color": "bg-blue-500",
- "icon": "A",
- "id": "agent-2",
- "lastMessage": "Hello",
- "name": "New Agent",
+ "color": "bg-gradient-to-br from-orange-500 to-red-500",
+ "icon": "🦞",
+ "id": "1",
+ "lastMessage": "发送消息开始对话",
+ "name": "ZCLAW",
 "time": "",
 }
  tests/store/chatStore.test.ts:421:34
419| 
420|  const state = useChatStore.getState();
421|  expect(state.currentAgent).toEqual(newAgent);
 |  ^
422|  });
423| 
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[8/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > setCurrentAgent > should save current conversation when switching agents
AssertionError: expected [ { id: 'msg-1', role: 'user', …(2) } ] to deeply equal []
- Expected
+ Received
- Array []
+ Array [
+ Object {
+ "content": "Test message",
+ "id": "msg-1",
+ "role": "user",
+ "timestamp": 2026-04-05T09:57:37.103Z,
+ },
+ ]
  tests/store/chatStore.test.ts:447:48
445| 
446|  // Messages should be cleared for new agent
447|  expect(useChatStore.getState().messages).toEqual([]);
 |  ^
448|  });
449|  });
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[9/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > syncAgents > should sync agents from profiles
AssertionError: expected [ { id: '1', name: 'ZCLAW', …(4) } ] to have a length of 2 but got 1
- Expected
+ Received
- 2
+ 1
  tests/store/chatStore.test.ts:461:28
459| 
460|  const state = useChatStore.getState();
461|  expect(state.agents).toHaveLength(2);
 |  ^
462|  expect(state.agents[0].name).toBe('Agent One');
463|  expect(state.agents[1].name).toBe('Agent Two');
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[10/11]⎯
 FAIL  tests/store/chatStore.test.ts > chatStore > conversation persistence > should derive title from first user message
TypeError: Cannot read properties of undefined (reading 'title')
  tests/store/chatStore.test.ts:648:37
646| 
647|  const state = useChatStore.getState();
648|  expect(state.conversations[0].title).toContain('This is a long m…
 |  ^
649|  expect(state.conversations[0].title.length).toBeLessThanOrEqual(…
650|  });
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[11/11]⎯
 Test Files  2 failed | 7 passed (9)
 Tests  10 failed | 174 passed | 1 skipped (185)
 Start at  17:56:49
 Duration  47.19s (transform 1.84s, setup 57.03s, collect 16.08s, tests 1.32s, environment 222.17s, prepare 10.17s)