Skip to content

fix(models): expose missing activity market icons as None#94

Merged
cesarenaldi merged 1 commit into
mainfrom
fix/dev-258-activity-empty-icon
Jun 11, 2026
Merged

fix(models): expose missing activity market icons as None#94
cesarenaldi merged 1 commit into
mainfrom
fix/dev-258-activity-empty-icon

Conversation

@cesarenaldi

@cesarenaldi cesarenaldi commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Sparse historical activity rows come back with an empty-string icon. The strict activity models (TradeActivity and the split/merge/redeem/conversion variants) currently surface that "" as-is, while the TypeScript SDK exposes missing icons as null.

This aligns the contract: icon is now str | None on the strict activity models, and empty-string icons are normalized to None during activity payload normalization (same sentinel handling already used for conditionId/asset/side/outcome).

Note: the API serializes icon as a string and never emits null (verified against the payload source and live responses), so this is a parity/ergonomics fix rather than a parse-failure fix.

Verification

  • Added unit tests: TRADE and SPLIT payloads with icon: "" parse with icon is None.
  • uv run pytest tests/unit -q: 1698 passed.
  • uv run ruff check ., uv run ruff format --check .: clean.
  • uv run pyright: 0 errors.
  • Live smoke: parsed 500 activity rows from a wallet with 129 sparse rows; all sparse icons surface as None, populated icons unchanged.

Note

Low Risk
Small model and normalization change for an optional display field; no auth, payments, or persistence logic.

Overview
Activity icon parity with the TypeScript SDK: sparse API rows send icon as "". TradeActivity and market-event activities (Split, Merge, Redeem, Conversion) now type icon as str | None (default None) instead of required str.

Normalization: _normalize_activity_payload treats empty icon like other sentinels (conditionId, asset, etc.)—the key is dropped so parsing yields None rather than "".

Unit tests cover TRADE and SPLIT payloads with icon: "".

Reviewed by Cursor Bugbot for commit b36b41f. Bugbot is set up for automated code reviews on this repo. Configure here.

@cesarenaldi cesarenaldi merged commit 0adfad7 into main Jun 11, 2026
7 checks passed
@cesarenaldi cesarenaldi deleted the fix/dev-258-activity-empty-icon branch June 11, 2026 11:56
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