Skip to content

fix: devil's advocate SDK fixes + CI workflow#4

Merged
liz709 merged 5 commits intomasterfrom
liz/blob-handling
Mar 10, 2026
Merged

fix: devil's advocate SDK fixes + CI workflow#4
liz709 merged 5 commits intomasterfrom
liz/blob-handling

Conversation

@liz709
Copy link
Collaborator

@liz709 liz709 commented Mar 10, 2026

Changes (post PR #3 merge)

Bug fixes (from devil's advocate review)

  • replace() now processes blobs — previously skipped processForUpload, unlike create()
  • list() sequential blob processing — prevents unbounded parallel downloads (was N×6 concurrent)
  • 4KB blob threshold — SDK now mirrors server-side threshold, small blobs stay inline
  • bulkCreate parallel + documented non-atomicityPromise.all with clear JSDoc warning
  • Upload fallback throws instead of hardcoding 1:${blobId}
  • toUint8Array widened to handle all TypedArrays + DataView correctly
  • Parallel blob downloads with MAX_CONCURRENT=6 cap
  • DataManager ↔ BlobManager integration — auto upload/resolve
  • Stronger blob ID entropy via crypto.getRandomValues()
  • Client credentials in examples (not OTP)

CI

  • GitHub Actions workflow: vitest + typecheck on Node 18/20/22
  • Uses pnpm (matches repo lockfile)

Tests

39 unit tests: blob (15), data (11), auth (6), client (7)

liz709 added 5 commits March 9, 2026 21:34
SDK is for server-server programming — users already have their
clientId/clientSecret from dexie-cloud.key.
1. bulkCreate: parallel execution via Promise.all (was sequential)
2. _walkForUpload: skip upload for binaries < BLOB_THRESHOLD (4096 bytes)
3. update(): renamed to replace() (PUT = full replace, not partial update)
   - update() kept as @deprecated alias for backwards compatibility
4. Upload fallback: throw instead of hardcoding '1:{blobId}' when server
   returns no parseable ref (version is unknown, unsafe to construct ref)
5. toUint8Array: widened signature to include ArrayBufferView; DataView
   handled correctly via byteOffset/byteLength slicing
6. _walkForRead: parallel downloads via _parallelMap() with
   MAX_CONCURRENT_DOWNLOADS=6 cap (was fully sequential)
7. DataManager/BlobManager integration: DataManager now accepts optional
   BlobManager; create() auto-processes uploads, get()/list() auto-resolve
   BlobRefs. Wired together in DexieCloudClient constructor.
8. generateBlobId(): fallback uses crypto.getRandomValues() for strong
   entropy (was Date.now() + Math.random())

Tests: updated blob.test.ts for changed fallback behavior and 4KB threshold;
added new test case for small-blob inline retention. All 39 tests pass.
@liz709 liz709 merged commit 4195fd4 into master Mar 10, 2026
6 checks passed
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.

1 participant