Skip to content

fix: deduplicate null_as_empty_vec and normalize user_order channel name#33

Merged
pbeets merged 1 commit intomainfrom
fix/pr31-cleanup
Feb 25, 2026
Merged

fix: deduplicate null_as_empty_vec and normalize user_order channel name#33
pbeets merged 1 commit intomainfrom
fix/pr31-cleanup

Conversation

@pbeets
Copy link
Owner

@pbeets pbeets commented Feb 25, 2026

Summary

Addresses two issues from the PR #31 review:

  • Deduplicate null_as_empty_vec: The serde helper was duplicated byte-for-byte in market.rs and order.rs. Moved to a shared pub(crate) module in common.rs and replaced both copies with use super::common::null_as_empty_vec.

  • Normalize "user_order" channel name: The Kalshi API sends "user_order" (singular) as the message type, but the channel is subscribed as "user_orders" (plural). Without normalization, StreamUpdate.channel would be "user_order" for those messages, which wouldn't match the canonical Channel::UserOrders name in reconnect logic or downstream filtering. Added normalization in session.rs at the update handling point.

Test plan

  • cargo check passes
  • cargo clippy -- -D warnings clean
  • cargo test — all 196 tests pass
  • cargo fmt --check clean

Move the duplicated null_as_empty_vec serde helper from market.rs and
order.rs into a shared pub(crate) module in common.rs. Normalize the
"user_order" (singular) message type to "user_orders" in session.rs so
StreamUpdate.channel always uses the canonical channel name, preventing
mismatches in reconnect logic and downstream filtering.
@pbeets pbeets merged commit b51f0dc into main Feb 25, 2026
5 checks passed
@pbeets pbeets deleted the fix/pr31-cleanup branch February 25, 2026 08:18
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.

1 participant