{"abstract":"Households without any index case dilute the attack rate.","category":"Epidemic compartment models","checks":7,"contract":"Each household is [size, index_cases, secondary]; skip households without an index case, without members at risk, or with more secondaries than at-risk members; pooled SAR = sum secondary / sum (size-index); per-size table sorted by size ascending; return [pooled rounded 6 or None, table].","contract_signature":"households","evaluation_group":"w2-epidemic-household-sar","failed_approach":"Testing index<0 never excludes zero-index households.","family":"w2-epidemic-household-sar-index-requirement","id":"FA-65276","implementations":{"attempt":{"sha256":"a9498403ea4d688d9b1f5b49782f8f1ee9fb621e739c483e182dce48f86af61f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(households):\n    num = 0\n    den = 0\n    by_size = {}\n    for size, index, secondary in households:\n        at_risk = size - index\n        if index < 0 or at_risk <= 0:\n            continue\n        if secondary > at_risk:\n            continue\n        num += secondary\n        den += at_risk\n        a, b = by_size.get(size, (0, 0))\n        by_size[size] = (a + secondary, b + at_risk)\n    overall = round(num / den, 6) if den else None\n    table = [[k, round(a / b, 6)] for k, (a, b) in sorted(by_size.items())]\n    return [overall, table]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('control: mixed households',\n   ([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),\n   [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),\n  ('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),\n  ('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: data error secondary too high',\n   ([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),\n   [0.5, [[3, 0.5], [5, 0.5]]]),\n  ('control: empty input', ([],), [None, []]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]])],\n [('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: data error secondary too high',\n   ([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),\n   [0.5, [[3, 0.5], [5, 0.5]]]),\n  ('control: empty input', ([],), [None, []]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),\n  ('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),\n  ('control: large and small',\n   ([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),\n   [0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])],\n [('control: mixed households',\n   ([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),\n   [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),\n  ('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),\n  ('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),\n  ('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),\n  ('control: large and small',\n   ([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),\n   [0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])],\n [('control: mixed households',\n   ([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),\n   [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),\n  ('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),\n  ('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: data error secondary too high',\n   ([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),\n   [0.5, [[3, 0.5], [5, 0.5]]]),\n  ('control: empty input', ([],), [None, []]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]])],\n [('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: data error secondary too high',\n   ([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),\n   [0.5, [[3, 0.5], [5, 0.5]]]),\n  ('control: empty input', ([],), [None, []]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),\n  ('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),\n  ('control: large and small',\n   ([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),\n   [0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"e52512e06194f05b69f1ecb560e9f5193afaffd0bdfc5baa366549b9bc4e0d30","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(households):\n    num = 0\n    den = 0\n    by_size = {}\n    for size, index, secondary in households:\n        at_risk = size - index\n        if at_risk <= 0:\n            continue\n        if secondary > at_risk:\n            continue\n        num += secondary\n        den += at_risk\n        a, b = by_size.get(size, (0, 0))\n        by_size[size] = (a + secondary, b + at_risk)\n    overall = round(num / den, 6) if den else None\n    table = [[k, round(a / b, 6)] for k, (a, b) in sorted(by_size.items())]\n    return [overall, table]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('control: mixed households',\n   ([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),\n   [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),\n  ('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),\n  ('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: data error secondary too high',\n   ([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),\n   [0.5, [[3, 0.5], [5, 0.5]]]),\n  ('control: empty input', ([],), [None, []]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]])],\n [('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: data error secondary too high',\n   ([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),\n   [0.5, [[3, 0.5], [5, 0.5]]]),\n  ('control: empty input', ([],), [None, []]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),\n  ('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),\n  ('control: large and small',\n   ([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),\n   [0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])],\n [('control: mixed households',\n   ([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),\n   [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),\n  ('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),\n  ('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),\n  ('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),\n  ('control: large and small',\n   ([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),\n   [0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])],\n [('control: mixed households',\n   ([[4, 1, 2], [3, 1, 0], [5, 2, 1], [2, 1, 1]],),\n   [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]]),\n  ('control: two index cases', ([[6, 2, 3], [6, 1, 1], [3, 1, 1]],), [0.454545, [[3, 0.5], [6, 0.444444]]]),\n  ('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: data error secondary too high',\n   ([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),\n   [0.5, [[3, 0.5], [5, 0.5]]]),\n  ('control: empty input', ([],), [None, []]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]])],\n [('regression: no index household', ([[4, 0, 0], [4, 1, 1], [3, 1, 2]],), [0.6, [[3, 1.0], [4, 0.333333]]]),\n  ('control: single-person household', ([[1, 1, 0], [2, 1, 1]],), [1.0, [[2, 1.0]]]),\n  ('control: data error secondary too high',\n   ([[3, 1, 4], [3, 1, 1], [5, 1, 2]],),\n   [0.5, [[3, 0.5], [5, 0.5]]]),\n  ('control: empty input', ([],), [None, []]),\n  ('control: descending sizes',\n   ([[7, 1, 3], [2, 1, 0], [4, 1, 1]],),\n   [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]]),\n  ('control: all index', ([[2, 2, 0], [3, 3, 0]],), [None, []]),\n  ('control: large and small',\n   ([[8, 1, 6], [2, 1, 1], [8, 2, 1], [3, 1, 0]],),\n   [0.5, [[2, 1.0], [3, 0.0], [8, 0.538462]]])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Deterministic bounded teaching model with a stipulated contract; not a validated scientific or public-health modelling library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-epidemic-household-sar-index-requirement","generated_at":"2026-09-29T14:47:32.515052+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Compartmental epidemic calculations drive outbreak forecasts, vaccine targets and hospital planning; a single wrong flow, rate conversion or boundary silently changes every downstream number.","root_cause":"Households with no index case are not excluded.","sha256":"994a077ed72c4ce5c75de77393797e9e82fc7952f83c6f34913fa1f899fd469d","title":"Household secondary attack rate: index requirement · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":41.462,"exit_code":1,"observations":[{"actual":[0.444444,[[2,1.0],[3,0.0],[4,0.666667],[5,0.333333]]],"check":"control: mixed households","expected":[0.444444,[[2,1.0],[3,0.0],[4,0.666667],[5,0.333333]]],"passed":true},{"actual":[0.454545,[[3,0.5],[6,0.444444]]],"check":"control: two index cases","expected":[0.454545,[[3,0.5],[6,0.444444]]],"passed":true},{"actual":[0.333333,[[3,1.0],[4,0.142857]]],"check":"regression: no index household","expected":[0.6,[[3,1.0],[4,0.333333]]],"passed":false},{"actual":[1.0,[[2,1.0]]],"check":"control: single-person household","expected":[1.0,[[2,1.0]]],"passed":true},{"actual":[0.5,[[3,0.5],[5,0.5]]],"check":"control: data error secondary too high","expected":[0.5,[[3,0.5],[5,0.5]]],"passed":true},{"actual":[null,[]],"check":"control: empty input","expected":[null,[]],"passed":true},{"actual":[0.4,[[2,0.0],[4,0.333333],[7,0.5]]],"check":"control: descending sizes","expected":[0.4,[[2,0.0],[4,0.333333],[7,0.5]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control: mixed households\", \"actual\": [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]], \"expected\": [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]], \"passed\": true}, {\"check\": \"control: two index cases\", \"actual\": [0.454545, [[3, 0.5], [6, 0.444444]]], \"expected\": [0.454545, [[3, 0.5], [6, 0.444444]]], \"passed\": true}, {\"check\": \"regression: no index household\", \"actual\": [0.333333, [[3, 1.0], [4, 0.142857]]], \"expected\": [0.6, [[3, 1.0], [4, 0.333333]]], \"passed\": false}, {\"check\": \"control: single-person household\", \"actual\": [1.0, [[2, 1.0]]], \"expected\": [1.0, [[2, 1.0]]], \"passed\": true}, {\"check\": \"control: data error secondary too high\", \"actual\": [0.5, [[3, 0.5], [5, 0.5]]], \"expected\": [0.5, [[3, 0.5], [5, 0.5]]], \"passed\": true}, {\"check\": \"control: empty input\", \"actual\": [null, []], \"expected\": [null, []], \"passed\": true}, {\"check\": \"control: descending sizes\", \"actual\": [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]], \"expected\": [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.368,"exit_code":1,"observations":[{"actual":[0.444444,[[2,1.0],[3,0.0],[4,0.666667],[5,0.333333]]],"check":"control: mixed households","expected":[0.444444,[[2,1.0],[3,0.0],[4,0.666667],[5,0.333333]]],"passed":true},{"actual":[0.454545,[[3,0.5],[6,0.444444]]],"check":"control: two index cases","expected":[0.454545,[[3,0.5],[6,0.444444]]],"passed":true},{"actual":[0.333333,[[3,1.0],[4,0.142857]]],"check":"regression: no index household","expected":[0.6,[[3,1.0],[4,0.333333]]],"passed":false},{"actual":[1.0,[[2,1.0]]],"check":"control: single-person household","expected":[1.0,[[2,1.0]]],"passed":true},{"actual":[0.5,[[3,0.5],[5,0.5]]],"check":"control: data error secondary too high","expected":[0.5,[[3,0.5],[5,0.5]]],"passed":true},{"actual":[null,[]],"check":"control: empty input","expected":[null,[]],"passed":true},{"actual":[0.4,[[2,0.0],[4,0.333333],[7,0.5]]],"check":"control: descending sizes","expected":[0.4,[[2,0.0],[4,0.333333],[7,0.5]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control: mixed households\", \"actual\": [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]], \"expected\": [0.444444, [[2, 1.0], [3, 0.0], [4, 0.666667], [5, 0.333333]]], \"passed\": true}, {\"check\": \"control: two index cases\", \"actual\": [0.454545, [[3, 0.5], [6, 0.444444]]], \"expected\": [0.454545, [[3, 0.5], [6, 0.444444]]], \"passed\": true}, {\"check\": \"regression: no index household\", \"actual\": [0.333333, [[3, 1.0], [4, 0.142857]]], \"expected\": [0.6, [[3, 1.0], [4, 0.333333]]], \"passed\": false}, {\"check\": \"control: single-person household\", \"actual\": [1.0, [[2, 1.0]]], \"expected\": [1.0, [[2, 1.0]]], \"passed\": true}, {\"check\": \"control: data error secondary too high\", \"actual\": [0.5, [[3, 0.5], [5, 0.5]]], \"expected\": [0.5, [[3, 0.5], [5, 0.5]]], \"passed\": true}, {\"check\": \"control: empty input\", \"actual\": [null, []], \"expected\": [null, []], \"passed\": true}, {\"check\": \"control: descending sizes\", \"actual\": [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]], \"expected\": [0.4, [[2, 0.0], [4, 0.333333], [7, 0.5]]], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}