When calling replica.sync() with IndexedDbStorage in a browser, sync fails with (in Chrome): InvalidStateError: Failed to execute 'objectStore' on 'IDBTransaction': The transaction has finished.
Root Cause:
The sync code in taskdb/sync.rs opens a single transaction and holds it open while:
- Reading from storage (IDB operations)
- Making HTTP calls to the sync server (network I/O)
- Writing back to storage (IDB operations)
IndexedDB transactions auto-commit when there are no pending IDB operations. During HTTP calls, the browser sees no pending IDB work and closes the transaction. When sync tries to write afterward, it fails.