From ff444a77e476ebcd0a6b5caee9c91ce2de93b0bc Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 11:53:47 -0500 Subject: [PATCH 01/10] chore(scope): open pdf-test-fakectx-pdfviews + fix-build-ui-script-cwd chores MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup PR scoping for the 8 unchanged pre-existing test failures called out in the audit PR (S1-S3 + H1-H5 + M1-M9 sweep, merged at d544ea7). Both chores are single-concern, single-commit-shaped, and small (≤30 LOC each). Synopses include exact file:line refs, failure modes, fix options, and acceptance criteria so each can be executed independently. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/context/chores.xml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.claude/context/chores.xml b/.claude/context/chores.xml index a527ee0..b168f8c 100644 --- a/.claude/context/chores.xml +++ b/.claude/context/chores.xml @@ -566,5 +566,33 @@ WHAT IS OUT OF SCOPE - Do NOT touch plans.xml, splits.xml, sequence.xml, chores.xml (lead owns those). - Do NOT edit package.json, bun.lock, tsconfig.json, drizzle.config.ts (foundation §6.1 froze the dep set). + + + + + Post-S1 §13 v1.1 amendment introduced `ctx.pdfViews: Map<paper_id, viewUUID>` as the viewUUID resolution surface (refreshExtraction at src/server/tools/pdf.ts:141 calls `ctx.pdfViews.get(args.paper_id)`). The `fakeCtx` helper in src/server/tools/pdf.test.ts:63-92 was never updated to populate this map, so the 5 refresh-extraction tests fail at TypeError "undefined is not an object (evaluating 'ctx.pdfViews.get')". Production path is fine — real `scholar.pdf.open` populates the map — but the tests give zero green-suite assertion that refresh-extraction works end-to-end. + +Fix: extend `fakeCtx` to accept an optional `pdfViews` arg (default `new Map()`), then have each test that calls refreshExtraction with paper_id "pN" pre-populate the map with a synthetic viewUUID. Cleanest pattern: synthesize viewUUID as `view-${paper_id}` and let each test do `fakeCtx(sqlite, { pdfViews: new Map([["p1", "view-p1"]]) })`. Tier: mechanical (haiku → sonnet depending on whether all 5 tests can use a shared helper). Acceptance: 5 refresh-extraction tests go green; the rest of the suite stays at 289 pass; typecheck clean. Single commit: `test(pdf): seed ctx.pdfViews fixture so refresh-extraction tests pass`. + + + + `bun run build:ui` fails with `FileNotFound: failed to open root directory: src/ui` because package.json declares `bun --cwd=scripts build-ui`, which sets cwd to `scripts/` before invoking `bun build-ui` (resolves to `scripts/build-ui.ts`). The script then passes `"src/ui/index.html"` as entrypoint and `"build/ui"` as outdir — both relative to the cwd, so they resolve to `scripts/src/ui/index.html` and `scripts/build/ui` (neither exists). The same failure mode hits `bun run measure-bundle` (`bun --cwd=scripts measure-bundle`). Consequently `src/ui/bundle.test.ts` beforeAll silently swallows the build error, and the 3 bundle-budget tests fail on missing `build/ui/app.html` and `build/ui/bundle-budget.json`. + +Fix options (pick A unless reason to keep --cwd=scripts): +(A) Drop --cwd: change package.json to `"build:ui": "bun scripts/build-ui.ts"` and `"measure-bundle": "bun scripts/measure-bundle.ts"`. Both scripts already use repo-root-relative paths internally. +(B) Anchor scripts to import.meta.dir: refactor build-ui.ts and measure-bundle.ts to resolve `src/ui/index.html` and `build/ui` via `path.join(import.meta.dir, "..", ...)` so cwd doesn't matter. + +Acceptance: `bun run build:ui` succeeds and produces `build/ui/app.html`; `bun run measure-bundle` produces `build/ui/bundle-budget.json` matching the shape `bundle.test.ts` asserts (total_kb / threshold_kb / over_budget / per_dep[]); the 3 bundle.test.ts tests go green; full suite reaches 297 pass / 8 skip / 0 fail; typecheck clean. Tier: mechanical-with-interpretation (sonnet) — picking A vs B is a 30-second judgment, the edit itself is ≤5 LOC. Single commit: `fix(build): resolve build:ui + measure-bundle without --cwd=scripts`. + From 24309eb1a16f99b0654a4f2f289ee7a07c02537a Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 11:58:12 -0500 Subject: [PATCH 02/10] test(pdf): seed ctx.pdfViews fixture so refresh-extraction tests pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes chore pdf-test-fakectx-pdfviews-fixture. S1's §13 v1.1 amendment introduced ctx.pdfViews: Map as the viewUUID resolution surface (refreshExtraction at pdf.ts:141 does `ctx.pdfViews.get(args.paper_id)`). fakeCtx never populated it, leaving the 5 refresh-extraction tests failing at TypeError. Production code path is unchanged; the gap was test-only. Extend fakeCtx with an optional `paperId` opt that seeds ` -> view-`. Each failing test now passes its paper_id via the same fakeCtx call. Suite: 6/6 pdf.test.ts pass. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/server/tools/pdf.test.ts | 49 +++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/server/tools/pdf.test.ts b/src/server/tools/pdf.test.ts index 5527295..d65b4b1 100644 --- a/src/server/tools/pdf.test.ts +++ b/src/server/tools/pdf.test.ts @@ -60,9 +60,19 @@ const noopLog = { } type FakePdfText = string | ((viewUUID: string) => Promise) -function fakeCtx(sqlite: Database, opts?: { text?: FakePdfText }) { +// `paperId` opt seeds ctx.pdfViews with ` -> view-` so +// refreshExtraction's viewUUID lookup (pdf.ts:141, `ctx.pdfViews.get(...)`) +// resolves. The S1 §13 v1.1 amendment introduced that map as the viewUUID +// resolution surface; tests must simulate the scholar.pdf.open call that +// populates it in production. +function fakeCtx( + sqlite: Database, + opts?: { text?: FakePdfText; paperId?: string }, +) { const db = drizzle(sqlite) const textFactory = opts?.text ?? "Hello scholar. " + "word ".repeat(500) + const pdfViews = new Map() + if (opts?.paperId) pdfViews.set(opts.paperId, `view-${opts.paperId}`) return { db, configDb: db, @@ -76,6 +86,7 @@ function fakeCtx(sqlite: Database, opts?: { text?: FakePdfText }) { setRoots: async () => {}, isHealthy: () => ({ alive: true, lastOkAt: Date.now(), stdioOpen: true }), }, + pdfViews, config: { get: (_key: string): T | undefined => undefined, set: (_k: string, _v: unknown) => {}, @@ -101,7 +112,7 @@ test("refresh-extraction: writes paper_chunks AND chunk_vec rows for a fixture p sqlite.run(`INSERT INTO papers(id,key,title,imported_at) VALUES ('p1','fake2026','Fake paper','2026-05-22T00:00:00.000Z')`) - await refreshExtraction(fakeCtx(sqlite), { paper_id: "p1" }) + await refreshExtraction(fakeCtx(sqlite, { paperId: "p1" }), { paper_id: "p1" }) const n = ( sqlite @@ -151,7 +162,7 @@ test("refresh-extraction: lazily materializes chunk_vec when deferred (via _test sqlite.run(`INSERT INTO papers(id,key,title,imported_at) VALUES ('p2','lazy','Lazy paper','2026-05-22T00:00:00.000Z')`) - await refreshExtraction(fakeCtx(sqlite), { + await refreshExtraction(fakeCtx(sqlite, { paperId: "p2" }), { paper_id: "p2", _testProbeDim: async () => ({ dim: 768, @@ -180,7 +191,7 @@ test("refresh-extraction: idempotent — re-run yields equal counts (Ruling B co sqlite.run(`INSERT INTO papers(id,key,title,imported_at) VALUES ('p3','idem','Idem paper','2026-05-22T00:00:00.000Z')`) - await refreshExtraction(fakeCtx(sqlite), { paper_id: "p3" }) + await refreshExtraction(fakeCtx(sqlite, { paperId: "p3" }), { paper_id: "p3" }) const n1 = ( sqlite .query("SELECT COUNT(*) AS n FROM paper_chunks WHERE paper_id='p3'") @@ -195,7 +206,7 @@ test("refresh-extraction: idempotent — re-run yields equal counts (Ruling B co .get() as { n: number } ).n - await refreshExtraction(fakeCtx(sqlite), { paper_id: "p3" }) + await refreshExtraction(fakeCtx(sqlite, { paperId: "p3" }), { paper_id: "p3" }) const n2 = ( sqlite .query("SELECT COUNT(*) AS n FROM paper_chunks WHERE paper_id='p3'") @@ -226,9 +237,10 @@ test("refresh-extraction: ordinal shrinkage — fewer chunks on re-run trims sta VALUES ('p4','shrink','Shrinking paper','2026-05-22T00:00:00.000Z')`) // First run: long text → many chunks. - await refreshExtraction(fakeCtx(sqlite, { text: "word ".repeat(1000) }), { - paper_id: "p4", - }) + await refreshExtraction( + fakeCtx(sqlite, { text: "word ".repeat(1000), paperId: "p4" }), + { paper_id: "p4" }, + ) const longCount = ( sqlite .query("SELECT COUNT(*) AS n FROM paper_chunks WHERE paper_id='p4'") @@ -237,9 +249,10 @@ test("refresh-extraction: ordinal shrinkage — fewer chunks on re-run trims sta expect(longCount).toBeGreaterThan(1) // Second run: tiny text → 1 chunk. - await refreshExtraction(fakeCtx(sqlite, { text: "Tiny." }), { - paper_id: "p4", - }) + await refreshExtraction( + fakeCtx(sqlite, { text: "Tiny.", paperId: "p4" }), + { paper_id: "p4" }, + ) const shortCount = ( sqlite .query("SELECT COUNT(*) AS n FROM paper_chunks WHERE paper_id='p4'") @@ -267,9 +280,10 @@ test("refresh-extraction: ordinal growth — more chunks on re-run leaves contig sqlite.run(`INSERT INTO papers(id,key,title,imported_at) VALUES ('p5','grow','Growing paper','2026-05-22T00:00:00.000Z')`) - await refreshExtraction(fakeCtx(sqlite, { text: "Tiny." }), { - paper_id: "p5", - }) + await refreshExtraction( + fakeCtx(sqlite, { text: "Tiny.", paperId: "p5" }), + { paper_id: "p5" }, + ) const tiny = ( sqlite .query("SELECT COUNT(*) AS n FROM paper_chunks WHERE paper_id='p5'") @@ -277,9 +291,10 @@ test("refresh-extraction: ordinal growth — more chunks on re-run leaves contig ).n expect(tiny).toBe(1) - await refreshExtraction(fakeCtx(sqlite, { text: "word ".repeat(1000) }), { - paper_id: "p5", - }) + await refreshExtraction( + fakeCtx(sqlite, { text: "word ".repeat(1000), paperId: "p5" }), + { paper_id: "p5" }, + ) const long = ( sqlite .query("SELECT COUNT(*) AS n FROM paper_chunks WHERE paper_id='p5'") From 609749d82b47ff340de338c274385e3b27270b35 Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 11:59:12 -0500 Subject: [PATCH 03/10] fix(build): resolve build:ui + measure-bundle without --cwd=scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes chore fix-build-ui-script-cwd-paths. `bun --cwd=scripts X` shifted cwd to scripts/ before running the script, but build-ui.ts and measure-bundle.ts both pass repo-root-relative paths internally ("src/ui/index.html", "build/ui") that no longer resolve from scripts/. Result: bun run build:ui exited with FileNotFound for src/ui; bundle.test.ts beforeAll silently swallowed the build error and the 3 bundle-budget assertions failed on missing artifacts. Fix is option A from the chore: drop --cwd=scripts and call the script file directly. Other --cwd=scripts entries (build:pdf, build:vec, build:plugin) left untouched — out of chore scope; their bodies may genuinely depend on cwd=scripts and no failing test exercises them. Suite reaches 297 pass / 8 skip / 0 fail (was 289 / 8 / 8 on PR1). Co-Authored-By: Claude Opus 4.7 (1M context) --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index eb2864d..e02cda8 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,12 @@ "test": "bun test", "db:generate": "drizzle-kit generate", "build:server": "tsc --noEmit && bun build src/server/index.ts --compile --target=bun-windows-x64 --outfile build/scholar.exe", - "build:ui": "bun --cwd=scripts build-ui", + "build:ui": "bun scripts/build-ui.ts", "build:ui:dev": "UI_MINIFY=false bun -q build:ui", "build:pdf": "bun --cwd=scripts vendor-pdf-server", "build:vec": "bun --cwd=scripts build-vec0", "build:plugin": "bun --cwd=scripts build-plugin", - "measure-bundle": "bun --cwd=scripts measure-bundle", + "measure-bundle": "bun scripts/measure-bundle.ts", "serve": "bun --cwd=scripts start-server.ts" }, "dependencies": { From 9d8afc4265fac4180413a4745384cc1d7e770dad Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 11:59:28 -0500 Subject: [PATCH 04/10] chore(scope): close both followup chores with fulfillment SHAs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - pdf-test-fakectx-pdfviews-fixture → 24309eb - fix-build-ui-script-cwd-paths → 609749d Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/context/chores.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.claude/context/chores.xml b/.claude/context/chores.xml index b168f8c..b6bb525 100644 --- a/.claude/context/chores.xml +++ b/.claude/context/chores.xml @@ -574,7 +574,8 @@ WHAT IS OUT OF SCOPE --> Post-S1 §13 v1.1 amendment introduced `ctx.pdfViews: Map<paper_id, viewUUID>` as the viewUUID resolution surface (refreshExtraction at src/server/tools/pdf.ts:141 calls `ctx.pdfViews.get(args.paper_id)`). The `fakeCtx` helper in src/server/tools/pdf.test.ts:63-92 was never updated to populate this map, so the 5 refresh-extraction tests fail at TypeError "undefined is not an object (evaluating 'ctx.pdfViews.get')". Production path is fine — real `scholar.pdf.open` populates the map — but the tests give zero green-suite assertion that refresh-extraction works end-to-end. @@ -583,7 +584,8 @@ Fix: extend `fakeCtx` to accept an optional `pdfViews` arg (default `new Map()`) `bun run build:ui` fails with `FileNotFound: failed to open root directory: src/ui` because package.json declares `bun --cwd=scripts build-ui`, which sets cwd to `scripts/` before invoking `bun build-ui` (resolves to `scripts/build-ui.ts`). The script then passes `"src/ui/index.html"` as entrypoint and `"build/ui"` as outdir — both relative to the cwd, so they resolve to `scripts/src/ui/index.html` and `scripts/build/ui` (neither exists). The same failure mode hits `bun run measure-bundle` (`bun --cwd=scripts measure-bundle`). Consequently `src/ui/bundle.test.ts` beforeAll silently swallows the build error, and the 3 bundle-budget tests fail on missing `build/ui/app.html` and `build/ui/bundle-budget.json`. From 0dde97763cf706bea634ad5223bc6cc803b3921c Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 12:06:43 -0500 Subject: [PATCH 05/10] ci: build vec0 before test step so tests can loadExtension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test fixtures resolve vec0 via runtime/vendor/sqlite-vec/vec0.so (tests/util/vec0.ts). runtime/ is gitignored per CLAUDE.md (per-user state), so CI must materialize vec0 before bun test runs — otherwise loadExtension fails and 23+ tests cascade-fail through the chunk_vec virtual table. The Smoke step that previously ran AFTER test compiled vec0 to /tmp/ which the test fixtures don't look for. Replace that flow by calling bun run build:vec before bun test; build-vec0 emits to the canonical runtime/vendor location and caches by file existence. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 987bad5..a2a91d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,13 @@ jobs: - name: Typecheck run: bunx tsc --noEmit + - name: Build vec0 (runtime/vendor/sqlite-vec/vec0.so) + # Tests load vec0 via tests/util/vec0.ts → runtime/vendor/sqlite-vec/vec0.so. + # runtime/ is gitignored per CLAUDE.md (per-user state), so CI must build + # it before bun test. The cache check inside build-vec0 makes this a no-op + # if the file already exists from a prior step. + run: bun run build:vec + - name: Test run: bun test From 078e5e0ed12ae4d43444d6c2ab0794d6eff40f56 Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 12:10:23 -0500 Subject: [PATCH 06/10] fix(build): build-vec0 script passes file path, not dir, and mkdirs parent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When invoked as a script via \`bun run build:vec\`, the if-main block passed util.subpath("build/vendor/sqlite-vec") — a DIRECTORY — to compileVec0FromSource, which then handed it to gcc as the -o output. ld errored "cannot open output file ...: No such file or directory" because the parent dir wasn't created either. Fix: append the platform-specific filename (vec0.{so,dylib,dll}) when calling compileVec0FromSource at script entry, and mkdirSync the parent of destPath inside the compile function before invoking the compiler. Verified locally by deleting build/vendor/sqlite-vec + runtime/vendor/ sqlite-vec and running bun run build:vec — both locations now populated with the compiled vec0.so. Suite remains at 297 pass / 0 fail. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/build-vec0.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/build-vec0.ts b/scripts/build-vec0.ts index fdd2177..88ee231 100644 --- a/scripts/build-vec0.ts +++ b/scripts/build-vec0.ts @@ -1,7 +1,8 @@ import { $ } from "bun" import { Database } from "bun:sqlite" -import { join, basename } from "node:path" +import { join, basename, dirname } from "node:path" import { copyFileSync, existsSync, mkdirSync } from "node:fs" +import { getVec0Extension } from "../src/server/db/sqlite-vec.ts" import util, { ROOT } from "./util" import env from "./util/env" @@ -119,6 +120,9 @@ export async function compileVec0FromSource(destPath: string): Promise { const { bin, args: prefixArgs } = compiler console.log(`Compiling vec0 from source using ${bin}...`) + // Ensure the output directory exists — ld errors on missing parent dir. + mkdirSync(dirname(destPath), { recursive: true }) + // Use Bun.spawn (not $`...`) so multi-word CC commands (bin + prefixArgs) // are passed as a proper argv array — $`${cc} -flag` treats the whole // interpolated string as a single argument (no shell word-splitting). @@ -152,7 +156,9 @@ export async function compileVec0FromSource(destPath: string): Promise { } if (import.meta.main) - compileVec0FromSource(util.subpath("build/vendor/sqlite-vec")).catch((e) => { + compileVec0FromSource( + util.subpath("build/vendor/sqlite-vec", `vec0.${getVec0Extension()}`), + ).catch((e) => { const error = e instanceof Error ? `Unhandled compile error: ${e.message}\n` : String(e) process.stderr.write(error) From d2cdd2453e9724223be0d7f655da0ecef4be5398 Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 12:14:07 -0500 Subject: [PATCH 07/10] test(ingest): scope mock.module to before/afterAll so it doesn't leak bun:test mock.module() is process-global; the unscoped mock.module at ingest.test.ts module-load time persisted into later test files (roots.test.ts), making allPdfRoots return ["/tmp"] for tests that needed the real DB-backed lookup. Local bun 1.3.14 happens to isolate this; CI's 1.3.11 surfaces it as roots.add seeing setRoots called with ["/tmp"] instead of the test's tmpdir-rooted paths. Snapshot the real default-pdf-root exports at module load, install the mock in beforeAll, and re-mock with the real exports in afterAll. The hygiene is bun-version-agnostic and the right pattern regardless. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/server/tools/ingest.test.ts | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/server/tools/ingest.test.ts b/src/server/tools/ingest.test.ts index aef4eee..a4f1528 100644 --- a/src/server/tools/ingest.test.ts +++ b/src/server/tools/ingest.test.ts @@ -3,7 +3,7 @@ // Uses buildServer + dispatch pattern (established in corpus.test.ts). // Mocks allPdfRoots/defaultPdfRoot so tests don't need real pdf_roots config rows. // ctx.db is set directly after buildServer() to inject an in-memory corpus DB. -import { test, expect, describe, mock, beforeEach, afterEach } from "bun:test"; +import { test, expect, describe, mock, beforeAll, afterAll, beforeEach, afterEach } from "bun:test"; import Database from "bun:sqlite"; import { drizzle } from "drizzle-orm/bun-sqlite"; import { mkdtempSync, rmSync, mkdirSync } from "node:fs"; @@ -14,14 +14,30 @@ import { openWithPragmas, applyMigrations } from "../db/migrations.ts"; import type { PdfChild } from "./registry.ts"; import { papers, citations } from "../db/schema.ts"; import type { BunSQLiteDatabase } from "drizzle-orm/bun-sqlite"; +import * as defaultPdfRootMod from "../db/default-pdf-root.ts"; // F1 test-isolation: mock the foundation helper so tests never hit the config DB pdf_roots table. // Use /tmp as the test root — it always exists, so realpathSync inside resolveUnderRoot won't throw ENOENT. -mock.module("../db/default-pdf-root.ts", () => ({ - allPdfRoots: (_tx: unknown, _corpusId: string) => ["/tmp"], - defaultPdfRoot: (_tx: unknown, _corpusId: string) => "/tmp", - ConfigurationIncompleteError: class extends Error { override name = "ConfigurationIncompleteError"; }, -})); +// +// bun:test mock.module() is process-global; if we don't restore on teardown, +// later test files that import the same module receive the mock instead of +// the real exports (bun 1.3.11 surfaced this clearly; later bun versions +// happen to isolate it). Snapshot the real exports and re-mock with them in +// afterAll so subsequent files (roots.test.ts, etc.) get the real DB-backed +// allPdfRoots / defaultPdfRoot. +const _realDefaultPdfRoot = { ...defaultPdfRootMod }; + +beforeAll(() => { + mock.module("../db/default-pdf-root.ts", () => ({ + allPdfRoots: (_tx: unknown, _corpusId: string) => ["/tmp"], + defaultPdfRoot: (_tx: unknown, _corpusId: string) => "/tmp", + ConfigurationIncompleteError: class extends Error { override name = "ConfigurationIncompleteError"; }, + })); +}); + +afterAll(() => { + mock.module("../db/default-pdf-root.ts", () => _realDefaultPdfRoot); +}); const mockPdf: PdfChild = { interact: async () => { throw new Error("PDF_CHILD_UNAVAILABLE"); }, From 9c8dbe9d0018828bf08fe7d2c4a7381d582f1040 Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 12:27:14 -0500 Subject: [PATCH 08/10] Update ci.yml --- .github/workflows/ci.yml | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2a91d8..09ff36e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: ci on: push: - branches: [main, "ingest/**"] + branches: * pull_request: branches: [main] @@ -17,35 +17,28 @@ jobs: with: bun-version: 1.3.11 # match scholar.bundledBunVersion - - name: Install dependencies (frozen) + - name: install run: bun install --frozen-lockfile - - name: Typecheck + - name: typecheck run: bunx tsc --noEmit - - name: Build vec0 (runtime/vendor/sqlite-vec/vec0.so) - # Tests load vec0 via tests/util/vec0.ts → runtime/vendor/sqlite-vec/vec0.so. - # runtime/ is gitignored per CLAUDE.md (per-user state), so CI must build - # it before bun test. The cache check inside build-vec0 makes this a no-op - # if the file already exists from a prior step. + - name: compile run: bun run build:vec - - name: Test - run: bun test + - name: test + run: bun test --bail --only-failures - - name: Smoke — vec0 compile-from-source + ABI probe - # Mirrors build-plugin.ts:compileVec0FromSource (§14.1 step 5 fallback). - # Catches regressions in vendored sqlite3.h vs Bun's bundled SQLite ABI. + - name: smoke run: | - gcc -O2 -fPIC -shared -I src/vendor/sqlite-vec \ - src/vendor/sqlite-vec/sqlite-vec.c \ - -o /tmp/vec0-smoke.so bun -e ' import { Database } from "bun:sqlite"; const db = new Database(":memory:"); - db.loadExtension("/tmp/vec0-smoke.so", "sqlite3_vec_init"); - const v = db.query("SELECT vec_version() AS v").get(); - console.log("vec_version:", v); - db.run("CREATE VIRTUAL TABLE v USING vec0(emb float[4])"); - console.log("CREATE vec0 VTAB OK"); + const so = "runtime/vendor/sqlite-vec/vec0.so" + const q = "SELECT vec_version() as v" + const r = "CREATE VIRTUAL TABLE v USING vec0(emb float[4])" + db.loadExtension(so, "sqlite3_vec_init"); + console.log("version:", db.query(q).get()); + db.run(r); + console.log("CREATE VTAB vec0: ok"); ' From df6d328dad9518faf0c3572e9a1c3598af680699 Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 12:28:33 -0500 Subject: [PATCH 09/10] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09ff36e..bef5416 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: ci on: push: - branches: * + branches: [*] pull_request: branches: [main] From 61f7cd30b428ac7fc09556c76b3590ea6b57acd0 Mon Sep 17 00:00:00 2001 From: zaynram Date: Fri, 29 May 2026 12:29:55 -0500 Subject: [PATCH 10/10] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bef5416..9dad3e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: ci on: push: - branches: [*] + branches: [main *] pull_request: branches: [main]