{
  "schema_version": 1,
  "experiment": "linux-stdio-output-boundary",
  "evidence_type": "deterministic-api-observation",
  "license": "MIT (Hesela harness and runner); observations are factual output",
  "generated_at_utc": "2026-10-21T01:13:00.128713Z",
  "environment": {
    "os": "Linux",
    "kernel_release": "6.8.0-146-generic",
    "architecture": "x86_64",
    "libc": [
      "glibc",
      "2.39"
    ],
    "python": "3.12.3",
    "compiler": "cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0",
    "compile_flags": [
      "-std=c11",
      "-Wall",
      "-Wextra",
      "-Werror"
    ]
  },
  "method": {
    "repeat_count": 5,
    "cases_per_repeat": 4,
    "sequence": [
      "buffer-before-file-sync",
      "full-device-flush",
      "full-device-close",
      "fwrite-item-units"
    ],
    "one_fresh_process_per_repeat": true,
    "single_threaded": true,
    "private_temporary_files": true,
    "controlled_error_sink": "/dev/full",
    "randomization": "none; deterministic ordered API calls",
    "errno_convention": "captured immediately on API failure; zero sentinel otherwise"
  },
  "sources_sha256": {
    "stdio-boundary.c": "04028b279d1195827677184de93846299ac444abbe5772f5e48f31a40968a3e7",
    "run-stdio-boundary.py": "d063f504ac28487baf13f1ba9caa8617d73d0af2477e15ac50b34b9c0824d44a"
  },
  "references": [
    "https://man7.org/linux/man-pages/man3/fflush.3.html",
    "https://man7.org/linux/man-pages/man3/fclose.3.html",
    "https://man7.org/linux/man-pages/man3/fwrite.3.html",
    "https://man7.org/linux/man-pages/man3/setbuf.3.html",
    "https://man7.org/linux/man-pages/man4/full.4.html",
    "https://man7.org/linux/man-pages/man2/fsync.2.html"
  ],
  "runs": [
    {
      "repeat": 1,
      "filesystem_type_hex": "0xef53",
      "cases": [
        {
          "id": "buffer-before-file-sync",
          "buffer_bytes": 4096,
          "fputc_return": 65,
          "fputc_errno": 0,
          "size_before_sync": 0,
          "fsync_before_return": 0,
          "fsync_before_errno": 0,
          "size_after_sync": 0,
          "fflush_return": 0,
          "fflush_errno": 0,
          "stream_error": 0,
          "size_after_flush": 1,
          "pread_return": 1,
          "pread_errno": 0,
          "read_byte": 65,
          "fsync_after_return": 0,
          "fsync_after_errno": 0,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-flush",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fflush_return": -1,
          "fflush_errno": 28,
          "fflush_errno_name": "ENOSPC",
          "error_after": 1,
          "cleanup_fclose_return": 0,
          "cleanup_fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-close",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fclose_return": -1,
          "fclose_errno": 28,
          "fclose_errno_name": "ENOSPC",
          "passed": true
        },
        {
          "id": "fwrite-item-units",
          "item_size": 4,
          "requested_items": 3,
          "returned_items": 3,
          "fwrite_errno": 0,
          "file_size": 12,
          "stream_error": 0,
          "pread_return": 12,
          "pread_errno": 0,
          "payload_matches": 1,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        }
      ]
    },
    {
      "repeat": 2,
      "filesystem_type_hex": "0xef53",
      "cases": [
        {
          "id": "buffer-before-file-sync",
          "buffer_bytes": 4096,
          "fputc_return": 65,
          "fputc_errno": 0,
          "size_before_sync": 0,
          "fsync_before_return": 0,
          "fsync_before_errno": 0,
          "size_after_sync": 0,
          "fflush_return": 0,
          "fflush_errno": 0,
          "stream_error": 0,
          "size_after_flush": 1,
          "pread_return": 1,
          "pread_errno": 0,
          "read_byte": 65,
          "fsync_after_return": 0,
          "fsync_after_errno": 0,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-flush",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fflush_return": -1,
          "fflush_errno": 28,
          "fflush_errno_name": "ENOSPC",
          "error_after": 1,
          "cleanup_fclose_return": 0,
          "cleanup_fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-close",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fclose_return": -1,
          "fclose_errno": 28,
          "fclose_errno_name": "ENOSPC",
          "passed": true
        },
        {
          "id": "fwrite-item-units",
          "item_size": 4,
          "requested_items": 3,
          "returned_items": 3,
          "fwrite_errno": 0,
          "file_size": 12,
          "stream_error": 0,
          "pread_return": 12,
          "pread_errno": 0,
          "payload_matches": 1,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        }
      ]
    },
    {
      "repeat": 3,
      "filesystem_type_hex": "0xef53",
      "cases": [
        {
          "id": "buffer-before-file-sync",
          "buffer_bytes": 4096,
          "fputc_return": 65,
          "fputc_errno": 0,
          "size_before_sync": 0,
          "fsync_before_return": 0,
          "fsync_before_errno": 0,
          "size_after_sync": 0,
          "fflush_return": 0,
          "fflush_errno": 0,
          "stream_error": 0,
          "size_after_flush": 1,
          "pread_return": 1,
          "pread_errno": 0,
          "read_byte": 65,
          "fsync_after_return": 0,
          "fsync_after_errno": 0,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-flush",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fflush_return": -1,
          "fflush_errno": 28,
          "fflush_errno_name": "ENOSPC",
          "error_after": 1,
          "cleanup_fclose_return": 0,
          "cleanup_fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-close",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fclose_return": -1,
          "fclose_errno": 28,
          "fclose_errno_name": "ENOSPC",
          "passed": true
        },
        {
          "id": "fwrite-item-units",
          "item_size": 4,
          "requested_items": 3,
          "returned_items": 3,
          "fwrite_errno": 0,
          "file_size": 12,
          "stream_error": 0,
          "pread_return": 12,
          "pread_errno": 0,
          "payload_matches": 1,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        }
      ]
    },
    {
      "repeat": 4,
      "filesystem_type_hex": "0xef53",
      "cases": [
        {
          "id": "buffer-before-file-sync",
          "buffer_bytes": 4096,
          "fputc_return": 65,
          "fputc_errno": 0,
          "size_before_sync": 0,
          "fsync_before_return": 0,
          "fsync_before_errno": 0,
          "size_after_sync": 0,
          "fflush_return": 0,
          "fflush_errno": 0,
          "stream_error": 0,
          "size_after_flush": 1,
          "pread_return": 1,
          "pread_errno": 0,
          "read_byte": 65,
          "fsync_after_return": 0,
          "fsync_after_errno": 0,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-flush",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fflush_return": -1,
          "fflush_errno": 28,
          "fflush_errno_name": "ENOSPC",
          "error_after": 1,
          "cleanup_fclose_return": 0,
          "cleanup_fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-close",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fclose_return": -1,
          "fclose_errno": 28,
          "fclose_errno_name": "ENOSPC",
          "passed": true
        },
        {
          "id": "fwrite-item-units",
          "item_size": 4,
          "requested_items": 3,
          "returned_items": 3,
          "fwrite_errno": 0,
          "file_size": 12,
          "stream_error": 0,
          "pread_return": 12,
          "pread_errno": 0,
          "payload_matches": 1,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        }
      ]
    },
    {
      "repeat": 5,
      "filesystem_type_hex": "0xef53",
      "cases": [
        {
          "id": "buffer-before-file-sync",
          "buffer_bytes": 4096,
          "fputc_return": 65,
          "fputc_errno": 0,
          "size_before_sync": 0,
          "fsync_before_return": 0,
          "fsync_before_errno": 0,
          "size_after_sync": 0,
          "fflush_return": 0,
          "fflush_errno": 0,
          "stream_error": 0,
          "size_after_flush": 1,
          "pread_return": 1,
          "pread_errno": 0,
          "read_byte": 65,
          "fsync_after_return": 0,
          "fsync_after_errno": 0,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-flush",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fflush_return": -1,
          "fflush_errno": 28,
          "fflush_errno_name": "ENOSPC",
          "error_after": 1,
          "cleanup_fclose_return": 0,
          "cleanup_fclose_errno": 0,
          "passed": true
        },
        {
          "id": "full-device-close",
          "fputc_return": 66,
          "fputc_errno": 0,
          "error_before": 0,
          "fclose_return": -1,
          "fclose_errno": 28,
          "fclose_errno_name": "ENOSPC",
          "passed": true
        },
        {
          "id": "fwrite-item-units",
          "item_size": 4,
          "requested_items": 3,
          "returned_items": 3,
          "fwrite_errno": 0,
          "file_size": 12,
          "stream_error": 0,
          "pread_return": 12,
          "pread_errno": 0,
          "payload_matches": 1,
          "fclose_return": 0,
          "fclose_errno": 0,
          "passed": true
        }
      ]
    }
  ],
  "summary": {
    "passed_cases": 20,
    "total_cases": 20,
    "all_passed": true,
    "temporary_directory_removed": true
  },
  "limitations": [
    "One Linux/libc host; exact buffering timing is an observation, not a universal API guarantee.",
    "Repeats check repeatability, not independent statistical samples or failure rates.",
    "fstat size and pread bytes observe file visibility, not physical persistence.",
    "/dev/full rejects writes; it is not a full filesystem or delayed writeback/errseq fault injection.",
    "No power loss, crash recovery, concurrent writers, partial item or storage-device failure was tested.",
    "A successful cleanup close cannot erase a preceding recorded output error."
  ]
}
