Skip to content

chore: relax RelatedAsset validation and filter invalid assets#8920

Open
zone-live wants to merge 4 commits into
mainfrom
TSA-594-relax-type-validation
Open

chore: relax RelatedAsset validation and filter invalid assets#8920
zone-live wants to merge 4 commits into
mainfrom
TSA-594-relax-type-validation

Conversation

@zone-live
Copy link
Copy Markdown
Contributor

@zone-live zone-live commented May 28, 2026

Explanation

Fixes a production bug where one relatedAsset missing sourceAssetId caused the entire What's Happening section to show an error state.

  • Make name and sourceAssetId optional in RelatedAssetStruct
    and RelatedAsset type (symbol is now the only required field)
  • Replace normalizeRelatedAssets with filterAndNormalizeRelatedAssets
    which strips assets with empty symbol and drops trends with zero
    valid assets after filtering

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes public RelatedAsset typing and silently drops trends/assets; consumers must handle optional name/sourceAssetId and possibly fewer trends than the raw API sent.

Overview
Fixes a production failure where fetchMarketOverview rejected the whole market-overview payload when any relatedAsset lacked name or sourceAssetId, breaking the What's Happening UI.

RelatedAsset validation and types now treat name and sourceAssetId as optional; symbol is the only required field. Post-validation normalization was renamed to filterAndNormalizeRelatedAssets: it still fills missing caip19 with [], removes assets with empty symbol, and drops trends that end up with no valid related assets (overview can return trends: [] instead of throwing). Changelog and service tests cover the new behavior.

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

@zone-live zone-live requested review from a team as code owners May 28, 2026 10:26
@zone-live zone-live temporarily deployed to default-branch May 28, 2026 10:27 — with GitHub Actions Inactive
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