{
  "id": "copy-if-else-and-not",
  "title": "Copy conditionals take the if branch on a non-zero fact, the else branch otherwise, and not inverts the test",
  "covers": ["OAR-COPY-3", "OAR-COPY-7"],
  "rules": [
    {
      "oar": "1.0",
      "namespace": "oar.test",
      "kind": "policy",
      "anchor": "tool.pre_invoke",
      "id": "REASON_BRANCH",
      "effect": "block",
      "requires": {
        "profiles": ["tool"]
      },
      "copy": {
        "what": "{% if arg_validation_reason %}because {{ arg_validation_reason }}{% else %}unspecified{% endif %}",
        "fix": "{% if not arg_validation_field %}no field{% else %}field {{ arg_validation_field }}{% endif %}"
      }
    }
  ],
  "input": {
    "capability": {
      "oar_capability_version": "1.0",
      "host": "oar.testhost",
      "anchors": {
        "core": {
          "tool.pre_invoke": "tool.pre_invoke",
          "tool.handler": "tool.handler",
          "tool.post_invoke": "tool.post_invoke",
          "agent.post_turn": "agent.post_turn",
          "agent.finalize": "agent.finalize",
          "model.input": "model.input",
          "model.output": "model.output",
          "model.tool_result": "model.tool_result"
        },
        "unsupported": []
      },
      "profiles": ["tool"],
      "activity_window": 0,
      "detectors": [],
      "expression_nodes_max": 1024,
      "supports_transform": false
    },
    "anchor": "tool.pre_invoke",
    "facts": {
      "arg_validation_reason": "empty request",
      "arg_validation_field": ""
    }
  },
  "expected": {
    "decision": "block",
    "code": "REASON_BRANCH",
    "copy": {
      "what": "because empty request",
      "fix": "no field"
    }
  }
}
