fix(data): preserve unknown activity side values#305
Open
aproskill81 wants to merge 1 commit intoPolymarket:mainfrom
Open
fix(data): preserve unknown activity side values#305aproskill81 wants to merge 1 commit intoPolymarket:mainfrom
aproskill81 wants to merge 1 commit intoPolymarket:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #305 +/- ##
==========================================
+ Coverage 85.54% 85.58% +0.04%
==========================================
Files 32 32
Lines 5167 5169 +2
==========================================
+ Hits 4420 4424 +4
+ Misses 747 745 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Zorak556
added a commit
to Zorak556/polymarket-client-sdk
that referenced
this pull request
Apr 10, 2026
Upstream merges: - Polymarket#321: accept custom reqwest::Client via Config - Polymarket#322: BuilderTradeResponse.builder Address → ApiKey - Polymarket#306: add match_time_nano to TradeResponse - Polymarket#305: preserve unknown activity side values - Polymarket#303: version bump to 0.4.5 - Dep bumps: rust_decimal 1.41, uuid 1.23 Local patches: - Reduce auth header allocations (HeaderValue::from for integers) - Reorder order_builder size validation before async fee_rate call - Skip double deserialization when tracing is disabled - subscribe_book_and_prices: single-stream book + price_change - subscribe_user/orders/trades: async for tokio::sync::RwLock - Subscription lag: escalate to error and force resubscribe - Broadcast capacity: 1024 → 16384 - excludeDepositsWithdrawals param on ActivityRequest - cancel_order: orderId → orderID Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Zorak556
added a commit
to Zorak556/polymarket-client-sdk
that referenced
this pull request
Apr 10, 2026
Upstream merges: - Polymarket#321: accept custom reqwest::Client via Config - Polymarket#322: BuilderTradeResponse.builder Address → ApiKey - Polymarket#306: add match_time_nano to TradeResponse - Polymarket#305: preserve unknown activity side values - Polymarket#303: version bump to 0.4.5 - Dep bumps: rust_decimal 1.41, uuid 1.23 Local patches: - Reduce auth header allocations (HeaderValue::from for integers) - Reorder order_builder size validation before async fee_rate call - Skip double deserialization when tracing is disabled - subscribe_book_and_prices: single-stream book + price_change - subscribe_user/orders/trades: async for tokio::sync::RwLock - Subscription lag: escalate to error and force resubscribe - Broadcast capacity: 1024 → 16384 - excludeDepositsWithdrawals param on ActivityRequest - cancel_order: orderId → orderID Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Preserve unknown
Activity.sidevalues instead of dropping them during Data API deserialization.Problem
Activity.sideis deserialized through a custom helper that currently maps:BUY->Some(Side::Buy)SELL->Some(Side::Sell)NoneNoneThis loses information for forward-compatibility cases, even though
Sidealready supportsUnknown(String).As a result, if the API introduces a new non-empty side value, the SDK silently drops it instead of preserving the raw value.
Fix
Update
deserialize_optional_sideso that:BUYdeserializes toSome(Side::Buy)SELLdeserializes toSome(Side::Sell)NoneSome(Side::Unknown(raw))Tests
Added coverage for:
NoneNote
Low Risk
Low risk: small, localized change to
Activity.sidedeserialization plus tests; behavior only differs for previously-unrecognized non-empty side values.Overview
Updates Data API
Activity.sidedeserialization to preserve any non-empty, unrecognized side string asSome(Side::Unknown(raw))rather than coercing it toNone(while keeping empty strings asNone).Adds test coverage to ensure unknown side values round-trip into
Side::Unknownand that empty side strings continue to deserialize toNone.Written by Cursor Bugbot for commit 938b4ba. This will update automatically on new commits. Configure here.