Skip to content

Conversation

@mjhuff
Copy link
Contributor

@mjhuff mjhuff commented Sep 15, 2025

Closes EXEC-1809, EXEC-1810, and EXEC-1811

Overview

This PR adds Sentry to our electron apps. Certain commits that are more interesting are highlighted below. This work is easiest to view commit-by-commit, although note that some of the mixpanel logic is changed in later commits. Later mergebacks are done to accomodate integrating the changes introduced in #19561. See Review Requests, too.

On a high level, we use the @sentry/electron package, which contains main and renderer libraries. These libraries contain specific integrations, which are effectively plugins used to report certain events. The renderer library contains all the same integrations as the @sentry/react package that we'd care about using for the browser-layer.

We have two separate projects the app and odd, and we use environmental tags of production and development, which make use of the existing NODE_ENV variable, which seems sufficient enough for our use-case. Version information (ex, 8.6.0-alpha.2) is also included.

8520c82 - Adding Sentry to our shell layers triggers an electron rebuild, which in turn led to failures due to some lower-level lib compatibility issues. Turns out we had some old dev webpack packages left around, so these are just cruft that need to be removed now.

bee2768 - Vite config needs some notion of whether it is a desktop or odd build target, because we keep separate sentry projects for the desktop/odd yet use the same app for both projects.

Note that this PR has an oe-core complimentary PR. See that PR for details.

Test Plan and Hands on Testing

  • Here is an app build and here is an odd build based on the head of this branch. The ODD build incorporates the complementary oe-core PR, too. Running these builds with analytics enabled will report valid errors to Sentry, which are visible on the Sentry dashboard.

Changelog

  • Added Sentry to deskop and odd builds.

Review requests

  • I'm selecting integrations based on a combination of what I think is useful and what PD uses, but feel free to peruse the docs and suggest different options.
  • We do filter out a few common errors, see the beforeSend callback in the app's sentry.ts. If there are any modifications that should be made to this list (or if we should filter any out from the shell layers, although they don't seem to be problematic), let me know.
  • There is currently no gating when it comes to injecting the sentry tokens: any user who explicitly builds the app/an ot-3 system update image on CI and then runs it will cause sentry reporting (ie, custom builds). This is true of mixpanel events, too, so it's consistent. Just something to be aware of.

Risk assessment

  • lowish - these changes are relatively orthogonal to everything else, so I think the only thing that has a real chance of breaking here is Sentry itself

@mjhuff mjhuff requested review from koji, sfoster1 and smb2268 September 15, 2025 20:39
@codecov
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

❌ Patch coverage is 0% with 164 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.67%. Comparing base (e9bb571) to head (a7ffff4).
⚠️ Report is 14 commits behind head on edge.

Files with missing lines Patch % Lines
app/src/App/sentry.ts 0.00% 65 Missing ⚠️
app-shell-odd/src/sentry.ts 0.00% 40 Missing ⚠️
app-shell/src/sentry.ts 0.00% 40 Missing ⚠️
app/src/App/hooks.ts 0.00% 8 Missing ⚠️
app/src/App/index.tsx 0.00% 5 Missing ⚠️
app-shell-odd/src/main.ts 0.00% 2 Missing ⚠️
app-shell/src/main.ts 0.00% 2 Missing ⚠️
app/src/App/DesktopAppFallback.tsx 0.00% 1 Missing ⚠️
app/src/App/OnDeviceDisplayAppFallback.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #19569      +/-   ##
==========================================
- Coverage   24.81%   23.67%   -1.14%     
==========================================
  Files        3439     3442       +3     
  Lines      303339   303652     +313     
  Branches    39884    39892       +8     
==========================================
- Hits        75260    71904    -3356     
- Misses     228047   231717    +3670     
+ Partials       32       31       -1     
Flag Coverage Δ
protocol-designer 18.86% <0.00%> (-0.02%) ⬇️
step-generation 5.47% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app-shell-odd/typings/global.d.ts 100.00% <ø> (ø)
app-shell/typings/global.d.ts 100.00% <ø> (ø)
app/typings/global.d.ts 100.00% <ø> (ø)
app/src/App/DesktopAppFallback.tsx 0.00% <0.00%> (ø)
app/src/App/OnDeviceDisplayAppFallback.tsx 0.00% <0.00%> (ø)
app-shell-odd/src/main.ts 0.00% <0.00%> (ø)
app-shell/src/main.ts 0.00% <0.00%> (ø)
app/src/App/index.tsx 0.00% <0.00%> (ø)
app/src/App/hooks.ts 0.00% <0.00%> (ø)
app-shell-odd/src/sentry.ts 0.00% <0.00%> (ø)
... and 2 more

... and 83 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mjhuff mjhuff force-pushed the add-sentry-electron-apps branch from 2fcc592 to 7834981 Compare September 16, 2025 18:54
@mjhuff mjhuff force-pushed the add-sentry-electron-apps branch 5 times, most recently from 6bbe3c7 to 1fc93ec Compare September 18, 2025 17:47
@mjhuff mjhuff force-pushed the add-sentry-electron-apps branch from 1fc93ec to 60534a7 Compare September 18, 2025 18:12
_OT_PD_SENTRY_DEV_DSN_: JSON.stringify(process.env.OT_PD_SENTRY_DEV_DSN),
_OT_PD_SENTRY_DSN_: JSON.stringify(process.env.OT_PD_SENTRY_DSN),
_OT_PD_VERSION_: JSON.stringify(process.env.OT_PD_VERSION),
'process.env.NODE_DEBUG': JSON.stringify(process.env.NODE_DEBUG),
Copy link
Contributor Author

@mjhuff mjhuff Sep 18, 2025

Choose a reason for hiding this comment

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

For some currently unexplainable reason, we need to inject this value for the app to render properly, even though this PR did not introduce granular env injection. A lib uses this value internally.

Even more confusingly, pd and labware library e2e testing on CI only require that their respective vite.config.mts files inject this value to pass...

@mjhuff mjhuff force-pushed the add-sentry-electron-apps branch from a7ffff4 to 60534a7 Compare September 19, 2025 20:20
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.

3 participants