Skip to content

test: load the libsimple tokenizer on every raw test connection - #40

Merged
MXAntian merged 1 commit into
mainfrom
fix/test-tokenizer-portability
Sep 3, 2026
Merged

test: load the libsimple tokenizer on every raw test connection#40
MXAntian merged 1 commit into
mainfrom
fix/test-tokenizer-portability

Conversation

@MXAntian

@MXAntian MXAntian commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Two suites open a second raw better-sqlite3 connection to seed rows. Where the libsimple Chinese tokenizer is present (the deployed runtime; not CI), initMemory() builds memories_fts with it and the FTS trigger on INSERT then needs it on that connection too — otherwise SqliteError: no such tokenizer: simple, and the suite dies before printing a verdict. cold-pool-gate.test.mjs already had the tryLoadSimple helper; this copies it into vector-blob.integration.test.mjs (new in #39) and memory-health.test.mjs (pre-existing). No-op where the extension is absent.

Fanout: not run — 2 files, test harness only, no behavior change.

Test plan

  • from the runtime checkout (extension present): vector-blob 49/49, memory-health 68/68
  • CI (extension absent): unchanged

Noted, not fixed: hooks/hooks.test.mjs case 10 is load-sensitive in the libsimple environment (fresh pinned DB per hook call inside a 2.8 s spawn budget) — failed 2 of 4 runs under concurrent load, passed when quiet.

🤖 Generated with Claude Code

initMemory() builds memories_fts with the libsimple Chinese tokenizer when the
extension is present — true in the deployed runtime, false in CI. Two suites
open a second raw better-sqlite3 connection to seed rows directly, and on
INSERT the FTS trigger needs the tokenizer on THAT connection too. Without it:

  SqliteError: no such tokenizer: simple

so vector-blob.integration.test.mjs (new in #39) and memory-health.test.mjs
(pre-existing) both crashed before printing a verdict when run from the
runtime checkout, while passing in CI. A test that only passes where the
extension is absent is not testing the environment it ships to.

cold-pool-gate.test.mjs already carried the fix (tryLoadSimple); this copies
that helper into the other two. No-op where the extension is absent, so CI is
unchanged.

Also observed while verifying: hooks/hooks.test.mjs case 10 ("pinned DB
answers from that DB") is load-sensitive in the libsimple environment — a
fresh pinned DB per hook call pays the jieba dictionary load plus an FTS
unicode61→simple migration inside the hook's 2.8 s spawn budget, and it
failed 2 of 4 runs while other suites ran concurrently, passing when quiet.
Not changed here; noted so the next person does not bisect it against
unrelated code as I did.

Co-Authored-By: 千夏 <qianxia@clawgamers.com>
@MXAntian
MXAntian marked this pull request as ready for review September 3, 2026 16:39
@MXAntian
MXAntian merged commit 8e9cdeb into main Sep 3, 2026
2 checks passed
@MXAntian
MXAntian deleted the fix/test-tokenizer-portability branch September 3, 2026 16:39
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