{
  "schemaVersion": 1,
  "id": "framework-selection",
  "function": "choose_orchestration",
  "starter": "def choose_orchestration(payload):\n    raise NotImplementedError(\"Implement the documented contract yourself\")\n",
  "checks": [
    {
      "id": "approval-wait",
      "input": {
        "required": [
          "durable",
          "human_wait"
        ],
        "language": "java",
        "candidates": [
          {
            "id": "existing-loop",
            "capabilities": [],
            "ops_cost": 0,
            "language": "java"
          },
          {
            "id": "java-workflow",
            "capabilities": [
              "durable",
              "human_wait"
            ],
            "ops_cost": 3,
            "language": "java"
          },
          {
            "id": "python-graph",
            "capabilities": [
              "durable",
              "human_wait",
              "branches"
            ],
            "ops_cost": 1,
            "language": "python"
          }
        ]
      },
      "expected": {
        "choice": "java-workflow",
        "rejected": [
          {
            "id": "existing-loop",
            "missing": [
              "durable",
              "human_wait"
            ]
          },
          {
            "id": "python-graph",
            "missing": [
              "language:java"
            ]
          }
        ]
      },
      "error": null
    },
    {
      "id": "simple-read",
      "input": {
        "required": [],
        "language": "java",
        "candidates": [
          {
            "id": "existing-loop",
            "capabilities": [],
            "ops_cost": 0,
            "language": "java"
          },
          {
            "id": "java-workflow",
            "capabilities": [
              "durable",
              "human_wait"
            ],
            "ops_cost": 3,
            "language": "java"
          },
          {
            "id": "python-graph",
            "capabilities": [
              "durable",
              "human_wait",
              "branches"
            ],
            "ops_cost": 1,
            "language": "python"
          }
        ]
      },
      "expected": {
        "choice": "existing-loop",
        "rejected": [
          {
            "id": "python-graph",
            "missing": [
              "language:java"
            ]
          }
        ]
      },
      "error": null
    },
    {
      "id": "existing-capable",
      "input": {
        "required": [
          "durable",
          "human_wait"
        ],
        "language": "java",
        "candidates": [
          {
            "id": "existing-java",
            "capabilities": [
              "durable",
              "human_wait"
            ],
            "ops_cost": 0,
            "language": "java"
          },
          {
            "id": "new-java",
            "capabilities": [
              "durable",
              "human_wait"
            ],
            "ops_cost": 3,
            "language": "java"
          }
        ]
      },
      "expected": {
        "choice": "existing-java",
        "rejected": []
      },
      "error": null
    },
    {
      "id": "no-fit",
      "input": {
        "required": [
          "migration"
        ],
        "language": "java",
        "candidates": [
          {
            "id": "existing-loop",
            "capabilities": [],
            "ops_cost": 0,
            "language": "java"
          },
          {
            "id": "java-workflow",
            "capabilities": [
              "durable",
              "human_wait"
            ],
            "ops_cost": 3,
            "language": "java"
          },
          {
            "id": "python-graph",
            "capabilities": [
              "durable",
              "human_wait",
              "branches"
            ],
            "ops_cost": 1,
            "language": "python"
          }
        ]
      },
      "expected": {
        "choice": null,
        "rejected": [
          {
            "id": "existing-loop",
            "missing": [
              "migration"
            ]
          },
          {
            "id": "java-workflow",
            "missing": [
              "migration"
            ]
          },
          {
            "id": "python-graph",
            "missing": [
              "language:java",
              "migration"
            ]
          }
        ]
      },
      "error": null
    },
    {
      "id": "cost-tie",
      "input": {
        "required": [],
        "language": "java",
        "candidates": [
          {
            "id": "z",
            "capabilities": [],
            "ops_cost": 2,
            "language": "java"
          },
          {
            "id": "a",
            "capabilities": [],
            "ops_cost": 2,
            "language": "java"
          }
        ]
      },
      "expected": {
        "choice": "a",
        "rejected": []
      },
      "error": null
    },
    {
      "id": "empty-candidates",
      "input": {
        "required": [
          "durable",
          "human_wait"
        ],
        "language": "java",
        "candidates": []
      },
      "expected": {
        "choice": null,
        "rejected": []
      },
      "error": null
    },
    {
      "id": "language-only",
      "input": {
        "required": [],
        "language": "python",
        "candidates": [
          {
            "id": "existing-loop",
            "capabilities": [],
            "ops_cost": 0,
            "language": "java"
          },
          {
            "id": "java-workflow",
            "capabilities": [
              "durable",
              "human_wait"
            ],
            "ops_cost": 3,
            "language": "java"
          },
          {
            "id": "python-graph",
            "capabilities": [
              "durable",
              "human_wait",
              "branches"
            ],
            "ops_cost": 1,
            "language": "python"
          }
        ]
      },
      "expected": {
        "choice": "python-graph",
        "rejected": [
          {
            "id": "existing-loop",
            "missing": [
              "language:python"
            ]
          },
          {
            "id": "java-workflow",
            "missing": [
              "language:python"
            ]
          }
        ]
      },
      "error": null
    },
    {
      "id": "migration-supported",
      "input": {
        "required": [
          "migration"
        ],
        "language": "java",
        "candidates": [
          {
            "id": "m",
            "capabilities": [
              "migration"
            ],
            "ops_cost": 1,
            "language": "java"
          }
        ]
      },
      "expected": {
        "choice": "m",
        "rejected": []
      },
      "error": null
    },
    {
      "id": "bool-cost",
      "input": {
        "required": [
          "durable",
          "human_wait"
        ],
        "language": "java",
        "candidates": [
          {
            "id": "bad",
            "capabilities": [],
            "ops_cost": true,
            "language": "java"
          }
        ]
      },
      "expected": null,
      "error": "ValueError:input"
    },
    {
      "id": "duplicate-id",
      "input": {
        "required": [
          "durable",
          "human_wait"
        ],
        "language": "java",
        "candidates": [
          {
            "id": "same",
            "capabilities": [],
            "ops_cost": 1,
            "language": "java"
          },
          {
            "id": "same",
            "capabilities": [],
            "ops_cost": 2,
            "language": "java"
          }
        ]
      },
      "expected": null,
      "error": "ValueError:input"
    }
  ]
}
