Skip to content

feat: support multi-value array properties for non-set operators#45

Merged
kyeh-amp merged 1 commit into
mainfrom
multi-value-array-fix
Apr 28, 2026
Merged

feat: support multi-value array properties for non-set operators#45
kyeh-amp merged 1 commit into
mainfrom
multi-value-array-fix

Conversation

@kyeh-amp
Copy link
Copy Markdown
Collaborator

@kyeh-amp kyeh-amp commented Apr 22, 2026

Summary

Non-set operators (is, contains, greater, etc.) previously coerced array/list properties to a single JSON-stringified value, diverging from analytics/charts behavior where any element of an array can satisfy the condition.

  • matchCondition now consults coerceStringList for every non-null value and dispatches to a new matchStringsNonSet helper when the value coerces to a list — any-match semantics, including for negation operators (is not, does not contain), which match if any single element satisfies the negation.
  • coerceStringList gains a strings.HasPrefix(s, "[") pre-check so scalar strings skip JSON parsing now that every value passes through it.
  • User-visible consequence: JSON-array strings with leading whitespace (e.g., " [\"a\"]") are no longer parsed as arrays by set operators.

Test plan

  • Inline flag/condition harness drives 14 evaluation-engine unit cases (scalar / collection / JSON-array-string × set and non-set operators)
  • 7 integration tests against the superset deployment (server-VVhLULXCxxY0xqmszXouXxiEzoeJWmSh)
  • Pre-existing evaluation tests unchanged (segment-name assertions still match the superset deployment)
  • go vet ./... clean
  • go test ./internal/evaluation/... passes

Note

Medium Risk
Changes core flag condition matching semantics so non-set operators (is, contains, comparisons, regex) can match any element of an array/JSON-array-string, which could change targeting results for existing flags. Also tightens JSON-array-string detection (HasPrefix("[")), which may stop parsing arrays with leading whitespace for set operators.

Overview
Updates matchCondition so non-set operators evaluate array-like properties (slices/arrays or JSON-array-strings) using any-element semantics via new matchStringsNonSet, instead of coercing the whole value to a single string.

Adds a fast HasPrefix("[") guard in coerceStringList to avoid unnecessary JSON parsing now that list coercion runs for all non-null properties, and expands tests with both remote integration cases and an inline flag/condition harness to cover scalar vs multi-value behavior (including negation and whitespace edge cases).

Reviewed by Cursor Bugbot for commit a33ed5e. Bugbot is set up for automated code reviews on this repo. Configure here.

Non-set operators (is, contains, greater, etc.) previously coerced
array/list properties to a single JSON-stringified value, diverging
from analytics/charts behavior where any element of an array can
satisfy the condition.

matchCondition now consults coerceStringList for every non-null value
and dispatches to a new matchStringsNonSet helper when the value coerces
to a list — any-match semantics, including for negation operators
(is not, does not contain), which match if any single element satisfies
the negation.

coerceStringList gains a strings.HasPrefix(s, "[") pre-check so scalar
strings skip JSON parsing now that every value passes through it. User-
visible consequence: JSON-array strings with leading whitespace (e.g.,
" [\"a\"]") are no longer parsed as arrays by set operators.

Tests: inline flag/condition harness drives 14 evaluation-engine unit
cases covering scalar/collection/JSON-array-string shapes against set
and non-set operators; 7 integration tests target new flags on the
superset deployment key.
@kyeh-amp kyeh-amp requested a review from a team April 22, 2026 21:41
@kyeh-amp kyeh-amp merged commit da41c28 into main Apr 28, 2026
7 checks passed
github-actions Bot pushed a commit that referenced this pull request Apr 28, 2026
# [1.11.0](v1.10.1...v1.11.0) (2026-04-28)

### Features

* support multi-value array properties for non-set operators ([#45](#45)) ([da41c28](da41c28))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants