Skip to content

chore: relax RelatedAsset validation and filter invalid assets#8920

Merged
zone-live merged 5 commits into
mainfrom
TSA-594-relax-type-validation
May 28, 2026
Merged

chore: relax RelatedAsset validation and filter invalid assets#8920
zone-live merged 5 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 types and validation for market-overview related assets; clients must handle optional name/sourceAssetId, but behavior aligns with live API and reduces full-section failures.

Overview
Relaxes market overview RelatedAsset validation so partially enriched API rows no longer fail the whole response.

RelatedAsset.name and RelatedAsset.sourceAssetId are now optional in the superstruct schema (RelatedAssetStruct) and the exported RelatedAsset type; symbol remains required. Missing name or sourceAssetId no longer causes fetchMarketOverview to throw API_INVALID_RESPONSE. JSDoc now tells clients to fall back to symbol when name is absent.

Tests were updated: invalid-entry cases focus on a missing symbol, and new cases assert successful overviews when sourceAssetId or name is omitted. The changelog documents the fix under Unreleased → Fixed.

Reviewed by Cursor Bugbot for commit 82c7647. 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
@zone-live zone-live added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit f837f15 May 28, 2026
370 checks passed
@zone-live zone-live deleted the TSA-594-relax-type-validation branch May 28, 2026 15:22
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.

2 participants