{
  "id": "starter-data-service",
  "name": "Create a disposable Starter Data App",
  "risk": "mutating",
  "completionMutation": {
    "guardId": "starter-data-app-create",
    "recoveryPath": "/project/data-service?orgId={{starterOrgId}}&projectId={{starterProjectId}}"
  },
  "start": { "path": "/project/data-service?orgId={{starterOrgId}}&projectId={{starterProjectId}}" },
  "goal": [
    "Open Data Service, use the search field to check for the exact name {{dataAppName}}, and ignore every differently named Data App.",
    "When that exact name is absent, create one Standard Data App named {{dataAppName}} linked only to {{clusterName}}.",
    "Wait until the new Data App is visible, then finish without creating or deploying an endpoint."
  ],
  "success": {
    "evidence": [
      { "kind": "url", "matches": "/project/data-service(?:[/?]|$)" },
      { "kind": "visibleText", "text": "{{dataAppName}}" },
      { "kind": "absentText", "matches": "Unexpected Error|Internal Error|Request failed" }
    ]
  },
  "recovery": [
    "If creation or loading is slow, wait for the accepted request to finish; never create a second Data App or endpoint.",
    "If the exact Data App {{dataAppName}} appears after an uncertain response, treat creation as complete and never create a second one.",
    "A differently named test Data App is unrelated; never open it or treat it as success."
  ],
  "limits": { "maxDurationMs": 180000, "maxActions": 18 },
  "safety": {
    "deny": [
      "Do not modify, delete, or open any Data App whose name is not exactly {{dataAppName}}.",
      "Do not link any cluster other than {{clusterName}} or create or deploy an endpoint.",
      "Never select Create New Cluster. If {{clusterName}} is missing from Link Data Sources, report the missing source instead of creating anything else."
    ],
    "networkGuards": [
      {
        "id": "starter-data-app-create",
        "method": "POST",
        "pathMatches": "^/api/v1/dataservices/central/orgs/[^/]+/projects/[^/]+/apps$",
        "bodyEquals": { "app_name": "{{dataAppName}}", "app_type": "dataapi" },
        "bodyMatches": { "cluster_ids.0": "^{{starterClusterId}}$" },
        "maxRequests": 1,
        "deduplicateBy": ["app_name"],
        "required": true,
        "captureResponse": {
          "variable": "starterDataAppId",
          "paths": ["data.app_info.id"]
        }
      }
    ]
  }
}
