feat: add feature_id and batch_id to Unified SwapBridge events#8964
Open
micaelae wants to merge 15 commits into
Open
feat: add feature_id and batch_id to Unified SwapBridge events#8964micaelae wants to merge 15 commits into
micaelae wants to merge 15 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
High Risk
Breaking API changes (
fetchQuotessignature, mandatoryfeature_idon events) and broad analytics/transaction-submission behavior changes across bridge and status controllers; clients must adopt new enums and call patterns.Overview
This PR standardizes Unified SwapBridge analytics around a required
feature_id(Segment-style snake_case values) and extends batch tracking for Batch Sell flows.Bridge controller:
FeatureIdmoves to publictypeswith new values (quick_buy_follow_trading,quick_buy_token_details,batch_sell,unified_swap_bridge, etc.); old camelCase IDs are renamed.feature_idis required on client event context and on quote fetch/stream paths (fetchQuotes, SSE).BridgeController:fetchQuotesnow requires aFeatureIdargument (breaking). Quotes from streams carryfeatureId; metrics types gain optionalbatch_idon submission/completion events.Bridge status controller: Replaces the old “skip all metrics when
featureIdis set (e.g. perps)” rule with an allowlist so Submitted / Completed / Failed / PollingStatusUpdated fire for unified swap, quick buy, and batch sell (perps still skips most status events except validation). Batch sell pre-generatesbatchIdviagenerateBatchId, passes it into transaction batches, and attachesbatch_idon Submitted/Completed/Failed. Quick-buy failure tracking is added where perps remains silent.Reviewed by Cursor Bugbot for commit 5c9a8ea. Bugbot is set up for automated code reviews on this repo. Configure here.