{
  "contract_id": "empty-filtered-batch-teaching-v1",
  "status": "Newly authored fictional teaching contract approved for this isolated example, not customer intent or a historical production incident.",
  "tested_boundary": "Direct apply_batch(db,batch) function call using one fresh on-disk SQLite database. No HTTP, parser, queue, notification or external service.",
  "incoming_domain": {
    "precondition": "type(batch) is list and every element has exact type str; caller supplies a connection without an active transaction.",
    "admitted_empty_forms": "An empty list, empty strings and whitespace-only strings inside lists remain admitted inputs.",
    "outside_precondition": "Absent argument, None, maps, non-string elements, bytes and adapter/parser behavior are unspecified and unperformed. Do not infer upstream validation.",
    "usable_row": "A supplied string is usable when its strip() result is nonempty. This classifies blankness only; the original usable string is stored unchanged. The selected ASCII blank examples are not a Unicode-whitespace coverage matrix."
  },
  "allowed_starting_state": {
    "id": "S0",
    "stored_records": [
      [
        1,
        "preexisting"
      ]
    ],
    "active_transaction": false,
    "description": "Every invocation uses a new database with one preexisting row; that row must survive no-op, rejection and application."
  },
  "written_rules": [
    {
      "case": "raw empty list",
      "response": {
        "status": "noop",
        "first": null,
        "stored": 0,
        "skipped": 0
      },
      "effect": "No inserted/deleted/changed rows; S0 remains."
    },
    {
      "case": "nonempty list with no usable strings",
      "response": "status rejected, reason no_usable_records, stored0, skipped equal input length; no extra keys.",
      "effect": "No inserted/deleted/changed rows; S0 remains."
    },
    {
      "case": "at least one usable string",
      "response": "status applied; first is original first usable string; stored counts usable rows; skipped counts blank rows.",
      "effect": "Append every usable original string once in order; preserve preexisting rows. Fresh-database examples do not establish request idempotency or repeat/retry semantics."
    }
  ],
  "observation_points": [
    "Exact typed response or exact exception type/message/source site.",
    "All ordered stored_records rows before call, immediately after call, and through a fresh connection after close/reopen.",
    "Whether a transaction remains open after the function returns or raises."
  ],
  "oracle": "Independent literal whole responses and exact row lists; exact keys and value types prevent bool/int equality from weakening counts or identifiers.",
  "transaction_policy": {
    "connection": "isolation_level=None, plus explicit LEGACY_TRANSACTION_CONTROL on Python>=3.12; no implicit transaction is assumed.",
    "pragmas": {
      "journal_mode": "DELETE",
      "synchronous": "FULL"
    },
    "work_path": "Read first usable string, BEGIN IMMEDIATE, insert first then all remaining usable strings, COMMIT. On a caught SQLite error, explicitly roll back if active, then raise.",
    "crash_path": "Baseline empty usable list raises IndexError at first=usable[0] before BEGIN or INSERT. This first access supplies an actual first INSERT on valid inputs, not an unused crash probe.",
    "limits": "SQL failure/locking/crash-recovery/power-loss behavior is not exercised. Close/reopen observes stored rows at that point, not a crash-recovery guarantee."
  },
  "implementations": {
    "baseline": "Filters blank strings, then unconditionally persists the first usable string and remainder.",
    "corrected": "Distinguishes raw empty list from nonempty all-blank input before performing the same valid work.",
    "always-noop": "Deliberately wrong candidate returns noop for everything, causing no exception but dropping valid work and misreporting all-blank rejection."
  },
  "reduction": {
    "original": [
      "",
      " ",
      "\t"
    ],
    "sequence_lengths": [
      3,
      2,
      1,
      0
    ],
    "predicate": "Same IndexError type, message, file/function/line/source text and exact batch.py SHA.",
    "method": "Actually execute original input and three first-element deletions; not a general delta-debugging implementation.",
    "semantic_limit": "Original nonempty all-blank list must reject, while final empty list must no-op. Preserving exception/site does not preserve the required business response; keep both witnesses and regressions.",
    "count_limit": "Four reduction calls and three retained deletions. Two intermediate arrays add distinct inputs beyond the seven regression cases."
  },
  "failure_language": "Suites catch and record a callable IndexError. A separate unhandled-child command really exits1 with that IndexError signature. Neither is an OS signal or Go panic; a generic nonzero/setup failure is not reproduction evidence.",
  "exclusions": [
    "The old article labeled its production-like story illustrative; no historical customer/production failure is authenticated.",
    "No interrupted retry, duplicate request, idempotency, concurrency, process restart, power loss, SQL failure or lock-contention behavior is established.",
    "No generic policy for absent/nil/map/bytes/nonstring/placeholder data, Unicode whitespace matrix or parsing is established.",
    "No exhaustive failure-class closure, sibling-entry-point sweep, formal proof or random shrink campaign is established.",
    "No Proof CLI, issue transition, evidence-capture command or ProblemReport closure is executed by this portable standard-library kit."
  ]
}
