From 9e02db7cc00ba8aa108d70a7256124e45d1129cc Mon Sep 17 00:00:00 2001 From: Kim Gustyr Date: Fri, 24 Apr 2026 10:31:09 +0100 Subject: [PATCH] feat: Add IN condition bracketed-invalid-JSON CSV fallback test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Covers the case where a segment IN condition's string value starts with "[" and ends with "]" but is not valid JSON — the engine should fall back to splitting on commas rather than erroring out. beep boop --- ...son__falls_back_to_csv__should_match.jsonc | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test_cases/test_in_condition_bracketed_invalid_json__falls_back_to_csv__should_match.jsonc diff --git a/test_cases/test_in_condition_bracketed_invalid_json__falls_back_to_csv__should_match.jsonc b/test_cases/test_in_condition_bracketed_invalid_json__falls_back_to_csv__should_match.jsonc new file mode 100644 index 0000000..f6acfe8 --- /dev/null +++ b/test_cases/test_in_condition_bracketed_invalid_json__falls_back_to_csv__should_match.jsonc @@ -0,0 +1,46 @@ +{ + // Given: An IN condition whose string value starts with "[" and ends with "]" + // but isn't actually valid JSON. + // When: An evaluation context with status = "[foo" (one of the comma-split tokens). + // Then: The engine should fall back to a comma-split and match. + "$schema": "https://raw.githubusercontent.com/Flagsmith/engine-test-data/refs/tags/v2.0.0/schema.json", + "context": { + "environment": { + "key": "key", + "name": "Environment" + }, + "identity": { + "identifier": "csv_fallback_user", + "key": "key_csv_fallback_user", + "traits": { + "status": "[foo" + } + }, + "segments": { + "99": { + "key": "99", + "name": "segment_csv_fallback", + "rules": [ + { + "type": "ALL", + "conditions": [ + { + "operator": "IN", + "property": "status", + "value": "[foo,bar]" + } + ] + } + ] + } + } + }, + "result": { + "flags": {}, + "segments": [ + { + "name": "segment_csv_fallback" + } + ] + } +}