Skip to content

Reject empty filter membership arrays - #31

Merged
yosriady merged 1 commit into
mainfrom
agent/reject-empty-filter-memberships
Jul 29, 2026
Merged

Reject empty filter membership arrays#31
yosriady merged 1 commit into
mainfrom
agent/reject-empty-filter-memberships

Conversation

@yosriady

@yosriady yosriady commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What changed

  • reject empty membership arrays in analytics filters, nested analytics filters, segments, and profile search
  • require canonical array filter values to contain at least one member
  • add focused regression tests for every CLI surface

Why

The API now rejects empty in/nin arrays 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 typecheck
  • pnpm lint

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@yosriady
yosriady marked this pull request as ready for review July 29, 2026 08:30
@yosriady
yosriady merged commit 6e255dd into main Jul 29, 2026
7 checks passed
@yosriady
yosriady deleted the agent/reject-empty-filter-memberships branch July 29, 2026 08:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/commands/analytics.ts
Comment on lines +91 to +93
if (isEmptyMembershipArray(record.value)) {
throw new Error(`${path}: membership arrays cannot be empty`)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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