Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions dev-packages/e2e-tests/test-applications/node-eve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
"clean": "npx rimraf node_modules .eve .output pnpm-lock.yaml",
"test:build": "pnpm install && pnpm build",
"test:build-orchestrion": "USE_ORCHESTRION=1 pnpm test:build",
"test:build-latest": "pnpm install && pnpm add eve@latest ai@latest && pnpm build",
"test:build-content-off": "SENTRY_GENAI_CONTENT=off pnpm test:build-latest",
"test:build-0.x": "pnpm install && pnpm add eve@0.63 && pnpm build",
"test:build-content-off": "SENTRY_GENAI_CONTENT=off pnpm test:build",
"test:assert": "pnpm test:prod && pnpm test:dev",
"test:assert-latest": "SENTRY_GENAI_CONTENT=on pnpm test:assert",
"test:assert-content-off": "SENTRY_GENAI_CONTENT=off pnpm test:assert",
"test:assert-orchestrion": "USE_ORCHESTRION=1 pnpm test:assert",
"test:prod": "TEST_ENV=production playwright test",
Expand All @@ -27,9 +26,9 @@
"dependencies": {
"@openrouter/ai-sdk-provider": "^3.0.0",
"@sentry/node": "file:../../packed/sentry-node-packed.tgz",
"ai": "^7.0.82",
"ai": "^7.0.172",
"dataloader": "^2.2.3",
"eve": "^0.63.0",
"eve": "^1.0.0",
"zod": "4.6.6"
},
"devDependencies": {
Expand All @@ -46,14 +45,14 @@
"optional": true,
"optionalVariants": [
{
"build-command": "pnpm test:build-latest",
"assert-command": "pnpm test:assert-latest",
"label": "node-eve (latest)"
"build-command": "pnpm test:build-0.x",
"assert-command": "pnpm test:assert",
"label": "node-eve (0.x)"
},
{
"build-command": "pnpm test:build-content-off",
"assert-command": "pnpm test:assert-content-off",
"label": "node-eve (content off, latest)"
"label": "node-eve (content off)"
},
{
"build-command": "pnpm test:build-orchestrion",
Expand Down
21 changes: 10 additions & 11 deletions dev-packages/e2e-tests/test-applications/node-eve/tests/eve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@sentry/conventions/attributes';
import { GEN_AI_DECIDE, GEN_AI_EXECUTE_TOOL, GEN_AI_INVOKE_AGENT } from '@sentry/conventions/op';
import { collectStreamedSpans, getSpanOp, waitForError } from '@sentry-internal/test-utils';
import { runAgentTurn } from './utils';
import { IS_EVE_0X, runAgentTurn } from './utils';

const APP = 'node-eve';

Expand Down Expand Up @@ -110,9 +110,12 @@ test('captures Vercel AI agent spans (invoke_agent, generate_content, execute_to
}
});

// `on`: eve >= 1.0.0-rc.10 takes `Sentry.eveInstrumentation()`'s trace policy, so content reaches `ai`'s channel.
// `off`: Sentry's `dataCollection.genAI` turns content off.
const genAIContent = process.env.SENTRY_GENAI_CONTENT;
// eve >= 1.0.0-rc.10 takes `Sentry.eveInstrumentation()`'s trace policy, so content reaches `ai`'s channel and only
// Sentry's `dataCollection.genAI` (`SENTRY_GENAI_CONTENT=off`) turns it off. eve 0.x ignores the trace policy and
// withholds content in production.
const genAIContentOff = process.env.SENTRY_GENAI_CONTENT === 'off';
const expectContent = !genAIContentOff && !IS_EVE_0X;
const expectNoContent = genAIContentOff || (IS_EVE_0X && process.env.TEST_ENV === 'production');

async function runWeatherTurn(baseURL: string) {
const traceSpansPromise = collectStreamedSpans(APP, spansOfTrace =>
Expand All @@ -128,7 +131,7 @@ async function runWeatherTurn(baseURL: string) {
}

test('records input and output messages and tool data when content is allowed', async ({ baseURL }) => {
test.skip(genAIContent !== 'on', 'needs SENTRY_GENAI_CONTENT=on');
test.skip(!expectContent, 'needs gen_ai content');

const { invokeAgent, executeTool } = await runWeatherTurn(baseURL!);

Expand All @@ -140,11 +143,7 @@ test('records input and output messages and tool data when content is allowed',
});

test('records usage but no messages when content is not allowed', async ({ baseURL }) => {
// eve allows content in development, so without Sentry's opt-out only production shows the default.
test.skip(
genAIContent === 'on' || (genAIContent !== 'off' && process.env.TEST_ENV !== 'production'),
'only without content',
);
test.skip(!expectNoContent, 'only without content');

const { invokeAgent } = await runWeatherTurn(baseURL!);

Expand Down Expand Up @@ -185,7 +184,7 @@ test('captures errors thrown inside an eve tool', async ({ baseURL }) => {

test('captures a gen_ai.decide span for a Jev call inside an eve tool', async ({ baseURL }) => {
// `ai` keeps no usage or input on decide spans for calls with recording off.
test.skip(genAIContent === 'off', 'needs gen_ai content');
test.skip(genAIContentOff, 'needs gen_ai content');

const traceSpansPromise = collectStreamedSpans(APP, spansOfTrace =>
[GEN_AI_EXECUTE_TOOL, GEN_AI_DECIDE].every(op => spansOfTrace.some(span => getSpanOp(span) === op)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { expect } from '@playwright/test';
import { createRequire } from 'node:module';

const { version: eveVersion } = createRequire(import.meta.url)('eve/package.json') as { version: string };

/** The `node-eve (0.x)` variant installs eve 0.x, which ignores the trace policy. */
export const IS_EVE_0X = eveVersion.startsWith('0.');

/**
* Drive one agent turn through eve's default HTTP channel and wait for it to
Expand Down
Loading