Skip to content

Conversation

@kube
Copy link
Collaborator

@kube kube commented Jan 6, 2026

Demo

Kapture 2026-01-07 at 20.22.59.mp4 (uploaded via Graphite)

🌟 What is the purpose of this PR?

This PR adds Sentry User Feedback + Error Tracker inside Petrinaut demo website.

🔍 What does this change?

Error Tracker

Because we don't want Petrinaut to be directly coupled to Sentry:

  • Adds React Context is added ErrorTrackerContext
  • Adds ErrorTrackerContext Provider for Sentry <SentryErrorTrackerProvider> (only used in demo-website)

This SentryErrorTrackerProvider is still not used for now in the app, but will be extended later to add more granular tracking of user experience in the demo app.

User Feedback

For now the User Feedback widget is the default one, this keeps it simple and prevents having to deal with React component props, or with design.

If we get a good Figma design, we'll be able customize this feedback button to place it properly in the UI.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

Given the User Feedback widget is the default one, it's on top of the UI and could possibly hide some things.

🐾 Next steps

In the future, we'll do more granular tracking of what happens in the app.

❓ How to test this?

Use latest Petrinaut deployment

Copy link
Collaborator Author

kube commented Jan 6, 2026

@kube kube changed the title Add @sentry/react dependency Setup Sentry UserFeedback + ErrorTracker Jan 6, 2026
kube added 3 commits January 7, 2026 19:16
…ider to a new path and enhance error handling callbacks
…e; improve Sentry integration by injecting SENTRY_DSN directly into the application.
@kube kube changed the title Setup Sentry UserFeedback + ErrorTracker H-5764: Setup Sentry UserFeedback + ErrorTracker Jan 7, 2026
@kube kube marked this pull request as ready for review January 7, 2026 19:25
@cursor
Copy link

cursor bot commented Jan 7, 2026

PR Summary

Introduces Sentry-based error tracking and feedback to the demo site with minimal coupling to the library.

  • Initialize Sentry in demo-site/sentry/instrument.ts with browser integrations and Feedback widget; enable only in production and wire DSN via import.meta.env.SENTRY_DSN
  • Wrap app in SentryErrorTrackerProvider implementing generic ErrorTrackerContext (src/error-tracker/error-tracker.context.ts); add React root error handlers (onUncaughtError, onCaughtError, onRecoverableError)
  • Vite: load .env, expose SENTRY_DSN at build time, add env typings, and include new sentry files in tsconfig
  • UX: keyboard shortcuts ignore Sentry feedback element to prevent conflicts
  • Add @sentry/react dependency and local .env with SENTRY_DSN

Written by Cursor Bugbot for commit 7a07628. This will update automatically on new commits. Configure here.

"@hashintel/ds-helpers": "0.0.1-b",
"@local/eslint": "0.0.0-private",
"@pandacss/dev": "1.4.3",
"@sentry/react": "10.22.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Move '@sentry/react': '10.22.0' from devDependencies to dependencies since it's being used at runtime in the demo-site files. Dependencies used at runtime should not be in devDependencies.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@augmentcode
Copy link

augmentcode bot commented Jan 7, 2026

🤖 Augment PR Summary

Summary: This PR wires Sentry error tracking + user feedback into the Petrinaut demo site.

Changes:

  • Initialize Sentry in the demo site with browser integrations, tracing, and the default Feedback widget.
  • Add a generic ErrorTrackerContext in the Petrinaut library and a Sentry-backed provider used by the demo site.
  • Wrap the demo app with SentryErrorTrackerProvider and register React root error handlers (onUncaughtError, onCaughtError, onRecoverableError).
  • Load SENTRY_DSN from .env via Vite and expose it at build time via import.meta.env.SENTRY_DSN typings.
  • Adjust editor keyboard shortcut handling to avoid capturing keystrokes while Sentry feedback UI is focused.
  • Add @sentry/react dependency for the Petrinaut package.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@@ -1,12 +1,30 @@
import "./sentry/instrument.js";
Copy link

Choose a reason for hiding this comment

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

./sentry/instrument.js doesn’t exist in this PR (only instrument.ts is added), so this import will likely fail at runtime/build time.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

"./*.ts",
"./*.d.ts",
"main/app.tsx",
"sentry/init-sentry.ts"
Copy link

Choose a reason for hiding this comment

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

This include entry points at sentry/init-sentry.ts, but the added Sentry initializer file is sentry/instrument.ts (so this looks like a stale/incorrect path).

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Sentry.withScope((scope) => {
if (context) {
for (const [key, value] of Object.entries(context)) {
scope.setContext(key, value as Record<string, unknown>);
Copy link

Choose a reason for hiding this comment

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

scope.setContext() expects an object, but ErrorTrackerContextData allows any unknown value; passing primitives here can lead to dropped context or unexpected serialization.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

"./*.ts",
"./*.d.ts",
"main/app.tsx",
"sentry/init-sentry.ts"
Copy link

Choose a reason for hiding this comment

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

tsconfig.json references non-existent file name

Medium Severity

The tsconfig include array references sentry/init-sentry.ts but the actual file is named sentry/instrument.ts. This mismatch means the TypeScript configuration explicitly includes a non-existent file while not explicitly including the actual sentry files in the sentry/ directory. While the files may still be type-checked through imports from main.tsx, this configuration is incorrect and could cause issues with TypeScript project references or direct tsc invocations.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants