You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcp-writer-lock tests fail on a fresh checkout without a prior build (they spawn dist/bin/codegraph.js) #1879
On a clean checkout at main (4871114), with dependencies installed and the kernel prebuild present but no dist/ built, both tests in __tests__/mcp-writer-lock.test.ts fail:
× issue #1740 — direct-mode writer lock > second CODEGRAPH_NO_DAEMON serve --mcp exits with writer-lock error
× issue #1740 — direct-mode writer lock > default daemon mode still allows two proxies to share one writer
Test Files 1 failed (1)
Tests 2 failed (2)
First failure signature: expect(fs.existsSync(lockPath)).toBe(true) — the daemon never comes up.
Why
The file hard-codes the built CLI as its server under test:
__tests__/mcp-writer-lock.test.ts:14: const BIN = path.resolve(__dirname, '../dist/bin/codegraph.js');
and spawns node BIN serve --mcp. But package.json on main defines "test": "vitest run" with no pretest/build step, so a fresh npm ci && npm test runs these two against a nonexistent binary. Node exits immediately, no lock file appears, and each test burns its full spawn timeout (~10s + ~15s) before going red — a slow, misleading signal for a new contributor, since the failures have nothing to do with their change.
Repro
git clone https://github.com/colbymchenry/codegraph &&cd codegraph
npm ci
npx vitest run __tests__/mcp-writer-lock.test.ts # no npm run build first
Verified the same 2 failures on a pristine origin/main worktree (Linux, Node 24): identical tests, identical durations — so this is the base behavior, not a branch regression.
Possible directions
Skip these two with a clear message when dist/bin/codegraph.js is absent (fast, keeps npm test green on fresh checkouts), or
document npm run build as a prerequisite of npm test, or
have the test file build the binary it needs.
Related but distinct: #1782 (orphaned daemon + temp dir per run) is about cleanup after the tests run; this is about them failing when there is nothing to run.
Independent confirmation from a clean worktree today: rebased #1842 onto d0996a2 and ran __tests__/cli-sync-stale-index.test.ts with no dist/ present — 7/7 fail with MODULE_NOT_FOUND for dist/bin/codegraph.js (node:internal/modules/cjs/loader in the output). After tsc && npm run copy-assets in the worktree, the same file goes 7/7 green. So the suite's failure mode on a fresh checkout is exactly as described: it assumes a prior build. (Related: literal-compiled-index.test.ts in #1867 degrades gracefully via describe.runIf(fs.existsSync(built)) — it skips instead of failing.)
Thanks for the detailed report, @bompus, and thanks for using CodeGraph! This is fixed on main by #2021, which builds on @danusha2345's #1924 (thank you!): the test suite now builds a missing or stale dist/ before running, so the writer-lock tests pass on a fresh checkout without a prior npm run build. The fix will be in the next release.
Activity
bompus commentedon Sep 16, 2026
Independent confirmation from a clean worktree today: rebased #1842 onto
d0996a2and ran__tests__/cli-sync-stale-index.test.tswith nodist/present — 7/7 fail withMODULE_NOT_FOUNDfordist/bin/codegraph.js(node:internal/modules/cjs/loaderin the output). Aftertsc && npm run copy-assetsin the worktree, the same file goes 7/7 green. So the suite's failure mode on a fresh checkout is exactly as described: it assumes a prior build. (Related:literal-compiled-index.test.tsin #1867 degrades gracefully viadescribe.runIf(fs.existsSync(built))— it skips instead of failing.)fix(tests): build missing or stale test prerequisites (#1879) (#2021)
colbymchenry commentedon Sep 27, 2026
Thanks for the detailed report, @bompus, and thanks for using CodeGraph! This is fixed on
mainby #2021, which builds on @danusha2345's #1924 (thank you!): the test suite now builds a missing or staledist/before running, so the writer-lock tests pass on a fresh checkout without a priornpm run build. The fix will be in the next release.Merge upstream/main (71 commits, through e63fe2e) into fork/consolidated