{
  "schema_version": 1,
  "task": 19,
  "candidate_digest": "412a7dd5aba7da0cc7e839d520b3d91591ae201fa5e1aef0996715a2ab77d7f4",
  "candidate_path_count": 90,
  "matrix_junit": "dualcoach-task-19-junit.xml",
  "matrix_result": {
    "tests": 22,
    "failures": 0,
    "errors": 0,
    "skipped": 0
  },
  "cases": [
    {
      "id": "wrong_actor",
      "invariant": "Only the canonical customer identity may cross the customer transport boundary.",
      "nodes": [
        "tests/gateway/test_nutrition_coaching.py::test_telegram_customer_transport_rejects_wrong_customer_or_noncanonical_destination[user_id-other-user]"
      ],
      "assertions": {
        "durable_state": "No delivery reservation or receipt is created.",
        "visible_response": "The production transport rejects the destination as noncanonical.",
        "provider_calls": 0,
        "delivery_calls": 0,
        "restart": "not applicable; no durable mutation exists to replay"
      }
    },
    {
      "id": "wrong_chat",
      "invariant": "Customer delivery is pinned to the canonical customer DM chat.",
      "nodes": [
        "tests/gateway/test_nutrition_coaching.py::test_telegram_customer_transport_rejects_wrong_customer_or_noncanonical_destination[chat_id-other-chat]"
      ],
      "assertions": {
        "durable_state": "No delivery reservation or receipt is created.",
        "visible_response": "The production transport rejects the destination as noncanonical.",
        "provider_calls": 0,
        "delivery_calls": 0,
        "restart": "not applicable; no durable mutation exists to replay"
      }
    },
    {
      "id": "wrong_topic",
      "invariant": "Customer delivery is pinned to the canonical DM topic selector.",
      "nodes": [
        "tests/gateway/test_nutrition_coaching.py::test_telegram_customer_transport_rejects_wrong_customer_or_noncanonical_destination[topic_id-other-topic]"
      ],
      "assertions": {
        "durable_state": "No delivery reservation or receipt is created.",
        "visible_response": "The production transport rejects the destination as noncanonical.",
        "provider_calls": 0,
        "delivery_calls": 0,
        "restart": "not applicable; no durable mutation exists to replay"
      }
    },
    {
      "id": "stale_revision",
      "invariant": "A stale generation/revision/render binding cannot mutate the current draft.",
      "nodes": [
        "tests/gateway/test_telegram_physique_checkin.py::TestPhysiqueTelegramAdapterIngress::test_n3_callback_acknowledges_before_rejecting_stale_revision_or_render",
        "tests/gateway/test_telegram_physique_checkin.py::TestPhysiqueTelegramAdapterIngress::test_n3_callback_rejects_stale_render_identity_before_business_mutation"
      ],
      "assertions": {
        "durable_state": "Neither stale generation nor stale render identity reaches coordinator/business mutation.",
        "visible_response": "Both callbacks ACK first and replace the clicked card with the stale-card response.",
        "provider_calls": 0,
        "delivery_calls": 0,
        "restart": "Persisted generation and clicked-message render identity are independently revalidated."
      }
    },
    {
      "id": "duplicate_callback",
      "invariant": "A consumed launcher callback cannot apply business mutation twice.",
      "nodes": [
        "tests/gateway/test_telegram_physique_checkin.py::TestPhysiqueCheckinBridge::test_replay_and_expiry_are_rejected_without_mutating_service"
      ],
      "assertions": {
        "durable_state": "The durable wizard answer list remains empty after replay.",
        "visible_response": "The replay response is handled but rejected.",
        "provider_calls": 0,
        "delivery_calls": 0,
        "restart": "Consumed callback authority is durable and replay-safe"
      }
    },
    {
      "id": "callback_expiry",
      "invariant": "An expired callback cannot start or mutate a wizard session.",
      "nodes": [
        "tests/gateway/test_telegram_physique_checkin.py::TestPhysiqueCheckinBridge::test_replay_and_expiry_are_rejected_without_mutating_service"
      ],
      "assertions": {
        "durable_state": "No answer or completion mutation is persisted.",
        "visible_response": "The expired callback is rejected at the exact expiry boundary.",
        "provider_calls": 0,
        "delivery_calls": 0,
        "restart": "Expiry is evaluated from durable callback binding and injected clock"
      }
    },
    {
      "id": "provider_auth_failure",
      "invariant": "Authentication failure is retryable on the same request/job without deleting receipts or creating delivery.",
      "nodes": [
        "tests/gateway/test_nutrition_coaching.py::test_generation_worker_auth_failure_is_retryable_without_receipt_deletion"
      ],
      "assertions": {
        "durable_state": "History is pending -> generation_failed, then the same idempotency key/check-in revision resumes at attempt 2.",
        "visible_response": "The operator card reports generation_failed/provider_authentication before successful retry.",
        "provider_calls": 1,
        "delivery_calls": 0,
        "restart": "Stable request identity and retryable failure survive worker reconstruction"
      }
    },
    {
      "id": "invalid_model_output",
      "invariant": "Invalid model output never becomes a draft and correction is bounded to one retry.",
      "nodes": [
        "tests/gateway/test_nutrition_coaching.py::test_generation_worker_invalid_output_creates_no_draft"
      ],
      "assertions": {
        "durable_state": "No draft file exists; generation is terminal generation_failed/nonretryable.",
        "visible_response": "Worker action returns invalid_model_output for card projection.",
        "provider_calls": 2,
        "delivery_calls": 0,
        "restart": "Terminal nonretryable state prevents restart generation"
      }
    },
    {
      "id": "generation_worker_crash",
      "invariant": "A crashed worker cannot lose work, steal a live lease, or overwrite a reclaimed claim.",
      "nodes": [
        "tests/gateway/test_nutrition_coaching.py::test_generation_worker_restart_reclaims_only_an_expired_lease",
        "tests/gateway/test_nutrition_coaching.py::test_generation_worker_stale_provider_return_cannot_persist_over_reclaimed_claim"
      ],
      "assertions": {
        "durable_state": "Live lease is preserved; expiry permits attempt 2; the stale provider return cannot persist over the reclaimed claim; only fresh attempt 2 creates the draft.",
        "visible_response": "Recovery rejects early/stale claims and returns only the fresh worker result.",
        "provider_calls": 2,
        "delivery_calls": 0,
        "restart": "Fresh coordinators cover lease expiry, while Event-controlled workers prove the real stale-provider CAS race."
      }
    },
    {
      "id": "gateway_restart_every_waiting_state",
      "invariant": "Every nonterminal bootstrap phase survives restart and routes exactly one authoritative recovery card path.",
      "nodes": [
        "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[PREPARED]",
        "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[WAITING_ADMIN]",
        "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[PROVISIONING]",
        "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[CLAIMING]",
        "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[ROLE_REVIEW]",
        "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[REGISTERING]",
        "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[AWAITING_CONSENT]",
        "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[AWAITING_ACTIVATION]",
        "tests/gateway/test_telegram_room_bootstrap_transport.py::test_startup_recovery_routes_every_durable_waiting_state"
      ],
      "assertions": {
        "durable_state": "PREPARED, WAITING_ADMIN, PROVISIONING, CLAIMING, ROLE_REVIEW, REGISTERING, AWAITING_CONSENT, and AWAITING_ACTIVATION are recovered byte-equivalently.",
        "visible_response": "Membership recovery is routed for the first six waiting states and runtime card recovery for AWAITING_ACTIVATION.",
        "provider_calls": 0,
        "delivery_calls": 0,
        "restart": "Eight persisted nonterminal phases are reopened; seven waiting routes are dispatched without polling"
      }
    },
    {
      "id": "provider_success_before_receipt_persistence",
      "invariant": "Provider acceptance with a local receipt crash enters unknown outcome and is never blindly resent.",
      "nodes": [
        "tests/gateway/test_task7_generation_hardening.py::test_delivery_restart_after_transport_before_receipt_does_not_resend"
      ],
      "assertions": {
        "durable_state": "Outbox remains unknown_provider_outcome with exact destination/revision/payload pins until positive reconciliation reaches sent_audited.",
        "visible_response": "Replay edits the operator card to the unknown-outcome state.",
        "provider_calls": 1,
        "delivery_calls": 1,
        "restart": "A fresh coordinator reopens DELIVERY_PENDING and refuses transport until exact positive evidence"
      }
    },
    {
      "id": "duplicate_explicit_send",
      "invariant": "Repeated explicit send callbacks cannot dispatch twice while provider outcome is unresolved.",
      "nodes": [
        "tests/gateway/test_nutrition_coaching.py::test_delivery_outbox_provider_timeout_callback_never_resends",
        "tests/gateway/test_nutrition_coaching.py::test_approval_receipt_is_immutable_duplicate_idempotent_and_zero_delivery"
      ],
      "assertions": {
        "durable_state": "Duplicate approval creates one immutable approval receipt and no outbox; repeated explicit send leaves one unknown_provider_outcome row with transport disabled.",
        "visible_response": "Approval remains approved without send; explicit-send timeout reports unknown outcome and duplicate callback does not resend.",
        "provider_calls": 1,
        "delivery_calls": 1,
        "restart": "A reconstructed coordinator preserves the no-resend decision."
      }
    }
  ],
  "exact_nodes": [
    "tests/gateway/test_nutrition_coaching.py::test_telegram_customer_transport_rejects_wrong_customer_or_noncanonical_destination[user_id-other-user]",
    "tests/gateway/test_nutrition_coaching.py::test_telegram_customer_transport_rejects_wrong_customer_or_noncanonical_destination[chat_id-other-chat]",
    "tests/gateway/test_nutrition_coaching.py::test_telegram_customer_transport_rejects_wrong_customer_or_noncanonical_destination[topic_id-other-topic]",
    "tests/gateway/test_telegram_physique_checkin.py::TestPhysiqueTelegramAdapterIngress::test_n3_callback_acknowledges_before_rejecting_stale_revision_or_render",
    "tests/gateway/test_telegram_physique_checkin.py::TestPhysiqueTelegramAdapterIngress::test_n3_callback_rejects_stale_render_identity_before_business_mutation",
    "tests/gateway/test_telegram_physique_checkin.py::TestPhysiqueCheckinBridge::test_replay_and_expiry_are_rejected_without_mutating_service",
    "tests/gateway/test_nutrition_coaching.py::test_generation_worker_auth_failure_is_retryable_without_receipt_deletion",
    "tests/gateway/test_nutrition_coaching.py::test_generation_worker_invalid_output_creates_no_draft",
    "tests/gateway/test_nutrition_coaching.py::test_generation_worker_restart_reclaims_only_an_expired_lease",
    "tests/gateway/test_nutrition_coaching.py::test_generation_worker_stale_provider_return_cannot_persist_over_reclaimed_claim",
    "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[PREPARED]",
    "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[WAITING_ADMIN]",
    "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[PROVISIONING]",
    "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[CLAIMING]",
    "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[ROLE_REVIEW]",
    "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[REGISTERING]",
    "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[AWAITING_CONSENT]",
    "tests/gateway/test_telegram_room_bootstrap_adversarial.py::test_restart_preserves_every_nonterminal_phase[AWAITING_ACTIVATION]",
    "tests/gateway/test_telegram_room_bootstrap_transport.py::test_startup_recovery_routes_every_durable_waiting_state",
    "tests/gateway/test_task7_generation_hardening.py::test_delivery_restart_after_transport_before_receipt_does_not_resend",
    "tests/gateway/test_nutrition_coaching.py::test_delivery_outbox_provider_timeout_callback_never_resends",
    "tests/gateway/test_nutrition_coaching.py::test_approval_receipt_is_immutable_duplicate_idempotent_and_zero_delivery"
  ]
}
