Reject empty filter membership arrays - #31
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffc4a316a4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (isEmptyMembershipArray(record.value)) { | ||
| throw new Error(`${path}: membership arrays cannot be empty`) | ||
| } |
There was a problem hiding this comment.
Validate membership arrays inside analytics params
For funnel or flow calls that put filters in the documented --params structures (such as steps[].filters or global_filters), this check is never reached because buildAnalyticsParams JSON-stringifies object parameters without traversing them. For example, a step containing { "field": "sku", "op": "in", "value": [] } is still sent to the API and receives the server-side rejection this change is intended to catch locally; validate the filter-bearing pipe parameters as well.
Useful? React with 👍 / 👎.
What changed
Why
The API now rejects empty
in/ninarrays because Tinybird's pipe-delimited transport cannot distinguish an empty set from an empty-string member. Catching this locally gives CLI users a clear error before making a request.Impact
Valid non-empty membership arrays and scalar values are unchanged. Invalid empty arrays now fail locally with
membership arrays cannot be empty.Validation
pnpm test(168 passing, 18 live tests pending)pnpm typecheckpnpm lintNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.