ci: verify the two win32 better-sqlite3 prebuilds actually load - #357
Merged
Conversation
… serves FTS5 A require() that returns an object only proves a file resolved. The probe downloads the release asset for a given target, installs the JS wrapper with --ignore-scripts so no locally built binding can stand in for it, then builds an FTS5 index and asserts a MATCH returns exactly the one row that matches and nothing for a term that matches none. --expect-fail inverts the exit code over the load only: the asset must still download and extract, so a control cannot pass by 404ing on a mistyped target. The version comes from package-lock.json, never a literal, so a pin bump cannot leave the probe verifying the previous release.
…nels Eight of the ten Node-22 (ABI 127) prebuild targets for the pinned 12.9.0 were verified from the published release asset. win32-x64 and win32-arm64 were not: the build machine had no Windows kernel, so only the binaries' PE shape was confirmed. This runs the same probe on windows-latest and on the GitHub-hosted windows-11-arm runner, which is free and generally available for public repos. Five negative controls per leg — wrong arch, wrong platform, wrong libc, wrong ABI, absent binding — each of which must be rejected, because a probe that cannot fail says nothing about the binding it loaded. No continue-on-error: a job that reports success regardless of its steps is the vacuous green this phase removes. No npm ci either, which keeps the job clear of the v13 install-script problem and stops prebuild-install from supplying the binding under test.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Both win32 legs failed identically on the first CI run with 'spawnSync npm.cmd EINVAL' — the CVE-2024-27980 hardening, which refuses to spawn a .cmd without shell: true. Same trap the init e2e test hit. Rather than reach for shell: true, the probe now downloads the tarball the lockfile resolves to, verifies it against the lockfile's integrity hash, and untars it. No install lifecycle exists at all, so the earlier --ignore-scripts guarantee is now structural: there is no script to ignore. better-sqlite3's wrapper requires 'bindings' lazily and only when nativeBinding is null, and this probe always passes a path, so the unpacked wrapper needs no dependency tree. Confirms windows-11-arm resolved and allocated: the arm64 leg ran on image windows-11-arm64 with Node 22.23.2/arm64 and reached the same npm failure.
…s it Both win32 legs failed with 'tar (child): Cannot connect to C: resolve failed'. Under shell: bash a Windows runner resolves tar to GNU tar from Git for Windows, which reads an absolute C:\... argument as a host:path remote spec. Passing the name relative to cwd removes the colon, and bsdtar in System32 accepts the same form, so one call works on every runner.
A control asserted to hold is worth nothing until it has been seen to break. This hands the wrong-arch control each runner's OWN target, so the binding loads and serves an FTS5 MATCH and the step must fail. Reverted in the next commit; this exists so the green beside it has a measured failure mode.
…at loads" This reverts commit 2dcda2b.
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.
Closes the last two rows of the better-sqlite3 12.9.0 Node-22 (ABI 127) prebuild matrix. That matrix is 10 targets, not 8 —
linux-armand the threelinuxmusl-*are the ones a count-from-memory misses.Eight were already verified by loading the published release asset and driving it through
require-> open DB -> FTS5 index ->MATCH:darwin-arm64,darwin-x64,linux-x64,linux-arm64,linux-arm,linuxmusl-x64,linuxmusl-arm64,linuxmusl-arm. The twowin32targets were not — the build machine had no Windows kernel, so only the binaries' PE shape was confirmed, and the previous agent declined to synthesise a pass.Both win32 targets are now verified on real Windows kernels. The matrix is 10/10.
What this adds
scripts/verify-better-sqlite3-prebuild.mjs— downloads the published asset for a target, unpacks the JS wrapper straight from the registry tarball the lockfile resolves to (checked against the lockfile's integrity hash), loads the asset vianativeBinding, then builds an FTS5 index and asserts aMATCHreturns exactly the one matching row and zero rows for a term that matches none. Loading is not the bar: arequire()that returns an object only proves a file resolved, not that the extension's SQLite carries FTS5.No npm, so no install lifecycle exists — the
--ignore-scriptsguarantee is structural rather than a flag: neither prebuild-install nor node-gyp can supply a binding and let the probe verify itself. The pinned version, tarball URL and integrity hash all come frompackage-lock.json, never a literal, so a pin bump cannot leave the probe verifying the previous release..github/workflows/ci.yml— two jobs, onwindows-latestand on the GitHub-hostedwindows-11-armrunner (free and GA for public repositories since 2025-08-07; this repository is public). The arm64 leg was confirmed to allocate: imagewindows-11-arm64, Node22.23.2/arm64.Results on head
3d97e144better-sqlite3 prebuild loads (win32-x64)better-sqlite3 prebuild loads (win32-arm64)What the positive steps printed:
Negative controls
Five per leg, each of which must be rejected.
--expect-failinverts the exit code over the load only: the asset must still download and extract, so a control cannot "pass" by 404ing on a mistyped target.... better_sqlite3.node is not a valid Win32 application.linux-x64ELF)... is not a valid Win32 application.linuxmusl-x64)... is not a valid Win32 application.v115)The module '...'— NODE_MODULE_VERSION mismatchCannot find module '...'The controls were shown to go red
Commit
2dcda2b6handed the wrong-arch control each runner's own target, so the binding loads. Both legs failed on that step, exactly as intended — run 32143923092:3d97e144reverts that mutation and is byte-identical to192fedcf.Constraints held
continue-on-erroranywhere in the new job.npm ciin the job, which also keeps it clear of the v13 install-script problem entirely.Two CI-only portability bugs found and fixed on the way
spawnSync npm.cmd EINVAL— the CVE-2024-27980 hardening, the same traptests/e2e/init-command.e2e.test.tshit. Fixed by removing npm from the probe rather than reaching forshell: true.tar (child): Cannot connect to C: resolve failed— undershell: basha Windows runner resolvestarto GNU tar from Git for Windows, which reads an absoluteC:\...argument as ahost:pathremote spec. Fixed by naming the tarball relative tocwd, a form bsdtar in System32 accepts too.