Repository navigation
Use better-sqlite3 instead of @db/sqlite - #162
Conversation
Closes #150 AI disclosure: Used Opus 5 for code generation and planning
|
/review AI review started. |
Advanced AI Review
Click to expand reviewNow let me verify the environment and inspect the installed 1. 🔴 Binary-cache fingerprint ignores the embedded native-addon files — stale binaries will be reused after a
|
|
/review AI review started. |
Advanced AI Review
Click to expand reviewReview:
|
|
/review AI review started. |
Advanced AI Review
Click to expand reviewI'll start by exploring the repository state and the changed files to review the complete diff.The PR range is Review1. 🟡 Fingerprint sorting invariant is split across two layers — latent nondeterministic cache keys
async function fingerprintOf (
bundleDigests: readonly string[],
addonDigests: readonly string[],
flags: string
): Promise<string> {
const payload = [
`deno:${Deno.version.deno}`,
`flags:${flags}`,
...bundleDigests,
// Prefixed so an addon entry can never collide with a `build/` one.
...addonDigests.map((digest) => `addon:${digest}`).sort()
].join('\0')The sorting currently lives at Suggestion — enforce it in one place and simplify both call sites: async function fingerprintOf (
bundleDigests: readonly string[],
addonDigests: readonly string[],
flags: string
): Promise<string> {
const payload = [
`deno:${Deno.version.deno}`,
`flags:${flags}`,
...[...bundleDigests].sort(),
...addonDigests.map((digest) => `addon:${digest}`).sort()
].join('\0')
return await sha256(new TextEncoder().encode(payload))
}Then 2. 🟡 README overstates glibc scope: only the Linux binaries are glibc-linked
Three of the five published targets (Windows x64, macOS x64/arm64) are not linked against glibc at all, so "The binaries are linked against glibc" is false as written, and the nested genitive ("the SQLite backend's native addon each binary carries") is hard to parse. Suggested rewrite: 3. 🟡 The migrate same-file error only suggests
|
akhileshthite
left a comment
There was a problem hiding this comment.
@corrideat Left one comment, I do not have much expertise in db, so I have not reviewed the swap itself or the SQL. Someone else should look at that part.
But I read #150, so I can speak for that side: this fixes it properly. The old
failure was @db/sqlite downloading the SQLite library at runtime through
@denosaurs/plug, and the compiled binary having --allow-write=./, so it
could not write ~/Library/Caches/deno/plug and every command died with
"Failed to load SQLite3 Dynamic Library", even chel --version. Embedding the
prebuilt addon per target removes the download completely, so there is nothing
left to fail.
That means I can drop the DENO_SQLITE_PATH workaround in
scripts/chel.mjs in TodoMVC once this is released. Happy to test the released
binary on a clean machine and confirm, since that is exactly how I hit the bug.
|
/review AI review started. |
Advanced AI Review
Click to expand reviewReview complete. I examined the full diff (including the parts truncated in the provided patch: 1. 🟡 README's Alpine/musl instructions are internally inconsistent and prescribe an unnecessary native build
Even from source, musl needs the addon compiled locally, because no prebuild
matches:
```bash
cd node_modules/better-sqlite3 && npm run build-releaseDeno also reports the wrong libc to the addon's prebuild lookup (If a local build genuinely was needed in your testing for a reason not visible from the code, the two sentences still contradict each other and should be reconciled.) 2. 🟡 New
|
|
LGTM |
|
Let me know @corrideat when you've tested this with Group Income and I can merge (if all looks good with the PR) |
Closes #150
Before merging this PR, we need to ensure that tests pass on GI (using the SQLite backend)
A known issue with this PR as it stands right now is that the bundle will contain all prebuilt SQLite binaries (e.g., the Linux bundle will include Windows code and vice versa). This is not directly harmful but makes the bundle larger than it needs to be.AI disclosure: Used Opus 5 for code generation and planning