Skip to content

refactor: dedupe sentry trace#8994

Open
gambinish wants to merge 1 commit into
mainfrom
perps/dedupe-sentry-trace
Open

refactor: dedupe sentry trace#8994
gambinish wants to merge 1 commit into
mainfrom
perps/dedupe-sentry-trace

Conversation

@gambinish
Copy link
Copy Markdown
Member

@gambinish gambinish commented Jun 3, 2026

Explanation

Gaps to close (likely in the sibling client PRs, not core)

  • late_success/late_error is the taxonomy used, rather than timeout so some dashboards may need to be updated.
  • docs/perps/perps-sentry-reference.md (mobile) still needs updating to describe the new controller-owned trace semantics and the removal of the toast trace.
  • removing usePerpsMeasurement({ traceName: PerpsOrderSubmissionToast }) from usePerpsOrderExecution.ts, deleting the PerpsOrderSubmissionToast TraceName from app/util/trace.ts, and the mobile-side Promise.race.
  • the core tests cover the meaningful equivalents (fast/late success, fast/late error). The literal "timeout" and "navigation-away" cases don't apply in core; that's fine, but the epic's mobile PR should still cover navigation-away at the UI layer if any UI tracing remains.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes real order-submission observability and trace payloads for a core trading path; behavior intentionally avoids client-side cancellation, but consumers may rely on new reason values.

Overview
Adds a 60s observational threshold (PlaceOrderTimeoutMs) on TradingService.placeOrder: when the provider round-trip runs long, the code emits a warning breadcrumb and debug log but does not cancel the in-flight placeOrder (avoids false failures if HyperLiquid still accepts the order).

Perps Place Order trace end data now includes optional reason: late_success / late_error when the outcome arrives after the threshold, or error otherwise; successful fast paths omit reason.

Removes the unused Perps Order Submission Toast entry from PerpsTraceName. Adds focused unit tests for threshold timing, trace reasons, and timer cleanup.

Reviewed by Cursor Bugbot for commit a4f810d. Bugbot is set up for automated code reviews on this repo. Configure here.

@gambinish gambinish requested review from a team as code owners June 3, 2026 22:05
@gambinish gambinish temporarily deployed to default-branch June 3, 2026 22:06 — with GitHub Actions Inactive
Copy link
Copy Markdown

@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.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit a4f810d. Configure here.


traceData = {
success: false,
reason: didExceedOrderSubmissionThreshold ? 'late_error' : 'error',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Late error mislabels post-provider failures

Medium Severity

The catch path sets trace reason to late_error whenever didExceedOrderSubmissionThreshold is true, including when provider.placeOrder already finished successfully and a later step (e.g. #handleOrderSuccess or #trackOrderResult) throws. That labels a slow-but-successful submission as a late provider error in Sentry.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a4f810d. Configure here.

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.

legit?

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