ci: scope vitest discovery to src/ so dist twins don't double-run#128
Merged
Conversation
…tests
The atlas-* aimock tests intermittently failed in CI (9-64 failures, non-deterministic)
with `FetchError: Invalid response body ... Premature close` from the in-process aimock
LLMock HTTP servers dropping connections under socket pressure — not a distiller JSON-parse
bug (that stderr line is benign output from a passing malformed-JSON handling test, mis-
correlated because vitest's forks pool shares worker stderr).
Root amplifier: the CI `test` job builds dist/ then runs a bare `vitest run` with no config
file. Bare vitest globs ALL `*.test.{ts,js}`, so it discovered both `src/__tests__/*.test.ts`
and the freshly-compiled `dist/__tests__/*.test.js` twins (plus copies under `.claude/worktrees/*/dist`),
running every aimock test multiple times concurrently. That doubled (or worse) the number of
simultaneous LLMock servers and the socket/port pressure that triggers "Premature close".
A separate `build` job already type-checks the build, so running dist twins in `test` is pure
redundancy.
Fix: add vitest.config.ts scoping discovery to the source tree and excluding the dist twins
and `.claude` worktrees:
include: ["src/**/*.test.ts"]
exclude: [...configDefaults.exclude, "dist/**", "**/.claude/**"]
vitest list before: 23743 dist-twin test cases collected; after: 0 (src still fully collected,
3186 tests pass).
0752cbd to
7e0ef86
Compare
Merged
jpr5
added a commit
that referenced
this pull request
Jun 25, 2026
## Release v1.16.0 (minor) Releases the user-visible changes already merged to `main`: **#124** (config validation relaxation) and **#127** (Atlas distiller "Premature close" runtime fix). Current `1.15.4` → `1.16.0`. #128 was a CI-only vitest scoping change and is intentionally not in the changelog (does not ship). ### CHANGELOG ## 1.16.0 ### Minor Changes - Config validation accepts minimal RAG configs — `indexing` and per-source `chunk` now optional with defaults (#124) - Fixed Atlas distiller LLM client "Premature close" errors, by disabling keep-alive on the test/proxy client (#127) ### Version bumps - `package.json` `version`: 1.15.4 → 1.16.0 - `src/cli.ts` `.version(...)`: 1.15.4 → 1.16.0 - version-sync verified in agreement. ### Publishing Merging this PR triggers `publish-release.yml` to publish `@copilotkit/pathfinder@1.16.0` to npm and create the tag/GitHub Release. Do not tag or release by hand.
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.
What
Add
vitest.config.tsscoping test discovery tosrc/**, excludingdist/**(and.claude/**worktree checkouts).Why
CI currently has no vitest config, so default discovery collects both
src/__tests__/*.test.tsand their compileddist/__tests__/*.test.jstwins — every test runs twice. Beyond the wasted wall-clock, the duplicate aimock-backed runs double the exposure to the LLMock socket-reuse race (the "Premature close" failures addressed by #127).This change makes each test run once.
Proof (deterministic)
vitest listcollection:Build green, prettier clean.
Sequencing
Independent of #127, but its CI is most reliably green once #127's keep-alive root-cause fix is in
main— recommend merging after #127. Rebase + re-run available on request.