{
  "variant": "baseline",
  "runtime": {
    "python": "3.14.7 (main, Aug  5 2026, 10:29:49) [Clang 21.0.0 (clang-2100.1.1.101)]",
    "implementation": "CPython",
    "sqlite": "3.53.4",
    "__debug__": true
  },
  "database": "state.sqlite",
  "setup_connection_settings": {
    "isolation_level": null,
    "autocommit": -1,
    "autocommit_label": "LEGACY_TRANSACTION_CONTROL",
    "journal_mode": "delete",
    "synchronous": 2,
    "in_transaction": false,
    "sqlite_version": "3.53.4"
  },
  "handler_connection_settings": [
    {
      "phase": "first-withheld",
      "settings": {
        "isolation_level": null,
        "autocommit": -1,
        "autocommit_label": "LEGACY_TRANSACTION_CONTROL",
        "journal_mode": "delete",
        "synchronous": 2,
        "in_transaction": false,
        "sqlite_version": "3.53.4"
      }
    },
    {
      "phase": "retry",
      "settings": {
        "isolation_level": null,
        "autocommit": -1,
        "autocommit_label": "LEGACY_TRANSACTION_CONTROL",
        "journal_mode": "delete",
        "synchronous": 2,
        "in_transaction": false,
        "sqlite_version": "3.53.4"
      }
    },
    {
      "phase": "conflict",
      "settings": {
        "isolation_level": null,
        "autocommit": -1,
        "autocommit_label": "LEGACY_TRANSACTION_CONTROL",
        "journal_mode": "delete",
        "synchronous": 2,
        "in_transaction": false,
        "sqlite_version": "3.53.4"
      }
    },
    {
      "phase": "new-key",
      "settings": {
        "isolation_level": null,
        "autocommit": -1,
        "autocommit_label": "LEGACY_TRANSACTION_CONTROL",
        "journal_mode": "delete",
        "synchronous": 2,
        "in_transaction": false,
        "sqlite_version": "3.53.4"
      }
    }
  ],
  "function_identities": [
    {
      "name": "baseline_reserve",
      "qualname": "baseline_reserve",
      "source_file": "reservation.py",
      "source_file_sha256": "8b8a68f509af1aa915cdabcc4005935428dd875233b93904e1f5f2df818406ed",
      "first_line": 60,
      "function_source_sha256": "b44032512d9fca6da88f1efd78340bf3afcc8107a84aab007c1231427c96aa2b"
    },
    {
      "name": "call_adapter",
      "qualname": "call_adapter",
      "source_file": "reservation.py",
      "source_file_sha256": "8b8a68f509af1aa915cdabcc4005935428dd875233b93904e1f5f2df818406ed",
      "first_line": 66,
      "function_source_sha256": "f12c418d7bcbcc73d7c8a0d72409caf969deeb75d43c67aca0f36375d6ba8c5a"
    },
    {
      "name": "_reserve",
      "qualname": "_reserve",
      "source_file": "reservation.py",
      "source_file_sha256": "8b8a68f509af1aa915cdabcc4005935428dd875233b93904e1f5f2df818406ed",
      "first_line": 34,
      "function_source_sha256": "47a40445def7cbb892837091eb1d76079df1077fe4a144faf15b627e0f5a8170"
    },
    {
      "name": "connect",
      "qualname": "connect",
      "source_file": "reservation.py",
      "source_file_sha256": "8b8a68f509af1aa915cdabcc4005935428dd875233b93904e1f5f2df818406ed",
      "first_line": 7,
      "function_source_sha256": "5f431a068fc9a2dec6408e9e2c2d3c1bbb043fdb48e0fc4e57895266a8641015"
    }
  ],
  "attempts": [
    {
      "input": {
        "phase": "first-withheld",
        "key": "key-A",
        "payload": {
          "sku": "part-A",
          "quantity": 1
        },
        "now_hours": 0,
        "withhold": true
      },
      "handler_return_observations": [
        {
          "kind": "reserved",
          "reservation_id": 2
        }
      ],
      "caller": {
        "received": false,
        "response": null,
        "exception_type": "ResponseLost"
      },
      "exception_message": "test adapter withheld the completed handler result"
    },
    {
      "input": {
        "phase": "retry",
        "key": "key-A",
        "payload": {
          "sku": "part-A",
          "quantity": 1
        },
        "now_hours": 1,
        "withhold": false
      },
      "handler_return_observations": [
        {
          "kind": "reserved",
          "reservation_id": 2
        }
      ],
      "caller": {
        "received": true,
        "response": {
          "kind": "reserved",
          "reservation_id": 2
        },
        "exception_type": null
      },
      "exception_message": null
    },
    {
      "input": {
        "phase": "conflict",
        "key": "key-A",
        "payload": {
          "sku": "part-A",
          "quantity": 2
        },
        "now_hours": 2,
        "withhold": false
      },
      "handler_return_observations": [
        {
          "kind": "conflict",
          "code": "KEY_PAYLOAD_MISMATCH",
          "reservation_id": null
        }
      ],
      "caller": {
        "received": true,
        "response": {
          "kind": "conflict",
          "code": "KEY_PAYLOAD_MISMATCH",
          "reservation_id": null
        },
        "exception_type": null
      },
      "exception_message": null
    },
    {
      "input": {
        "phase": "new-key",
        "key": "key-B",
        "payload": {
          "sku": "part-A",
          "quantity": 1
        },
        "now_hours": 2,
        "withhold": false
      },
      "handler_return_observations": [
        {
          "kind": "reserved",
          "reservation_id": 4
        }
      ],
      "caller": {
        "received": true,
        "response": {
          "kind": "reserved",
          "reservation_id": 4
        },
        "exception_type": null
      },
      "exception_message": null
    }
  ],
  "state_observations": [
    {
      "phase": "setup",
      "state": {
        "reservations": [
          [
            1,
            "seed-key",
            "seed",
            1
          ]
        ],
        "ledger": [
          [
            "seed-key",
            "{\"quantity\":1,\"sku\":\"seed\"}",
            1,
            0
          ]
        ]
      }
    },
    {
      "phase": "first-withheld",
      "state": {
        "reservations": [
          [
            1,
            "seed-key",
            "seed",
            1
          ],
          [
            2,
            "key-A",
            "part-A",
            1
          ]
        ],
        "ledger": [
          [
            "key-A",
            "{\"quantity\":1,\"sku\":\"part-A\"}",
            2,
            0
          ],
          [
            "seed-key",
            "{\"quantity\":1,\"sku\":\"seed\"}",
            1,
            0
          ]
        ]
      }
    },
    {
      "phase": "retry",
      "state": {
        "reservations": [
          [
            1,
            "seed-key",
            "seed",
            1
          ],
          [
            2,
            "key-A",
            "part-A",
            1
          ],
          [
            3,
            "key-A",
            "part-A",
            1
          ]
        ],
        "ledger": [
          [
            "key-A",
            "{\"quantity\":1,\"sku\":\"part-A\"}",
            2,
            0
          ],
          [
            "seed-key",
            "{\"quantity\":1,\"sku\":\"seed\"}",
            1,
            0
          ]
        ]
      }
    },
    {
      "phase": "conflict",
      "state": {
        "reservations": [
          [
            1,
            "seed-key",
            "seed",
            1
          ],
          [
            2,
            "key-A",
            "part-A",
            1
          ],
          [
            3,
            "key-A",
            "part-A",
            1
          ]
        ],
        "ledger": [
          [
            "key-A",
            "{\"quantity\":1,\"sku\":\"part-A\"}",
            2,
            0
          ],
          [
            "seed-key",
            "{\"quantity\":1,\"sku\":\"seed\"}",
            1,
            0
          ]
        ]
      }
    },
    {
      "phase": "new-key",
      "state": {
        "reservations": [
          [
            1,
            "seed-key",
            "seed",
            1
          ],
          [
            2,
            "key-A",
            "part-A",
            1
          ],
          [
            3,
            "key-A",
            "part-A",
            1
          ],
          [
            4,
            "key-B",
            "part-A",
            1
          ]
        ],
        "ledger": [
          [
            "key-A",
            "{\"quantity\":1,\"sku\":\"part-A\"}",
            2,
            0
          ],
          [
            "key-B",
            "{\"quantity\":1,\"sku\":\"part-A\"}",
            4,
            2
          ],
          [
            "seed-key",
            "{\"quantity\":1,\"sku\":\"seed\"}",
            1,
            0
          ]
        ]
      }
    }
  ],
  "call_counts": {
    "baseline_reserve": 4,
    "call_adapter": 4,
    "_reserve": 4,
    "connect": 4
  },
  "sql_trace": [
    {
      "phase": "first-withheld",
      "statement": "SELECT payload_json,reservation_id FROM ledger WHERE reservation_key='key-A'"
    },
    {
      "phase": "first-withheld",
      "statement": "BEGIN IMMEDIATE"
    },
    {
      "phase": "first-withheld",
      "statement": "INSERT INTO reservations (reservation_key,sku,quantity) VALUES ('key-A','part-A',1)"
    },
    {
      "phase": "first-withheld",
      "statement": "INSERT INTO ledger VALUES ('key-A','{\"quantity\":1,\"sku\":\"part-A\"}',2,0)"
    },
    {
      "phase": "first-withheld",
      "statement": "COMMIT"
    },
    {
      "phase": "retry",
      "statement": "SELECT payload_json,reservation_id FROM ledger WHERE reservation_key='key-A'"
    },
    {
      "phase": "retry",
      "statement": "BEGIN IMMEDIATE"
    },
    {
      "phase": "retry",
      "statement": "INSERT INTO reservations (reservation_key,sku,quantity) VALUES ('key-A','part-A',1)"
    },
    {
      "phase": "retry",
      "statement": "COMMIT"
    },
    {
      "phase": "conflict",
      "statement": "SELECT payload_json,reservation_id FROM ledger WHERE reservation_key='key-A'"
    },
    {
      "phase": "new-key",
      "statement": "SELECT payload_json,reservation_id FROM ledger WHERE reservation_key='key-B'"
    },
    {
      "phase": "new-key",
      "statement": "BEGIN IMMEDIATE"
    },
    {
      "phase": "new-key",
      "statement": "INSERT INTO reservations (reservation_key,sku,quantity) VALUES ('key-B','part-A',1)"
    },
    {
      "phase": "new-key",
      "statement": "INSERT INTO ledger VALUES ('key-B','{\"quantity\":1,\"sku\":\"part-A\"}',4,2)"
    },
    {
      "phase": "new-key",
      "statement": "COMMIT"
    }
  ],
  "trace_note": "Actual profile call/return events; exception-unwind return=None distinguished from received normal responses. No coverage/all-branch claim."
}
