{
  "part": 5,
  "title": "Status carry-over for disabled dataset",
  "reset": "standard",
  "steps": [
    { "id": "5.1", "title": "Baseline with both datasets",
      "actions": [
        { "do": "zfs_snapshot", "dataset": "{SRC}/ds1@part5a" },
        { "do": "zfs_snapshot", "dataset": "{SRC}/ds2@part5a" },
        { "do": "run_sneakernet", "servername": "test-source", "verbosity": 1, "log": "part5a_source", "expect_exit": 0 },
        { "do": "run_sneakernet", "servername": "test-target", "verbosity": 1, "log": "part5a_target", "expect_exit": 0 },
        { "do": "read_file", "path": "{SN}/sneakernet_target.status",
          "capture": { "name": "DS1_LINES", "select": "(ds1\\@)", "reduce": "count" } },
        { "do": "read_file", "path": "{SN}/sneakernet_target.status",
          "capture": { "name": "DS2_LINES", "select": "(ds2\\@)", "reduce": "count" } }
      ],
      "assertions": [
        { "type": "count_equals", "var": "DS1_LINES", "n": 1, "message": "status file has exactly one line for ds1" },
        { "type": "count_equals", "var": "DS2_LINES", "n": 1, "message": "status file has exactly one line for ds2" }
      ]
    },
    { "id": "5.2", "title": "Temporarily disable ds2", "depends_on": ["5.1"],
      "config": { "mutations": [ { "op": "comment_out", "path": "datasets.ds2" } ], "restore": "none" },
      "actions": [
        { "do": "zfs_snapshot", "dataset": "{SRC}/ds1@part5b" },
        { "do": "run_sneakernet", "servername": "test-source", "verbosity": 3, "log": "part5b_source", "expect_exit": 0, "capture": { "name": "LOG5B" } },
        { "do": "read_file", "path": "{SN}/sneakernet_target.status",
          "capture": { "name": "DS2_STILL_THERE", "select": "(ds2\\@)", "reduce": "count" } },
        { "do": "run_sneakernet", "servername": "test-target", "verbosity": 1, "log": "part5b_target", "expect_exit": 0 }
      ],
      "assertions": [
        { "type": "regex_present", "var": "LOG5B", "pattern": "(?i)Carried over 1 status entry", "message": "log reports carrying over ds2's status entry" },
        { "type": "count_equals", "var": "DS2_STILL_THERE", "n": 1, "message": "ds2's status line survives even though it wasn't processed this run" }
      ]
    },
    { "id": "5.3", "title": "Re-enable ds2 and confirm it resumes incrementally, not from scratch", "depends_on": ["5.2"],
      "config": { "mutations": [ { "op": "uncomment", "path": "datasets.ds2" } ], "restore": "none" },
      "actions": [
        { "do": "zfs_snapshot", "dataset": "{SRC}/ds2@part5c" },
        { "do": "run_sneakernet", "servername": "test-source", "verbosity": 4, "log": "part5c_source", "expect_exit": 0, "capture": { "name": "LOG5C" } }
      ],
      "assertions": [
        { "type": "regex_present", "var": "LOG5C", "pattern": "zfs send[^\\n]*-[iI][^\\n]*ds2|zfs send[^\\n]*ds2[^\\n]*-[iI]", "message": "the printed ds2 send command is incremental (-i/-I), not a bare full send - its old resume point survived being skipped" }
      ],
      "cleanup": [
        { "do": "run_sneakernet", "servername": "test-target", "verbosity": 1, "log": "part5c_target", "expect_exit": 0 }
      ]
    }
  ]
}
