{
  "id": "FLOW-011",
  "name": "Decision rule conditionLogic '(1 OR 2) AND 3' fires recordUpdate when expression is true (#2233 regression lock)",
  "description": "Regression lock for issue #2233 (engine ignored rule-level conditionLogic expression). The flow engine previously folded all conditions in a Decision rule with plain AND, special-casing only the literal strings 'and' and 'or' for the rule's conditionLogic field. Any expression like '(1 OR 2) AND 3' fell into the default branch and was evaluated as 'all conditions AND' — silently no-op'ing rules whose admin-authored logic depended on OR or parens. The fix adds a small recursive-descent parser for conditionLogic (1-indexed condition refs, AND, OR, NOT, parens) wired through both evaluateConditions and evaluateConditionsCtx. This case installs a Decision element on Account AfterSave with conditionLogic='(1 OR 2) AND 3' over three conditions; the test creates an Account satisfying cond 1 + cond 3 but NOT cond 2 (so plain-AND evaluates false but '(1 OR 2) AND 3' evaluates true), and asserts the gated recordUpdate fires (Description == 'logic_matched'). Pre-fix Account.Description stays NULL; post-fix it becomes 'logic_matched'. Tenant-agnostic: standard SObjects (Account), standard fields (Industry, Type, Description), standard Industry picklist values (Banking, Finance) — no __c business names.",
  "object": "Account",
  "method": "POST",
  "endpoint": "/services/data/v63.0/sobjects/Account",
  "setup": [
    {
      "type": "http",
      "name": "Install Flow: Account AfterSave Create → Decision '(1 OR 2) AND 3' → recordUpdate set Description",
      "method": "POST",
      "endpoint": "/services/data/v63.0/tooling/sobjects/Flow",
      "payload": {
        "MasterLabel": "FLOW-011 conditionLogic Expression Honored",
        "ProcessType": "AutoLaunchedFlow",
        "Status": "Draft",
        "Metadata": {
          "apiVersion": "63.0",
          "label": "FLOW-011 conditionLogic Expression Honored",
          "description": "Test-only AfterSave flow that gates a recordUpdate behind a Decision rule whose conditionLogic is '(1 OR 2) AND 3'. Regression lock for #2233. Triggers on Account Create, decision routes 'matched' branch when (Industry=Banking OR Industry=Finance) AND Type=Customer, recordUpdate sets Description='logic_matched' on the trigger record via implicit-Id filter. Teardown deletes this flow version.",
          "status": "Draft",
          "processType": "AutoLaunchedFlow",
          "start": {
            "locationX": 50,
            "locationY": 0,
            "object": "Account",
            "triggerType": "RecordAfterSave",
            "recordTriggerType": "Create",
            "connector": {
              "targetReference": "decision_should_set"
            }
          },
          "decisions": [
            {
              "name": "decision_should_set",
              "label": "Should set Description?",
              "locationX": 176,
              "locationY": 100,
              "rules": [
                {
                  "name": "matched",
                  "label": "Matched",
                  "conditionLogic": "(1 OR 2) AND 3",
                  "conditions": [
                    {
                      "leftValueReference": "$Record.Industry",
                      "operator": "EqualTo",
                      "rightValue": {"stringValue": "Banking"}
                    },
                    {
                      "leftValueReference": "$Record.Industry",
                      "operator": "EqualTo",
                      "rightValue": {"stringValue": "Finance"}
                    },
                    {
                      "leftValueReference": "$Record.Type",
                      "operator": "EqualTo",
                      "rightValue": {"stringValue": "Customer"}
                    }
                  ],
                  "connector": {
                    "targetReference": "set_description"
                  }
                }
              ]
            }
          ],
          "recordUpdates": [
            {
              "name": "set_description",
              "label": "Set Description on trigger Account",
              "locationX": 320,
              "locationY": 200,
              "object": "Account",
              "filterLogic": "and",
              "filters": [
                {
                  "field": "Id",
                  "operator": "EqualTo",
                  "processMetadataValues": [
                    {
                      "name": "implicit",
                      "value": {
                        "booleanValue": true
                      }
                    }
                  ],
                  "value": {
                    "elementReference": "$Record.Id"
                  }
                }
              ],
              "inputAssignments": [
                {
                  "field": "Description",
                  "value": {
                    "stringValue": "logic_matched"
                  }
                }
              ]
            }
          ]
        }
      },
      "expects": {
        "status_code": 201
      },
      "extract": {
        "flow011_version_id": "id"
      }
    },
    {
      "type": "http",
      "name": "Activate the test Flow so it fires on Account AfterSave Create",
      "method": "POST",
      "endpoint": "/services/data/v63.0/tooling/sobjects/Flow/{flow011_version_id}/activate",
      "expects": {
        "status_code": 204
      }
    }
  ],
  "payload": {
    "Name": "FLOW-011-conditionLogic-Account",
    "Industry": "Banking",
    "Type": "Customer"
  },
  "expects": {
    "status_code": 201
  },
  "query_after": {
    "object": "Account",
    "retry": 15,
    "delay_ms": 2000,
    "assertions": [
      {
        "field": "Description",
        "operator": "eq",
        "value": "logic_matched"
      }
    ]
  },
  "teardown": [
    {
      "method": "DELETE",
      "endpoint": "/services/data/v63.0/sobjects/Account/{id}"
    },
    {
      "method": "DELETE",
      "endpoint": "/services/data/v63.0/tooling/sobjects/Flow/{flow011_version_id}"
    }
  ],
  "priority": "P1",
  "bug_ref": "#2233",
  "scene": "flow"
}
