{
  "id": "starter-create",
  "name": "Create a disposable Starter instance",
  "risk": "mutating",
  "completionMutation": { "guardId": "starter-create", "recoveryPath": "/tidbs/{{starterClusterId}}/overview" },
  "start": { "path": "/tidbs" },
  "initialization": ["If {{clusterName}} already exists, open it and do not create a duplicate."],
  "goal": [
    "On Create Resource, select For All Users if the plan section shows Only For Partners. Select the Starter plan card and verify Summary says Plan Starter before filling fields. Stay on this form to switch plans; do not navigate back because the initial plan is Premium Reserved.",
    "Create exactly one Starter instance named {{clusterName}} with the default provider and region when it does not exist.",
    "Submit only when Monthly Spending Limit is exactly $0.00, then wait until the instance is Active or Available."
  ],
  "success": {
    "evidence": [
      { "kind": "url", "matches": "/tidbs/[^/]+/overview(?:[/?]|$)", "timeoutMs": 30000 },
      { "kind": "visibleText", "text": "{{clusterName}}", "timeoutMs": 30000 },
      { "kind": "visibleTextOneOf", "texts": ["Active", "Available"], "timeoutMs": 180000 }
    ]
  },
  "recovery": [
    "After submitting Create once, never resubmit. Return to the instance list and locate {{clusterName}} if feedback is uncertain.",
    "If provisioning is progressing, observe it without starting another creation."
  ],
  "limits": { "maxDurationMs": 240000, "maxActions": 26 },
  "safety": {
    "deny": [
      "Do not create a paid instance or use a non-zero spending limit.",
      "Do not create any differently named instance or modify an existing resource."
    ],
    "networkGuards": [
      {
        "id": "starter-cidr-validation-only",
        "method": "POST",
        "pathMatches": "^/api/v1/orgs/[^/]+/projects/[^/]+/cidrs$",
        "bodyEquals": { "validate_only": true },
        "maxRequests": 3
      },
      {
        "id": "starter-create",
        "method": "POST",
        "path": "/api/v2023/serverless/v1beta1/clusters",
        "bodyEquals": {
          "displayName": "{{clusterName}}",
          "servicePlan": "Starter",
          "spendingLimit.monthly": 0
        },
        "maxRequests": 1,
        "deduplicateBy": ["displayName"],
        "captureResponse": {
          "variable": "starterClusterId",
          "paths": ["cluster.id", "cluster.clusterId", "data.id", "clusterId", "id"]
        }
      }
    ]
  }
}
