Skip to content

Conversation

@nrainhart
Copy link
Contributor

@nrainhart nrainhart commented Jan 8, 2026

Description

Started seeing this console errors in tests after merging #3320:

stderr | src/tests/sync.garbageCollection.test.ts > sync after the garbage collector has run > loading a coValue from the sync server that was removed by the garbage collector
Failed to persist batched unsynced CoValue tracking {
  err: SqliteError: attempt to write a readonly database
      at convertError (/Users/guidodorsi/workspace/jazz/node_modules/libsql/index.js:59:12)
      at Statement.run (/Users/guidodorsi/workspace/jazz/node_modules/libsql/index.js:333:13)
      at LibSQLSqliteSyncDriver.run (/Users/guidodorsi/workspace/jazz/packages/cojson/src/tests/testStorage.ts:67:26)
      at SQLiteClient.trackCoValuesSyncState (/Users/guidodorsi/workspace/jazz/packages/cojson/src/storage/sqlite/client.ts:216:17)
      at StorageApiSync.trackCoValuesSyncState (/Users/guidodorsi/workspace/jazz/packages/cojson/src/storage/storageSync.ts:406:19)
      at /Users/guidodorsi/workspace/jazz/packages/cojson/src/UnsyncedCoValuesTracker.ts:153:17
      at new Promise (<anonymous>)
      at UnsyncedCoValuesTracker.flush (/Users/guidodorsi/workspace/jazz/packages/cojson/src/UnsyncedCoValuesTracker.ts:151:12)
      at UnsyncedCoValuesTracker.forcePersist (/Users/guidodorsi/workspace/jazz/packages/cojson/src/UnsyncedCoValuesTracker.ts:113:17)
      at SyncManager.gracefulShutdown (/Users/guidodorsi/workspace/jazz/packages/cojson/src/sync.ts:1154:33) {
    code: 'SQLITE_READONLY_DBMOVED',
    rawCode: 1032
  }
}

They were caused by vitest onTestFinished hooks closing storage before the node shutdown was actually completed (which includes tracking the CoValues' sync state in persistent storage).


Note

Ensures test nodes fully flush and persist sync state before storage is closed, preventing readonly DB errors during teardown.

  • Make onTestFinished teardown async and await node.gracefulShutdown() in testUtils.ts
  • Remove unused vitest and helper imports in sync.garbageCollection.test.ts and sync.test.ts

Written by Cursor Bugbot for commit c2b0210. This will update automatically on new commits. Configure here.

@nrainhart nrainhart requested a review from gdorsi January 8, 2026 17:16
@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
clerk-demo Building Building Preview, Comment Jan 8, 2026 5:18pm
design-system Building Building Preview, Comment Jan 8, 2026 5:18pm
file-upload-demo Building Building Preview, Comment Jan 8, 2026 5:18pm
form-demo Building Building Preview, Comment Jan 8, 2026 5:18pm
gcmp-homepage Building Building Preview, Comment Jan 8, 2026 5:18pm
image-upload-demo Ready Ready Preview, Comment Jan 8, 2026 5:18pm
jazz-chat Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-chat-1 Ready Ready Preview, Comment Jan 8, 2026 5:18pm
jazz-chat-2 Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-filestream Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-homepage Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-image-upload Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-inspector Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-multi-cursors Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-nextjs Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-organization Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-paper-scissors Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-richtext Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-todo Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-vector-search Building Building Preview, Comment Jan 8, 2026 5:18pm
jazz-version-history Building Building Preview, Comment Jan 8, 2026 5:18pm
music-demo Building Building Preview, Comment Jan 8, 2026 5:18pm
passkey-demo Building Building Preview, Comment Jan 8, 2026 5:18pm
passphrase-auth-demo Building Building Preview, Comment Jan 8, 2026 5:18pm
quint-ui Building Building Preview, Comment Jan 8, 2026 5:18pm

@gdorsi gdorsi merged commit 8b7bf36 into main Jan 8, 2026
16 of 39 checks passed
@gdorsi gdorsi deleted the fix/node-shutdown-in-tests branch January 8, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants