# plan.execute

> Execute a compiled batch of plan-safe operation entries with per-entry transactions, capture resolution between entries, and keep-prefix-and-continue failure semantics.



- Member path: `doc.plan.execute(…)`
- Mutates document: yes
- Idempotency: `non-idempotent`
- Supports tracked mode: no
- Supports dry run: no

## Expected result

Returns a PlanExecuteResult with per-entry receipts, projected captures, and the first hard failure if any.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {},
  "type": "object",
  "properties": {
    "entries": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "operationId": {
            "type": "string"
          },
          "input": {},
          "options": {},
          "captureAs": {
            "type": "string"
          },
          "expect": {
            "type": "object",
            "properties": {
              "success": {
                "type": "boolean"
              },
              "failureCode": {
                "type": "string"
              },
              "failureMessageIncludes": {
                "type": "string"
              },
              "allowFailureMessageIncludes": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false,
        "required": [
          "operationId"
        ]
      }
    },
    "captureReturns": {
      "oneOf": [
        {
          "const": "*"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "entries"
  ]
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {},
  "type": "object",
  "properties": {
    "receipts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "entryIndex": {
            "type": "integer"
          },
          "operationId": {
            "type": "string"
          },
          "status": {
            "enum": [
              "passed",
              "allowed-failure",
              "expected-failure"
            ]
          },
          "captureAs": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "entryIndex",
          "operationId",
          "status",
          "captureAs"
        ]
      }
    },
    "captures": {
      "type": "object"
    },
    "failure": {
      "type": "object",
      "properties": {
        "entryIndex": {
          "type": "integer"
        },
        "operationId": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "entryIndex",
        "operationId",
        "message"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "receipts",
    "captures"
  ]
}
```

## Pre-apply throws

- `INVALID_INPUT`
- `CAPABILITY_UNAVAILABLE`

## Non-applied receipt codes

- None

