{
  "schema_version": 1,
  "generated_at": "2026-09-05T07:57:49.711545+00:00",
  "commit": "b6ee94d3cd0067e6dd3b37c2f96a9ba2e4548a6d",
  "run_url": "https://github.com/jhonwictordev/stockflow-api/actions/runs/33953934420",
  "scenario": "Duas compras disputando a última unidade",
  "data_kind": "synthetic",
  "transport": "HTTPX ASGITransport → FastAPI → SQLAlchemy async → PostgreSQL",
  "postgres_version": "16.15",
  "isolation": "read committed",
  "blocked_connections": 2,
  "initial_stock": 1,
  "final_stock": 0,
  "persisted_sales": 1,
  "persisted_items": 1,
  "sale_stock_movements": 1,
  "responses": [
    {
      "request_id": "demo-purchase-a",
      "status_code": 422
    },
    {
      "request_id": "demo-purchase-b",
      "status_code": 201
    }
  ],
  "spans": [
    {
      "name": "POST /api/v1/sales",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "9edb7888103e7868",
      "parent_span_id": null,
      "start_ms": 0.0,
      "duration_ms": 121.305,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a",
        "http.request.method": "POST",
        "http.route": "/api/v1/sales",
        "http.response.status_code": 422
      }
    },
    {
      "name": "POST /api/v1/sales",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "16d55ec7e61d2667",
      "parent_span_id": null,
      "start_ms": 0.605,
      "duration_ms": 121.816,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b",
        "http.request.method": "POST",
        "http.route": "/api/v1/sales",
        "http.response.status_code": 201
      }
    },
    {
      "name": "auth.authenticate",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "443665319ce20732",
      "parent_span_id": "9edb7888103e7868",
      "start_ms": 3.0,
      "duration_ms": 81.736,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a",
        "auth.result": "authenticated"
      }
    },
    {
      "name": "auth.jwt.decode",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "794adfbc52806929",
      "parent_span_id": "443665319ce20732",
      "start_ms": 3.035,
      "duration_ms": 0.09,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a"
      }
    },
    {
      "name": "auth.user.query",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "cbbeeb9c827efa7f",
      "parent_span_id": "443665319ce20732",
      "start_ms": 3.168,
      "duration_ms": 81.539,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a",
        "db.operation.name": "SELECT",
        "db.collection.name": "users"
      }
    },
    {
      "name": "auth.authenticate",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "8324b1f537d77788",
      "parent_span_id": "16d55ec7e61d2667",
      "start_ms": 4.697,
      "duration_ms": 77.635,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b",
        "auth.result": "authenticated"
      }
    },
    {
      "name": "auth.jwt.decode",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "e916c30a2374bd03",
      "parent_span_id": "8324b1f537d77788",
      "start_ms": 4.737,
      "duration_ms": 0.081,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b"
      }
    },
    {
      "name": "auth.user.query",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "0df8e5041334601c",
      "parent_span_id": "8324b1f537d77788",
      "start_ms": 4.858,
      "duration_ms": 77.432,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b",
        "db.operation.name": "SELECT",
        "db.collection.name": "users"
      }
    },
    {
      "name": "auth.rbac",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "f3c6d91feb9a0f3c",
      "parent_span_id": "16d55ec7e61d2667",
      "start_ms": 82.453,
      "duration_ms": 0.021,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b",
        "rbac.allowed_roles": "admin,manager,owner,salesperson",
        "rbac.decision": "allow"
      }
    },
    {
      "name": "sales.transaction",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "811dd7f31d03d1be",
      "parent_span_id": "16d55ec7e61d2667",
      "start_ms": 82.57,
      "duration_ms": 32.516,
      "status": "OK",
      "attributes": {
        "request.id": "demo-purchase-b",
        "stockflow.sale.item_count": 1,
        "transaction.outcome": "committed"
      }
    },
    {
      "name": "sales.products.query",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "57ddeb4047839262",
      "parent_span_id": "811dd7f31d03d1be",
      "start_ms": 82.602,
      "duration_ms": 20.712,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b",
        "db.operation.name": "SELECT",
        "db.collection.name": "products",
        "db.response.returned_rows": 1
      }
    },
    {
      "name": "sales.stock.lock",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "59662de90349389b",
      "parent_span_id": "57ddeb4047839262",
      "start_ms": 82.843,
      "duration_ms": 20.438,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b",
        "db.operation.name": "SELECT FOR UPDATE",
        "db.lock.mode": "pessimistic_write",
        "stockflow.sale.item_count": 1
      }
    },
    {
      "name": "auth.rbac",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "64bf0451c24ad506",
      "parent_span_id": "9edb7888103e7868",
      "start_ms": 84.85,
      "duration_ms": 0.043,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a",
        "rbac.allowed_roles": "admin,manager,owner,salesperson",
        "rbac.decision": "allow"
      }
    },
    {
      "name": "sales.transaction",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "43db78103c83c12b",
      "parent_span_id": "9edb7888103e7868",
      "start_ms": 84.993,
      "duration_ms": 35.789,
      "status": "ERROR",
      "attributes": {
        "request.id": "demo-purchase-a",
        "stockflow.sale.item_count": 1,
        "error.type": "insufficient_stock"
      }
    },
    {
      "name": "sales.products.query",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "73847f48bdf310e2",
      "parent_span_id": "43db78103c83c12b",
      "start_ms": 85.036,
      "duration_ms": 31.281,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a",
        "db.operation.name": "SELECT",
        "db.collection.name": "products",
        "db.response.returned_rows": 1
      }
    },
    {
      "name": "sales.stock.lock",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "8ee745194077c4bb",
      "parent_span_id": "73847f48bdf310e2",
      "start_ms": 85.294,
      "duration_ms": 30.989,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a",
        "db.operation.name": "SELECT FOR UPDATE",
        "db.lock.mode": "pessimistic_write",
        "stockflow.sale.item_count": 1
      }
    },
    {
      "name": "sales.persist",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "272edfd8e1664c0b",
      "parent_span_id": "811dd7f31d03d1be",
      "start_ms": 103.361,
      "duration_ms": 3.698,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b"
      }
    },
    {
      "name": "sales.transaction.commit",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "a97a58782a346a3d",
      "parent_span_id": "811dd7f31d03d1be",
      "start_ms": 107.11,
      "duration_ms": 7.937,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b",
        "db.operation.name": "COMMIT"
      }
    },
    {
      "name": "sales.detail.query",
      "trace_id": "80b44cdc2a880f14144f387abee40686",
      "span_id": "54c59d51acebe80a",
      "parent_span_id": "16d55ec7e61d2667",
      "start_ms": 115.137,
      "duration_ms": 7.065,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-b",
        "db.operation.name": "SELECT",
        "db.collection.name": "sales"
      }
    },
    {
      "name": "sales.persist",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "ccb80de40805ef61",
      "parent_span_id": "43db78103c83c12b",
      "start_ms": 116.363,
      "duration_ms": 2.838,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a"
      }
    },
    {
      "name": "sales.transaction.rollback",
      "trace_id": "8175668bd910fd4b8eff87b7ef6961f8",
      "span_id": "9afc333d952f04f9",
      "parent_span_id": "43db78103c83c12b",
      "start_ms": 119.283,
      "duration_ms": 1.468,
      "status": "UNSET",
      "attributes": {
        "request.id": "demo-purchase-a",
        "db.operation.name": "ROLLBACK"
      }
    }
  ]
}
