Skip to content

ci: scope vitest discovery to src/ so dist twins don't double-run#128

Merged
jpr5 merged 1 commit into
mainfrom
ci/scope-vitest-src-no-dist-twins
Jun 25, 2026
Merged

ci: scope vitest discovery to src/ so dist twins don't double-run#128
jpr5 merged 1 commit into
mainfrom
ci/scope-vitest-src-no-dist-twins

Conversation

@jpr5

@jpr5 jpr5 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What

Add vitest.config.ts scoping test discovery to src/**, excluding dist/** (and .claude/** worktree checkouts).

Why

CI currently has no vitest config, so default discovery collects both src/__tests__/*.test.ts and their compiled dist/__tests__/*.test.js twins — 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 list collection:

  • dist test cases collected: 23743 → 0
  • src test cases collected: 3186 (unchanged)

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.

…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).
@jpr5 jpr5 force-pushed the ci/scope-vitest-src-no-dist-twins branch from 0752cbd to 7e0ef86 Compare June 25, 2026 18:28
@jpr5 jpr5 merged commit 5a6e1cd into main Jun 25, 2026
6 checks passed
@jpr5 jpr5 deleted the ci/scope-vitest-src-no-dist-twins branch June 25, 2026 18:30
@jpr5 jpr5 mentioned this pull request Jun 25, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant