fix(perps): validate market patterns and log invalid ones to Sentry#26053
fix(perps): validate market patterns and log invalid ones to Sentry#26053abretonc7s merged 2 commits intomainfrom
Conversation
Bad LaunchDarkly patterns could crash the provider constructor or flood Sentry with CLIENT_NOT_INITIALIZED errors. Filter invalid patterns at both ingestion points (FeatureFlagConfigurationService, HyperLiquidProvider) and report each via logger.error for prod visibility. Also fix stripQuotes to handle nested quote layers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Bad LaunchDarkly patterns could crash the provider constructor or flood Sentry with CLIENT_NOT_INITIALIZED errors. Filter invalid patterns at both ingestion points (FeatureFlagConfigurationService, HyperLiquidProvider) and report each via logger.error for prod visibility. Also fix stripQuotes to handle nested quote layers.
abb19a3 to
572077d
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These changes improve resilience of the Perps feature when receiving malformed configuration from LaunchDarkly. While the changes are defensive and don't alter core functionality, they affect critical initialization paths for the Perps trading feature. Selected tags based on tag descriptions:
Performance Test Selection: |
|



Description
Defense-in-depth fix to prevent a single bad LaunchDarkly pattern from crashing the perps provider or flooding Sentry with
CLIENT_NOT_INITIALIZEDerrors.FeatureFlagConfigurationService.filterValidPatterns,HyperLiquidProvider.compilePatternsSafely) — invalid patterns are dropped and reported to SentrystripQuotesto handle nested quote layers (e.g.'"xyz:TSLA"'from LaunchDarkly)Changelog
CHANGELOG entry: null
Related issues
Fixes: Sentry
CLIENT_NOT_INITIALIZEDflood caused by malformed LaunchDarkly patternsManual testing steps
Screenshots/Recordings
N/A — no UI changes
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Scoped defensive validation/logging changes around feature-flag parsing and pattern compilation; behavior changes mainly drop invalid patterns and avoid constructor throws.
Overview
Hardens HIP-3 market allow/blocklist handling so malformed LaunchDarkly values no longer crash perps setup:
FeatureFlagConfigurationServicenow validates patterns viavalidateMarketPattern, drops invalid entries, and logs them vialogger.error, falling back to the existing config when filtering produces an empty list.HyperLiquidProvidernow compiles market filters with a newcompilePatternsSafelyhelper that skips patterns that failcompileMarketPatternand logs the error instead of throwing during construction.stripQuoteswas updated to remove multiple nested quote layers, and new/expanded tests cover nested quote parsing plus invalid-pattern filtering/logging and provider resilience.Written by Cursor Bugbot for commit 572077d. This will update automatically on new commits. Configure here.