Skip to content

refactor: dedupe sentry trace#8994

Open
gambinish wants to merge 2 commits into
mainfrom
perps/dedupe-sentry-trace
Open

refactor: dedupe sentry trace#8994
gambinish wants to merge 2 commits 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 order-placement tracing and timing behavior on a critical trading path; behavior intentionally avoids cancelling in-flight orders but dashboards and mobile UI must align on late_* reasons instead of client timeouts.

Overview
TradingService.placeOrder now treats PlaceOrderTimeoutMs (60s) as an observational threshold only: a timer fires a warning breadcrumb and flags slow submissions, but the code still awaits provider.placeOrder to completion (no client-side cancel / Promise.race), avoiding UI “failed” while HyperLiquid may still accept the order.

endTrace payload gains optional reason: late_success / late_error when the provider finishes after the threshold, otherwise error on failures; timers are cleared in finally.

Adds PERPS_CONSTANTS.PlaceOrderTimeoutMs, removes unused Perps Order Submission Toast from PerpsTraceName, changelog updates, and TradingService.placeOrder.timeout.test.ts for fast/late success and error paths.

Reviewed by Cursor Bugbot for commit 30c06b9. 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.

Comment thread packages/perps-controller/src/services/TradingService.ts Outdated
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