{
  "schema": "DAT003_LAB_MODEL_CONTRACT_v1",
  "lesson_id": "DAT-003",
  "lab_id": "DAT003-LAB1",
  "starter_must_not_pre_solve_skill": true,
  "business_question": "Protect a bounded inventory/reservation invariant while two independent PostgreSQL sessions read and write concurrently.",
  "protected_invariant": "active reservations must not exceed capacity in the bounded fixture",
  "required_levels": [
    "READ COMMITTED",
    "REPEATABLE READ",
    "SERIALIZABLE"
  ],
  "required_behaviors": [
    "Read Committed two-SELECT visibility probe",
    "Repeatable Read stable-snapshot probe",
    "Serializable conflict with failed outcome retained and whole-transaction retry",
    "READ UNCOMMITTED behavioral comparison to Read Committed"
  ],
  "forbidden_shortcuts": [
    "claim Serializable removes retry",
    "generalize PostgreSQL Repeatable Read to every DBMS",
    "claim Read Committed is one transaction-wide snapshot in PostgreSQL",
    "fabricate SQLSTATE or session output",
    "treat database rollback as rollback of arbitrary external side effects"
  ],
  "source_ids": [
    "PG18-ISO",
    "PG18-SERFAIL",
    "PG18-SETTX"
  ],
  "runtime_required_for_learner_completion": true,
  "postgresql_version_must_be_recorded": true,
  "runtime_evidence_must_include": [
    "session T1 output",
    "session T2 output",
    "observed values",
    "SQLSTATE when conflict occurs",
    "whole-transaction retry result",
    "post-retry invariant check",
    "failed original Serializable session identity",
    "retry session output",
    "post-retry active reservation count and capacity",
    "input SHA-256 provenance",
    "generated isolated schema id and cleanup result"
  ],
  "transfer_required": true,
  "production_correctness_or_performance_claims_forbidden": true,
  "runtime_namespace_policy": "EPHEMERAL_RANDOM_SCHEMA_WITH_EXPLICIT_DISPOSABLE_CONFIRMATION",
  "retry_contract": "Retry the whole failed Serializable transaction from BEGIN; the capacity guard is re-evaluated, so a retry after the competing commit must not create a second active reservation.",
  "successful_runtime_acceptance": [
    "exactly one original Serializable transaction fails with serialization evidence",
    "failed transaction retries from BEGIN",
    "retry re-evaluates the capacity guard",
    "post-retry active reservations do not exceed capacity",
    "generated schema cleanup passes"
  ]
}
