Skip to content

feat(effect): Add E2E tests for the @sentry/effect SDK#19763

Merged
JPeer264 merged 3 commits intojp/add-effect-sdkfrom
jp/add-effect-sdk-stack/6
Mar 12, 2026
Merged

feat(effect): Add E2E tests for the @sentry/effect SDK#19763
JPeer264 merged 3 commits intojp/add-effect-sdkfrom
jp/add-effect-sdk-stack/6

Conversation

@JPeer264
Copy link
Member

This adds Node and Browser tests for the @sentry/effect SDK.

I am not sure what to do with the browser part, as there is I guess no tree-shaking available right now.

The basic usage for node and browser are the exact same, only the effectLayer has to be added into the runtime layer.

@JPeer264 JPeer264 requested review from Lms24 and andreiborza March 11, 2026 13:59
@JPeer264 JPeer264 self-assigned this Mar 11, 2026
console.error(err.details);
}
return;
}
Copy link

Choose a reason for hiding this comment

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

Build script silently swallows webpack fatal errors

Medium Severity

When webpack invokes the callback with a fatal err (e.g. configuration error or file system failure — distinct from compilation errors), the handler logs the error and calls return without process.exit(1). The build process then exits with code 0, making CI falsely report a successful build even though no output was produced, causing the subsequent pnpm start to serve stale or missing files.

Fix in Cursor Fix in Web

const contextLog = logs.find(log => log.body === 'Log with context');
expect(contextLog).toBeDefined();
expect(contextLog?.level).toBe('info');
});
Copy link

Choose a reason for hiding this comment

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

Log context test never verifies context attributes

Low Severity

Both "should send Effect logs with context attributes" tests use Effect.annotateLogs('userId', '12345') and Effect.annotateLogs('action', 'test') to attach context, but the assertions only check body and level. The userId and action attributes are never asserted, so the test doesn't actually verify the behaviour its name describes. A regression where context attributes stop being forwarded would go undetected.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.64 kB added added
@sentry/browser - with treeshaking flags 24.15 kB added added
@sentry/browser (incl. Tracing) 42.63 kB added added
@sentry/browser (incl. Tracing, Profiling) 47.28 kB added added
@sentry/browser (incl. Tracing, Replay) 81.43 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 86.13 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 98.38 kB added added
@sentry/browser (incl. Feedback) 42.45 kB added added
@sentry/browser (incl. sendFeedback) 30.32 kB added added
@sentry/browser (incl. FeedbackAsync) 35.37 kB added added
@sentry/browser (incl. Metrics) 26.93 kB added added
@sentry/browser (incl. Logs) 27.08 kB added added
@sentry/browser (incl. Metrics & Logs) 27.75 kB added added
@sentry/react 27.39 kB added added
@sentry/react (incl. Tracing) 44.96 kB added added
@sentry/vue 30.09 kB added added
@sentry/vue (incl. Tracing) 44.49 kB added added
@sentry/svelte 25.67 kB added added
CDN Bundle 28.27 kB added added
CDN Bundle (incl. Tracing) 43.5 kB added added
CDN Bundle (incl. Logs, Metrics) 29.14 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 44.35 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 68.2 kB added added
CDN Bundle (incl. Tracing, Replay) 80.32 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.22 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 85.86 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.76 kB added added
CDN Bundle - uncompressed 82.61 kB added added
CDN Bundle (incl. Tracing) - uncompressed 128.54 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.47 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.41 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.1 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.4 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.25 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.31 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.15 kB added added
@sentry/nextjs (client) 47.37 kB added added
@sentry/sveltekit (client) 43.08 kB added added
@sentry/node-core 52.28 kB added added
@sentry/node 175.13 kB added added
@sentry/node - without tracing 97.44 kB added added
@sentry/aws-serverless 113.24 kB added added

@JPeer264 JPeer264 force-pushed the jp/add-effect-sdk-stack/6 branch from 1e82465 to 5c2a44e Compare March 11, 2026 15:16
Copy link

@cursor cursor bot left a comment

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.

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

const contextLog = logs.find(log => log.body === 'Log with context');
expect(contextLog).toBeDefined();
expect(contextLog?.level).toBe('info');
});
Copy link

Choose a reason for hiding this comment

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

Log context test doesn't assert context attributes

Medium Severity

The tests named "should send Effect logs with context attributes" never assert that userId or action attributes are present in the serialized log payload. They only check level and body. The app code uses Effect.annotateLogs('userId', '12345') and Effect.annotateLogs('action', 'test'), but SentryEffectLogger in logger.ts only destructures { logLevel, message } from the Effect Logger callback — annotations are silently ignored and never forwarded to sentryLogger. These tests give false confidence that context attributes work when they're actually dropped. The test names claim to verify context attributes but the assertions don't cover them.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

@JPeer264 JPeer264 force-pushed the jp/add-effect-sdk branch 2 times, most recently from 2db4b85 to 3070535 Compare March 11, 2026 15:47
@JPeer264 JPeer264 force-pushed the jp/add-effect-sdk-stack/6 branch from 5c2a44e to e532d18 Compare March 11, 2026 15:58
@@ -0,0 +1,101 @@
import * as Sentry from '@sentry/effect/server';
Copy link
Member

Choose a reason for hiding this comment

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

q: Actually, can we not make this isomorphic? Is there a reason to not support both client/server from @sentry/effect?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is working already without /server. I'll update it

Comment on lines +32 to +38
if (err) {
console.error(err.stack || err);
if (err.details) {
console.error(err.details);
}
return;
}
Copy link

Choose a reason for hiding this comment

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

Bug: The webpack build script logs fatal configuration errors but doesn't exit with a failure code, causing the CI build to appear successful despite the failure.
Severity: MEDIUM

Suggested Fix

Add process.exit(1) within the if (err) block after logging the error. This will ensure that any fatal webpack configuration error causes the build process to fail with a non-zero exit code, correctly signaling a build failure in the CI pipeline.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: dev-packages/e2e-tests/test-applications/effect-browser/build.mjs#L32-L38

Potential issue: In the webpack build script, if a fatal configuration error occurs, the
`err` object is logged, but the process does not exit with a non-zero status code.
Instead, it returns and exits cleanly with code 0. This causes the CI/CD pipeline to
incorrectly report the build as successful. Subsequent steps, like starting the
application server, will then fail with a confusing error because the build artifacts
were never created. This masks the true root cause of the failure, which is the webpack
configuration error.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

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

LGTM

@JPeer264 JPeer264 merged commit 8c2378e into jp/add-effect-sdk Mar 12, 2026
34 checks passed
@JPeer264 JPeer264 deleted the jp/add-effect-sdk-stack/6 branch March 12, 2026 13:21
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.

2 participants