{"abstract":"Changing the scale of weights changes the result, or unequal-weight observations are treated as equally influential.","category":"Numerical aggregation","checks":9,"contract":"For integer [value, nonnegative weight] pairs, return the exact weighted mean as a reduced Fraction string. Negative weights, no records, or zero total weight return None. Zero-valued observations remain valid.","evaluation_group":"model-f8507937f147a900","failed_approach":"Dropping zero-weight records and taking an ordinary mean ignores the remaining unequal weights.","family":"num-weighted-mean-denominator","id":"FA-316","implementations":{"attempt":{"sha256":"618ca2de3e1e844b42f908cdba277bddd835c97f60bd44c127c2a758cfe2e4ff","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(samples):\n    if not samples or any(weight < 0 for value, weight in samples):\n        return None\n    values = [value for value, weight in samples if weight > 0]\n    return str(Fraction(sum(values), len(values))) if values else None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal weights including zero value', solve([[0, 1], [6 * N, 2]]), str(4 * N))\ncheck('uniform weight scaling changes nothing', solve([[0, 7], [6 * N, 14]]), str(4 * N))\ncheck('equal weights', solve([[2 * N, 3], [4 * N, 3]]), str(3 * N))\ncheck('zero weight contributes nothing', solve([[100 * N, 0], [2 * N, 3]]), str(2 * N))\ncheck('fractional result remains exact', solve([[N, 1], [N + 1, 2]]), f'{3 * N + 2}/3')\ncheck('negative observed values allowed', solve([[-6 * N, 2], [0, 1]]), str(-4 * N))\ncheck('zero total weight', solve([[N, 0]]), None)\ncheck('negative weight rejected', solve([[N, -1], [N, 2]]), None)\ncheck('no observations', solve([]), None)\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":"d1beed9a38b3fa4b90ed1b231faa409cbc8d67b91ff35596fcfde8635fea616f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(samples):\n    if not samples or any(weight < 0 for value, weight in samples) or not sum(weight for value, weight in samples):\n        return None\n    return str(Fraction(sum(value * weight for value, weight in samples), len(samples)))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal weights including zero value', solve([[0, 1], [6 * N, 2]]), str(4 * N))\ncheck('uniform weight scaling changes nothing', solve([[0, 7], [6 * N, 14]]), str(4 * N))\ncheck('equal weights', solve([[2 * N, 3], [4 * N, 3]]), str(3 * N))\ncheck('zero weight contributes nothing', solve([[100 * N, 0], [2 * N, 3]]), str(2 * N))\ncheck('fractional result remains exact', solve([[N, 1], [N + 1, 2]]), f'{3 * N + 2}/3')\ncheck('negative observed values allowed', solve([[-6 * N, 2], [0, 1]]), str(-4 * N))\ncheck('zero total weight', solve([[N, 0]]), None)\ncheck('negative weight rejected', solve([[N, -1], [N, 2]]), None)\ncheck('no observations', solve([]), None)\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"},"fixed":{"sha256":"7fdb597e77d4b1b4a20450d9db5f568508f3e264f607550ebba0839a3b759563","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(samples):\n    if not samples or any(weight < 0 for value, weight in samples):\n        return None\n    total = sum(weight for value, weight in samples)\n    return str(Fraction(sum(value * weight for value, weight in samples), total)) if total else None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal weights including zero value', solve([[0, 1], [6 * N, 2]]), str(4 * N))\ncheck('uniform weight scaling changes nothing', solve([[0, 7], [6 * N, 14]]), str(4 * N))\ncheck('equal weights', solve([[2 * N, 3], [4 * N, 3]]), str(3 * N))\ncheck('zero weight contributes nothing', solve([[100 * N, 0], [2 * N, 3]]), str(2 * N))\ncheck('fractional result remains exact', solve([[N, 1], [N + 1, 2]]), f'{3 * N + 2}/3')\ncheck('negative observed values allowed', solve([[-6 * N, 2], [0, 1]]), str(-4 * N))\ncheck('zero total weight', solve([[N, 0]]), None)\ncheck('negative weight rejected', solve([[N, -1], [N, 2]]), None)\ncheck('no observations', solve([]), None)\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":" 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":"num-weighted-mean-denominator","generated_at":"2026-09-29T14:36:52.070577+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Metrics combined across unequal sample counts need a weighted denominator. Scaling all weights should preserve the result; ignoring that invariant produces misleading aggregate summaries.","repair":"Divide the sum of value-times-weight by the total weight using exact rational arithmetic.","root_cause":"The denominator counts records instead of summing the same weights used in the numerator.","sha256":"8e6e965608df55b501194a157b14d5ab0ea4921fd345c76af98dde9273b48102","title":"A weighted total is divided by the number of records · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":35.606,"exit_code":1,"observations":[{"actual":"3","check":"unequal weights including zero value","expected":"4","passed":false},{"actual":"3","check":"uniform weight scaling changes nothing","expected":"4","passed":false},{"actual":"3","check":"equal weights","expected":"3","passed":true},{"actual":"2","check":"zero weight contributes nothing","expected":"2","passed":true},{"actual":"3/2","check":"fractional result remains exact","expected":"5/3","passed":false},{"actual":"-3","check":"negative observed values allowed","expected":"-4","passed":false},{"actual":null,"check":"zero total weight","expected":null,"passed":true},{"actual":null,"check":"negative weight rejected","expected":null,"passed":true},{"actual":null,"check":"no observations","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal weights including zero value\", \"actual\": \"3\", \"expected\": \"4\", \"passed\": false}, {\"check\": \"uniform weight scaling changes nothing\", \"actual\": \"3\", \"expected\": \"4\", \"passed\": false}, {\"check\": \"equal weights\", \"actual\": \"3\", \"expected\": \"3\", \"passed\": true}, {\"check\": \"zero weight contributes nothing\", \"actual\": \"2\", \"expected\": \"2\", \"passed\": true}, {\"check\": \"fractional result remains exact\", \"actual\": \"3/2\", \"expected\": \"5/3\", \"passed\": false}, {\"check\": \"negative observed values allowed\", \"actual\": \"-3\", \"expected\": \"-4\", \"passed\": false}, {\"check\": \"zero total weight\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"negative weight rejected\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"no observations\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":34.779,"exit_code":1,"observations":[{"actual":"6","check":"unequal weights including zero value","expected":"4","passed":false},{"actual":"42","check":"uniform weight scaling changes nothing","expected":"4","passed":false},{"actual":"9","check":"equal weights","expected":"3","passed":false},{"actual":"3","check":"zero weight contributes nothing","expected":"2","passed":false},{"actual":"5/2","check":"fractional result remains exact","expected":"5/3","passed":false},{"actual":"-6","check":"negative observed values allowed","expected":"-4","passed":false},{"actual":null,"check":"zero total weight","expected":null,"passed":true},{"actual":null,"check":"negative weight rejected","expected":null,"passed":true},{"actual":null,"check":"no observations","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal weights including zero value\", \"actual\": \"6\", \"expected\": \"4\", \"passed\": false}, {\"check\": \"uniform weight scaling changes nothing\", \"actual\": \"42\", \"expected\": \"4\", \"passed\": false}, {\"check\": \"equal weights\", \"actual\": \"9\", \"expected\": \"3\", \"passed\": false}, {\"check\": \"zero weight contributes nothing\", \"actual\": \"3\", \"expected\": \"2\", \"passed\": false}, {\"check\": \"fractional result remains exact\", \"actual\": \"5/2\", \"expected\": \"5/3\", \"passed\": false}, {\"check\": \"negative observed values allowed\", \"actual\": \"-6\", \"expected\": \"-4\", \"passed\": false}, {\"check\": \"zero total weight\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"negative weight rejected\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"no observations\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":36.322,"exit_code":0,"observations":[{"actual":"4","check":"unequal weights including zero value","expected":"4","passed":true},{"actual":"4","check":"uniform weight scaling changes nothing","expected":"4","passed":true},{"actual":"3","check":"equal weights","expected":"3","passed":true},{"actual":"2","check":"zero weight contributes nothing","expected":"2","passed":true},{"actual":"5/3","check":"fractional result remains exact","expected":"5/3","passed":true},{"actual":"-4","check":"negative observed values allowed","expected":"-4","passed":true},{"actual":null,"check":"zero total weight","expected":null,"passed":true},{"actual":null,"check":"negative weight rejected","expected":null,"passed":true},{"actual":null,"check":"no observations","expected":null,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal weights including zero value\", \"actual\": \"4\", \"expected\": \"4\", \"passed\": true}, {\"check\": \"uniform weight scaling changes nothing\", \"actual\": \"4\", \"expected\": \"4\", \"passed\": true}, {\"check\": \"equal weights\", \"actual\": \"3\", \"expected\": \"3\", \"passed\": true}, {\"check\": \"zero weight contributes nothing\", \"actual\": \"2\", \"expected\": \"2\", \"passed\": true}, {\"check\": \"fractional result remains exact\", \"actual\": \"5/3\", \"expected\": \"5/3\", \"passed\": true}, {\"check\": \"negative observed values allowed\", \"actual\": \"-4\", \"expected\": \"-4\", \"passed\": true}, {\"check\": \"zero total weight\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"negative weight rejected\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"no observations\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}