Skip to content

test(evals): Migrate to vitest-evals harness - #1132

Closed
dcramer wants to merge 8 commits into
mainfrom
dcramer/test/migrate-vitest-evals-harness
Closed

dcramer wants to merge 8 commits into
mainfrom
dcramer/test/migrate-vitest-evals-harness

Conversation

@dcramer

@dcramer dcramer commented Jun 27, 2026

Copy link
Copy Markdown
Member

The eval suite now uses the current vitest-evals harness and judge APIs instead of the old scorer-style wiring. The shared helpers keep the eval files small while preserving the existing expected tool calls and structured output checks.

Eval model setup now goes through the existing embedded-agent provider factory, so OpenRouter-backed credentials work the same way as the runtime AI tools. The PR also tightens the affected search prompts from eval traces and updates the eval docs, mocks, and suite-wide timeout configuration to match the new harness.

Comment thread packages/mcp-server-evals/package.json Resolved
@dcramer
dcramer force-pushed the dcramer/test/migrate-vitest-evals-harness branch from 8507ed7 to da42106 Compare June 27, 2026 18:49
Comment thread packages/mcp-server-mocks/src/utils.ts Resolved
Comment thread packages/mcp-server-mocks/src/utils.ts Resolved
dcramer and others added 6 commits July 28, 2026 14:15
Move the eval suite to the current vitest-evals harness and judge APIs, using the existing embedded-agent provider factory so evals run against the configured provider credentials. Update the eval docs and mocks for the OpenRouter-backed path.

Co-Authored-By: GPT-5 Codex <[email protected]>
Keep agent evals on the same default judge threshold as the other eval helpers and make explicit Sentry syntax deterministic without requiring a discovery call.

Co-Authored-By: GPT-5 Codex <[email protected]>
Describe the whoami value as an email address instead of a prequoted Sentry search token. This keeps issue event search guidance consistent with the rule to avoid quoting simple email values.

Co-Authored-By: GPT-5 Codex <[email protected]>
Allow MSW test setup to bypass OpenAI, Anthropic, OpenRouter, and Azure OpenAI provider calls while continuing to fail on unmocked product API requests.

Co-Authored-By: GPT-5 Codex <[email protected]>
Restore targeted datasetAttributes filters for custom field discovery while keeping common-field search paths tool-free.

Update stdio testing docs to use the supported Node 22.13 minimum and a newer Node 24 check instead of Node 20.

Co-Authored-By: Codex <[email protected]>
Handle the AI SDK streaming response union before asserting the non-streaming agent tool result.

Co-Authored-By: OpenAI Codex <[email protected]>
@dcramer
dcramer force-pushed the dcramer/test/migrate-vitest-evals-harness branch from 609a077 to 6a699d0 Compare July 28, 2026 21:47
Treat malformed or relative request URLs as non-provider traffic so MSW can report the intended unhandled request error.

Co-Authored-By: OpenAI Codex <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 39d5d8d. Configure here.

Expect substring and numeric-type filters in search-event agent discovery calls so strict eval matching rewards the current prompt guidance.

Co-Authored-By: OpenAI Codex <[email protected]>
dcramer added a commit that referenced this pull request Nov 5, 2026
The Eval workflow on `main` reports green, but no evals have run.
`eval:ci` fails at startup:

```
Failed to load custom Reporter from vitest-evals/reporter
cause: Package subpath './reporters' is not defined by "exports" (ERR_PACKAGE_PATH_NOT_EXPORTED)
```

The cause is that vitest-evals 0.4.0 imports `vitest/reporters`, which
vitest 5 removed. `continue-on-error` on "Run evals" hides the failure,
so no `eval-results.json` gets written and the status check step throws.
Example run:
https://github.com/getsentry/toolkit/actions/runs/41951775819

This PR moves the eval package to vitest-evals 0.18.0, which supports
vitest 5 (getsentry/vitest-evals#113, peer range `vitest >=5 <6`). The
whole repo stays on vitest 5; there is no vitest 4 pin.

## Changes

- **Bump `vitest-evals` to `^0.18.0`.** I added `[email protected]`
and its `@vitest-evals/[email protected]` and `@vitest-evals/[email protected]`
dependencies to `minimumReleaseAgeExclude`, because they were published
today. Drop those entries once they are past the 24h window.
- **Import from `vitest-evals/legacy`.** 0.18 keeps the scorer-first API
(`describeEval` with `data`/`task`/`scorers`, `ToolCallScorer`, `Score`,
`ScoreFn`, `BaseScorerOptions`) under `vitest-evals/legacy`. This is an
import-path change only, in the 33 eval imports and the example in
`docs/testing/overview.md`. The eval code is unchanged.
- **Remove the unused root `vitest-evals` dev dependency.** Nothing at
the root imports it.
- **Set `SENTRY_CLI_NO_TELEMETRY=1` for the scorer's `sentry mcp`
process.**
- `ToolPredictionScorer` starts `pnpm --dir packages/cli run cli mcp`
from source. On `main`, that process exits immediately with ``Package
subpath './client' is not defined by "exports"``, and every scorer then
fails with `MCPClientError: Connection closed`.
- The exit comes from `lazyTelemetry()` in `src/lib/db/index.ts`. It
loads `../telemetry.js` with `createRequire`, so its imports resolve
`@sentry/api/client` under the `require` condition, but `@sentry/api`
exports `./client` only for `import`.
- Evals shouldn't send CLI telemetry anyway. The CLI bug itself is not
fixed here: `pnpm --filter sentry run cli help` also fails from source.
It needs its own CLI fix.

`continue-on-error` and the eval status check are unchanged.

## Verification

- **Local, no LLM key:** with no key in the sandbox, `pnpm eval:ci` on
vitest 5.0.5 loads the reporter, collects and runs all 27 files and 121
evals, and writes `eval-results.json`. On `main` it stops at startup.
Every eval failed, and the only cause was the missing provider key. No
`Connection closed` errors.
- **Checks:** `pnpm run tsc`, `pnpm run lint`, and `pnpm install
--frozen-lockfile` pass. The full `pnpm run test` didn't finish inside
my sandbox's time limit, so I'm relying on CI for it.

## Related

- #1132 (draft, "Migrate to vitest-evals harness") moves these evals to
the harness API. It touches the same eval files, so expect import
conflicts there. This PR keeps the current scorer-first suite running
until then.
- #1972 (Roach recordings for evals) depends on this, because Roach
records nothing while the suite doesn't run. Both PRs change
`pnpm-lock.yaml` and `pnpm-workspace.yaml`, so #1972 needs a rebase
after this merges.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A1de0f02c391e347294cc7ce28353bcfe -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A1de0f02c391e347294cc7ce28353bcfe)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A1de0f02c391e347294cc7ce28353bcfe/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: David Cramer <[email protected]>
@sentry-junior

sentry-junior Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Closing as stale: #1973 moved the eval suite onto vitest-evals 0.18 (legacy API). A move to the new harness API is easier to redo than to rebase.

@sentry-junior sentry-junior Bot closed this Nov 12, 2026

This branch was previously deployed

1 inactive deployment
Actions — 36d46139 Deployed Jul 28, 2026 by dcramer via eval #1066
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