{
  "commit": "3ea45b40e593d7729bf2470d3a042ec89c2ded91",
  "recordedAt": "2026-12-05T15:28:11.693142+00:00",
  "fixture": {
    "environment": "Local Docker Compose",
    "data": "Synthetic paginated records",
    "runtimeReplicas": 2,
    "leaseMs": 5000,
    "leaseSweepMs": 2000
  },
  "scenarios": [
    {
      "id": "worker-recovery",
      "title": "Worker crash and recovery",
      "summary": "The original worker was killed while fetching page two. A healthy replica recovered the same job and finished all three pages.",
      "events": [
        {
          "elapsedMs": 0,
          "title": "Job admitted",
          "description": "The gateway forwarded a report job to the runtime. Postgres holds the queued job.",
          "source": "Runtime journal",
          "tone": "info",
          "evidence": {
            "kind": "job_admitted",
            "state": "queued",
            "attempt": 0
          }
        },
        {
          "elapsedMs": 16,
          "title": "First worker claims the job",
          "description": "The first worker begins reading the records under lease 1.",
          "source": "Runtime journal",
          "tone": "info",
          "evidence": {
            "kind": "job_started",
            "state": "running",
            "attempt": 1,
            "worker": "runtime-a-0",
            "lease": 1
          }
        },
        {
          "elapsedMs": 2233,
          "title": "First page checkpointed",
          "description": "The runtime committed two records' worth of progress and the next cursor before starting the second page.",
          "source": "Postgres checkpoint",
          "tone": "success",
          "evidence": {
            "worker": "runtime-a-0",
            "lease": 1,
            "tool": "list",
            "items": 2,
            "limit": 2,
            "pages": 1,
            "cursor": "1",
            "version": 1
          }
        },
        {
          "elapsedMs": 2305,
          "title": "Worker killed in flight",
          "description": "The test harness sent SIGKILL while the cursor 1 request was in flight. The original container stayed down through completion.",
          "source": "Docker and upstream observations",
          "tone": "fault",
          "evidence": {
            "worker": "runtime-a-0",
            "signal": "SIGKILL",
            "cursorsSeen": [
              null,
              "1"
            ],
            "originalContainerRunningAtCompletion": false
          }
        },
        {
          "elapsedMs": 7897,
          "title": "Expired lease returns job to the queue",
          "description": "The runtime's lease sweep requeued the job after the original worker stopped renewing its claim.",
          "source": "Runtime journal",
          "tone": "info",
          "evidence": {
            "kind": "job_queued",
            "state": "queued",
            "attempt": 1,
            "lastObservedLeaseExpiry": "2026-12-05T15:28:18.38519+00:00"
          }
        },
        {
          "elapsedMs": 7911,
          "title": "Surviving worker resumes at cursor 1",
          "description": "The second replica claimed the same job under lease 2. Its stored checkpoint still pointed to page two.",
          "source": "Runtime journal and Postgres",
          "tone": "success",
          "evidence": {
            "kind": "job_started",
            "state": "running",
            "attempt": 2,
            "worker": "runtime-b-0",
            "lease": 2,
            "checkpoint": {
              "tool": "list",
              "items": 2,
              "limit": 2,
              "pages": 1,
              "cursor": "1",
              "version": 1
            }
          }
        },
        {
          "elapsedMs": 12385,
          "title": "Six records recovered",
          "description": "The surviving worker finished all three pages. The two requests for cursor 1 used the same idempotency key.",
          "source": "Runtime journal and upstream observations",
          "tone": "success",
          "evidence": {
            "kind": "job_succeeded",
            "state": "succeeded",
            "attempt": 2,
            "outcome": "list: 6 items across 3 page(s)",
            "upstreamRequests": 4,
            "cursorsSeen": [
              null,
              "1",
              "1",
              "2"
            ],
            "repeatedCursorKeyMatches": true
          }
        }
      ]
    },
    {
      "id": "upstream-retry",
      "title": "Transient upstream failure",
      "summary": "The test upstream returned HTTP 503. Railgate scheduled a retry and the job completed after the test upstream was restored.",
      "events": [
        {
          "elapsedMs": 0,
          "title": "Report job queued",
          "description": "The runtime accepted a new one-page read.",
          "source": "Runtime journal",
          "tone": "info",
          "evidence": {
            "kind": "job_admitted",
            "state": "queued",
            "attempt": 0
          }
        },
        {
          "elapsedMs": 23,
          "title": "HTTP 503 triggers backoff",
          "description": "The worker classified the error as transient. It returned the job to the queue with a future retry time.",
          "source": "Runtime journal and Postgres",
          "tone": "fault",
          "evidence": {
            "kind": "job_queued",
            "state": "queued",
            "attempt": 1,
            "upstreamStatus": 503,
            "scheduledRetryDelayMs": 3000
          }
        },
        {
          "elapsedMs": 97,
          "title": "Test upstream restored",
          "description": "The test harness switched the upstream back to normal while the job was waiting.",
          "source": "Test harness",
          "tone": "info",
          "evidence": {
            "mode": "ok"
          }
        },
        {
          "elapsedMs": 3122,
          "title": "Runtime starts attempt two",
          "description": "A worker claimed the job once the persisted retry time had passed.",
          "source": "Runtime journal",
          "tone": "info",
          "evidence": {
            "kind": "job_started",
            "state": "running",
            "attempt": 2
          }
        },
        {
          "elapsedMs": 3146,
          "title": "Retry succeeds",
          "description": "The second request returned two records and the original job completed.",
          "source": "Runtime journal and upstream observations",
          "tone": "success",
          "evidence": {
            "kind": "job_succeeded",
            "state": "succeeded",
            "attempt": 2,
            "upstreamRequests": 2,
            "outcome": "list: 2 items across 1 page(s)"
          }
        }
      ]
    },
    {
      "id": "approval-gate",
      "title": "Approval before a connector call",
      "summary": "A separate test identity approved a single-page read. The upstream saw zero calls before the decision and one after.",
      "events": [
        {
          "elapsedMs": 0,
          "title": "Action waits for approval",
          "description": "The runtime recorded the request and held the action.",
          "source": "Approval feed",
          "tone": "info",
          "evidence": {
            "kind": "requested"
          }
        },
        {
          "elapsedMs": 8,
          "title": "No upstream call yet",
          "description": "The harness checked the upstream request counter before approving.",
          "source": "Upstream observations",
          "tone": "info",
          "evidence": {
            "upstreamRequests": 0
          }
        },
        {
          "elapsedMs": 14,
          "title": "Separate reviewer approves",
          "description": "A separate test identity allowed the action attached to the approval request.",
          "source": "Approval feed",
          "tone": "info",
          "evidence": {
            "kind": "decided",
            "decision": "allow"
          }
        },
        {
          "elapsedMs": 52,
          "title": "Runtime consumes the approval",
          "description": "The runtime consumed the decision for the action that was approved.",
          "source": "Approval feed",
          "tone": "info",
          "evidence": {
            "kind": "consumed"
          }
        },
        {
          "elapsedMs": 59,
          "title": "Gated read succeeds",
          "description": "The approval feed links the outcome to the consumed action. The upstream received one read.",
          "source": "Approval feed and upstream observations",
          "tone": "success",
          "evidence": {
            "kind": "outcome_succeeded",
            "upstreamRequests": 1,
            "outcome": "list: 2 items across 1 page(s)"
          }
        }
      ]
    }
  ]
}
