Skip to content

ADFA-7200: Build sqlite-js 1.4.4, which has upstream #36 - #8

Merged
davidschachterADFA merged 4 commits into
mainfrom
fix/ADFA-7200-sqlite-js-36
Nov 21, 2026
Merged

davidschachterADFA merged 4 commits into
mainfrom
fix/ADFA-7200-sqlite-js-36

Conversation

@davidschachterADFA

@davidschachterADFA davidschachterADFA commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

ADFA-7200

Moves sqlite-js from 1.4.2-3 to 1.4.4. Upstream released 1.4.4 on 2026-11-21 with sqliteai/sqlite-js#36. CodeOnTheGo's AAR moves to it in CodeOnTheGo#2285.

  • 1.4.3 adds #33, sqlitejs_cancel_all(), for apps that embed sqlite-js. sqlite3 doesn't use it, and the package's version script keeps it unexported; build.sh's export check still allows only the two entry points.
  • 1.4.4 adds #36:
    • An error while building a call's arguments, or a toArray() row, now fails the call. In 1.4.3 the function ran with fewer arguments or got a short row.
    • Text that SQLite runs out of memory converting now gives "out of memory". In 1.4.3 it crashed sqlite3.
    • js_create_scalar and its siblings now fail when they can't store the function in js_functions, for example on a read-only database. In 1.4.3 they reported success, and the function was gone in the next session.

The build has no patch and no revision. 1.4.4's src/sqlitejs.c is identical to 1.4.3 plus #36, and its sqlitejs.h differs from 1.4.3's only in SQLITE_JS_VERSION.

run-tests.sh gains three tests for the first and third, and expects js_version() to be 1.4.4. Both READMEs describe the two releases.

Behaviour change to know about: a js_create_* call whose write to js_functions fails for any reason, a busy or locked table included, now returns an error. The function is still registered on the connection for that session, but it won't be there when the database is reopened. In 1.4.3 the call reported success.

Tests (Linux host, /usr/bin/sqlite3 3.46.1, EXT = a host build of the source)

  • 1.4.4, at 645af05: 107 of 107 pass. One is skipped because it needs sqlite-brotli.
  • 1.4.3 without #36: only the three new tests fail. The argument and toArray() calls return results instead of failing, and the store on a read-only database returns 0.
  • The out-of-memory case isn't in run-tests.sh: it needs a heap limit relative to the memory in use, which the shell can't set. Upstream's own test of it runs in CodeOnTheGo's test.sh, which crashes without that check.

On phones

Installed with apt from the stage repo, running the package's own run-tests.sh:

Phone Arch Build Result
Galaxy J7, Android 9 arm (32-bit) 1.4.4, stage build 44885821040 (645af05) 108 of 108 pass, the three new ones included

Not tested yet: the 1.4.4 build on aarch64 hardware.

Memory test on 32-bit Android: "AC9: memory held by a global counts until the global is cleared" holds a 48 MB ArrayBuffer, an exact jemalloc size class. The memory limit counts a block's usable size, and Android 9's 32-bit allocator (jemalloc) rounds a 60 MB block up to 64 MB (malloc_usable_size 67,108,864), the whole default limit, so with 60 MB nothing else could even be parsed until the block was collected. The README's Limits section says a large ArrayBuffer can count up to a quarter more than its length where the allocator rounds up.

Still to do: publish to production after review and merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw

Moves the package from 1.4.2-3 to 1.4.3, which adds #33
(sqlitejs_cancel_all, for apps that embed sqlite-js; not exported here),
and carries upstream pull request #36 as 0001-*.patch until a release
has it:

- an error while building a call's arguments or a toArray() row fails
  the call, instead of running it with fewer arguments or a short row;
- text that SQLite runs out of memory converting gives "out of memory"
  instead of crashing sqlite3;
- js_create_scalar() and its siblings fail when the function cannot be
  stored in js_functions, for example on a read-only database.

run-tests.sh gains three tests for the first and third, and expects
js_version() 1.4.3. On a Linux host with /usr/bin/sqlite3 3.46.1, all
107 pass against 1.4.3 with the patch, and only the three new ones fail
against 1.4.3 without it. The out-of-memory case needs a heap limit
relative to the memory in use, which the shell cannot set; upstream's
own test of it runs on the same patch in CodeOnTheGo's test.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw
davidschachterADFA and others added 3 commits November 20, 2026 17:38
…ounding

run-tests.sh's "memory held by a global counts until the global is
cleared" failed on a Galaxy J7 (Android 9, arm), in 1.4.2-3 as well. The
memory limit counts a block's usable size, and Android 9's 32-bit
allocator (jemalloc) rounds a 60 MB block up to 64 MB (malloc_usable_size
67108864), the whole default limit. Nothing else could even be parsed
until the block was collected. The test now holds 48 MB, an exact size
class, so it checks what it is named for: 108 of 108 pass on the J7, and
107 of 107 on a Linux host.

The README's Limits section says a large ArrayBuffer can count up to a
quarter more than its length where the allocator rounds up. Revision 1,
because the installed script and README changed and stage already has
1.4.3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw
… measured

The comment and the README said "Android 10 and older"; only Android 9
was measured. They now say "measured on a 32-bit Android 9 phone".
"Up to a quarter" stays, now measured on that phone: malloc(32 MB + 4 KB)
reports 40 MB usable (+25.0%), and malloc(8 MB + 4 KB) 10 MB (+24.9%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw
Upstream merged #36 and released it in 1.4.4, so the patch goes and the
revision starts again. 1.4.4's sources are 1.4.3 with the patch applied,
byte for byte, except SQLITE_JS_VERSION. AC2 now expects 1.4.4; the
ADFA-7200 tests stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAXGyHbMzjSsi2zbrkw
@davidschachterADFA davidschachterADFA changed the title ADFA-7200: Build sqlite-js 1.4.3 with upstream #36 as a patch ADFA-7200: Build sqlite-js 1.4.4, which has upstream #36 Nov 21, 2026
@davidschachterADFA
davidschachterADFA merged commit e90033b into main Nov 21, 2026
3 checks passed
@davidschachterADFA
davidschachterADFA deleted the fix/ADFA-7200-sqlite-js-36 branch November 21, 2026 21:02
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.

2 participants