Skip to content

Changed members filter state to preserve unknown NQL filter properties#28479

Draft
kevinansfield wants to merge 2 commits into
mainfrom
members-filter-preserve-unknown-nql
Draft

Changed members filter state to preserve unknown NQL filter properties#28479
kevinansfield wants to merge 2 commits into
mainfrom
members-filter-preserve-unknown-nql

Conversation

@kevinansfield

Copy link
Copy Markdown
Member

ref #28232

The multiple-active-subscriptions filter in #28232 needed to survive the members URL writeback, which was handled with a one-off preserveMultipleActiveSubscriptionsFilter mode bolted onto useMembersFilterState. That special case meant any other NQL the filter UI can't represent — unknown fields, OR groups, operators the field map doesn't advertise — was still silently scrubbed from the URL, breaking hand-crafted and legacy Ember filter links.

This generalises the underlying filter state handling so unknown NQL filter properties are always preserved, and removes the special-case mode entirely:

  • The filter param is parsed once and split into its top-level AND clauses via the AST. Clauses that map to filter chips behave as before; every other valid clause is carried through the URL writeback, the nql output (so it still filters the member list via the API), and chip edits. Only "clear" actions remove them.
  • Since nql-lang has no AST→string serializer, this adds one (serializeAstToNql) as the inverse of the parser for every shape its grammar can emit, including the ~/~^/~$ regex forms and preserved relative dates. It's deliberately conservative: anything it can't faithfully round-trip returns undefined and the clause is dropped rather than risk writing corrupted NQL back to the URL.
  • When recombining clauses, root-level OR clauses are parenthesized (AND binds tighter than OR in NQL) so precedence survives the join.

The banner behaviour from #28232 is unchanged — it still exact-matches its filter in nql — but adding a chip on top of an unknown filter now ANDs the two together instead of dropping the unknown part, and unknown filters now work regardless of the labs flag (the flag only gates the banner UI).

Stacked on #28232 so only the refactor is in the diff; it'll retarget to main when that merges.

no issue

This adds a labs-gated warning and exact members filter for identifying members with active subscriptions across multiple Stripe customers.
ref #28232

- the multiple-active-subscriptions banner needed its filter to survive the members URL writeback, which was handled with a one-off `preserveMultipleActiveSubscriptionsFilter` mode bolted onto the filter state hook
- generalised the underlying filter state handling instead: the filter param is parsed once, split into its top-level AND clauses via the AST, and any clause the filter UI can't represent (unknown fields, OR groups, operators the field map doesn't advertise) is preserved through the URL, the `nql` output, and chip edits rather than silently dropped
- added an AST→NQL serializer as the inverse of nql-lang's parser, since the library has no serializer of its own; it returns undefined for anything it can't faithfully round-trip so clauses are dropped rather than corrupted
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ac141e55-e932-4744-80a7-4055a7856f3d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch members-filter-preserve-unknown-nql

Comment @coderabbitai help to get the list of available commands and usage tips.

Base automatically changed from multiple-subs-filter-banner to main June 10, 2026 14:40
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