test: load the libsimple tokenizer on every raw test connection - #40
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two suites open a second raw
better-sqlite3connection to seed rows. Where the libsimple Chinese tokenizer is present (the deployed runtime; not CI),initMemory()buildsmemories_ftswith it and the FTS trigger on INSERT then needs it on that connection too — otherwiseSqliteError: no such tokenizer: simple, and the suite dies before printing a verdict.cold-pool-gate.test.mjsalready had thetryLoadSimplehelper; this copies it intovector-blob.integration.test.mjs(new in #39) andmemory-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
Noted, not fixed:
hooks/hooks.test.mjscase 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