Skip to content

perf: port sqlite-sync network updates to wasm#4

Merged
andinux merged 5 commits into
mainfrom
perf/port-network-layer-optimizations
May 26, 2026
Merged

perf: port sqlite-sync network updates to wasm#4
andinux merged 5 commits into
mainfrom
perf/port-network-layer-optimizations

Conversation

@andinux
Copy link
Copy Markdown
Collaborator

@andinux andinux commented May 26, 2026

Summary

  • Reuse CloudSync runtime tickets in the wasm fetch network adapter.
  • Harden wasm fetch handling for null fetch results, response byte lengths, and status text errors.
  • Add a wasm wrapper version to package versions, generated from SQLITEAI_WASM_WRAPPER_VERSION in wasm.c.

Verification

  • Ran git diff --check.
  • Ran emcc -fsyntax-only ... wasm.c.
  • Ran bash -n build.sh.

andinux added 5 commits May 26, 2026 10:20
Read CloudSync ticket response headers in the wasm network adapter and send the cached ticket on later API requests while preserving bearer authentication.

Use fetch->numBytes when copying loaded response bodies, report statusText with strlen(), and handle null fetch results to keep error lengths and failures accurate.
Gate ticket response header reads to completed HTTP responses and use the CloudSync session token buffer size for cached tickets.

Skip overlong cached tickets instead of truncating them and guard fetch response sizes before casting to size_t.
Define the sqlite-wasm wrapper version in wasm.c so wrapper-level changes can be tracked alongside module versions.

Extract and validate SQLITEAI_WASM_WRAPPER_VERSION during build, producing versions such as 3.50.4-wasm.1.0.0-sync.1.0.20-vector.1.0.0-memory.1.2.2.
Register a wasm_version() SQL function backed by SQLITEAI_WASM_WRAPPER_VERSION so generated package versions can be matched by runtime checks.

Update the browser version smoke test to include the wasm wrapper segment between SQLite and module versions.
Drop the sqlite3_wasm_extra_init startup fprintf because Emscripten routes stderr to console.error in browsers.

This prevents successful package initialization from appearing as a JavaScript console error.
@andinux andinux merged commit 37299c7 into main May 26, 2026
1 check passed
@andinux andinux deleted the perf/port-network-layer-optimizations branch May 26, 2026 17:26
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