fix: asset filter ignored when combined with q (#728) - #929
Open
udeachudivine-spec wants to merge 1 commit into
Open
fix: asset filter ignored when combined with q (#728)#929udeachudivine-spec wants to merge 1 commit into
udeachudivine-spec wants to merge 1 commit into
Conversation
When both ?asset=USDC and ?q=<term> were supplied, the q filter searched assetCode as one of its OR arms. If <term> didn't match the pinned asset code the q filter would drop all streams that the asset filter had just kept, silently ignoring the asset param. Root cause: the q filter block unconditionally checked stream.assetCode.toLowerCase().includes(searchTerm) even when an explicit asset/assetCode filter was already active, creating an implicit conflict between the two filters. Fix: skip the assetCode arm of the q filter when asset or assetCode is already set. Both filters now combine with AND logic — asset pins the asset, q searches id/sender/recipient only. Same one-line fix applied to all three handlers that share this filter block: GET /api/streams, /api/streams/sender/:address, and /api/streams/recipient/:address. Tests: four new integration tests covering - q + asset AND intersection - q alone regression - asset alone regression - q matching asset-A while asset=B is set (empty intersection) Docs: updated OpenAPI spec (swagger.ts) to document AND semantics for all filter combinations on the three affected endpoints.
|
@udeachudivine-spec is attempting to deploy a commit to the ritik4ever's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Author
|
close issue #728 |
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.
When both ?asset=USDC and ?q= were supplied, the q filter searched assetCode as one of its OR arms. If didn't match the pinned asset code the q filter would drop all streams that the asset filter had just kept, silently ignoring the asset param.
Root cause: the q filter block unconditionally checked
stream.assetCode.toLowerCase().includes(searchTerm)
even when an explicit asset/assetCode filter was already active, creating an implicit conflict between the two filters.
Fix: skip the assetCode arm of the q filter when asset or assetCode is already set. Both filters now combine with AND logic — asset pins the asset, q searches id/sender/recipient only.
Same one-line fix applied to all three handlers that share this filter block: GET /api/streams, /api/streams/sender/:address, and /api/streams/recipient/:address.
Tests: four new integration tests covering
Docs: updated OpenAPI spec (swagger.ts) to document AND semantics for all filter combinations on the three affected endpoints.
Commit Type
Breaking change? (If yes, add
BREAKING CHANGEin the commit footer)What changed
Testing done
Related issues
Closes #
Checklist