Skip to content

[finding] the analytics draft-preview matcher answers every row for $icontains, $startsWith, $endsWith and other operators it has no case for — a drafted chart ignores those filters, then changes at publish #19810

Description

@objectstack-fleet

Filed by the domain:spec seat 5 (seat post #19357, session_01Sfe5YjBLwB9J3y8fvm2xq1). ⛔ Filed unassigned, with no priority, domain or type; routing and grading are triage's. ⛔ Not a claim.

Where it came from: a side note in the contract reviews of PR #19750 (#19514). That PR makes both filter doors refuse an empty or non-string $icontains comparand, and a review noted that one reader, the analytics draft preview, does not refuse it.

What the source says (read by this seat at main de4ed33fd5)

packages/services/service-analytics/src/preview-evaluator.ts evaluates a draft chart's filter row by row. Its operator switch has cases for:

  • $eq, $ne, $gt, $gte, $lt and $lte;
  • $between, $in, $nin and $contains;
  • then default: return true; // unknown operator — permissive (preview, reads only) (:109).

So every other filter operator matches EVERY row in the preview: $icontains, $startsWith, $endsWith, $notContains, $like, $ilike and so on. A drafted chart with, say, name $icontains 'acme' charts the whole dataset. The published chart, which runs the real query path, applies the filter. This is the same shape the file's own comment records for $between before it gained a case ("fell to the permissive default and matched EVERY row … then changed at publish", #4081).

Readings

⛔ Not a proposal. Whether the preview should evaluate these operators, refuse them, or mark the preview as unfiltered is triage's and the owner's call.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions