chore: remove TraderProfileResponse.followingCount#9162
Closed
Bigshmow wants to merge 1 commit into
Closed
Conversation
The social-api response contract was changed in social-api PR #88 to drop `followingCount` (it had been a transitional duplicate of `metrics.allPartners.followingCount` and is no longer surfaced as a top-level field). The SDK's runtime validation struct still required it, causing `fetchTraderProfile` to throw `FETCH_TRADER_PROFILE_INVALID_RESPONSE` and breaking the mobile trader profile view. Rather than relaxing the field to optional (a half-step that leaves a dead field in the SDK contract), remove it entirely from both the runtime struct and the TypeScript type so the SDK's view of the response matches what the API actually delivers. No current consumers depend on the field (verified across the MetaMask ecosystem before removal). BREAKING CHANGE: `TraderProfileResponse.followingCount` is removed. Consumers that read `result.followingCount` will see a TypeScript compile error after upgrading and must remove their references. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
842cad7 to
51cb451
Compare
Contributor
Author
|
Reconsidered - followingCount removal from social-api was incidental, not deliberate. Putting the field back in social-api is the cleaner fix. SDK stays as-is. |
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.
The social-api response contract was changed in social-api PR #88 to drop
followingCount(it had been a transitional duplicate ofmetrics.allPartners.followingCountand is no longer surfaced as a top-level field). The SDK's runtime validation struct still required it, causingfetchTraderProfileto throwFETCH_TRADER_PROFILE_INVALID_RESPONSEand breaking the mobile trader profile view.Rather than relaxing the field to optional (a half-step that leaves a dead field in the SDK contract), remove it entirely from both the runtime struct and the TypeScript type so the SDK's view of the response matches what the API actually delivers.
Explanation
Current state and why it needs to change
SocialService.fetchTraderProfileruntime-validates each response againstTraderProfileResponseStructusingsuperstruct'sis(). The struct assertedfollowingCount: number()as non-optional, so every response from the updated social-api fails validation. The SDK throwsFETCH_TRADER_PROFILE_INVALID_RESPONSEand the mobile view renders its error fallback ("Couldn't load profile") for every trader.The deeper problem isn't just that the field was required — it's that the field was in the SDK contract at all. The API stopped sending it, no consumer in the MetaMask ecosystem reads it, and the SDK's strict runtime validation surfaced this contract drift as a hard failure rather than gracefully ignoring an unused field.
Solution
Remove
followingCountfrom bothTraderProfileResponseStructand theTraderProfileResponseTS type. After this change, the SDK's view of the trader profile response matches what the API actually delivers, and the struct stops enforcing a contract on a field that has no consumers.Consumer verification
Before opening this PR, we confirmed that no current consumers across the MetaMask ecosystem read
result.followingCount:metamask-mobile: zero references in non-test files (grepped).If any consumer surfaces an unexpected reference during review, happy to downgrade this to "optional" (minor bump) instead of full removal (major bump).
Why major bump
This is a TypeScript-level breaking change: consumers that read
result.followingCountwill see a compile error after upgrading. Even though no known consumer does this today, the removal itself is structurally breaking and warrants a major version bump per semver. The release should be tagged3.0.0.References
consensys-vertical-apps/va-mmcx-social-api#88(droppedfollowingCountfrom the trader profile response).@metamask/social-controllersinmetamask-mobile.Checklist