feat: add feature_id and batch_id to Unified SwapBridge events#8964
Open
micaelae wants to merge 16 commits into
Open
feat: add feature_id and batch_id to Unified SwapBridge events#8964micaelae wants to merge 16 commits into
micaelae wants to merge 16 commits into
Conversation
336313d to
4ddac53
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 51dc34e. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
Metrics changes
Unified SwapBridgeevent propertiesfeature_id(all events)batch_sell(Submitted, Completed, Failed for BatchSell)fetchQuotes changes
featureIda required param offetchQuotesto identify callersfetchQuotescallbatch-sell submission changes
Client-side updates
yarn lint:tscto see wherefeature_idneeds to be added, then fix the type errorsfetchQuotesusages and add FeatureIdReferences
Fixes https://consensyssoftware.atlassian.net/browse/SWAPS-4468
Checklist
Note
Medium Risk
Breaking changes to
fetchQuotesand requiredfeature_idon clients; analytics and metrics behavior shifts (including which features emit Completed/Failed).Overview
This PR standardizes Unified SwapBridge analytics and tightens how callers identify product surfaces.
FeatureIdmoves tobridge-controllertypes with Segment-style snake_case values (quick_buy_follow_trading,quick_buy_token_details,dapp_swap,batch_sell,unified_swap_bridge,perps, etc.).feature_idis required on client analytics context and is attached across quote polling, SSE streams, andtrackUnifiedSwapBridgeEventpayloads (with defaults from the active quote where applicable).Breaking API:
BridgeController:fetchQuotesnow requires aFeatureIdargument (no longer optional/null), and quote/update flows thread that id into fetch and streaming. Integrators must passfeature_idwhen updating quote params and fix anyfetchQuotescall sites.bridge-status-controllerpre-generatesbatch_idfor batch sell (viagenerateBatchId), passes it into transaction batches and Submitted / Completed / Failed events. Post-submit metrics are gated byALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS: quick buy and batch sell now emit lifecycle events; perps still skips most status events but StatusValidationFailed remains. Optionalbatch_idis added to relevant Segment-style event types.Reviewed by Cursor Bugbot for commit f5ff6e5. Bugbot is set up for automated code reviews on this repo. Configure here.