{"abstract":"Calibration matches record counts rather than population margins.","category":"Survey sampling estimators","checks":6,"contract":"Rows are (cell,positive base weight); margins give positive population totals for exactly the represented cells. Return weights in input order rounded to eight decimals; empty inputs return empty list.","contract_signature":"rows, margins","evaluation_group":"model-d204cd9d3245752f","failed_approach":"Global calibration achieves only the grand total and misses cell margins.","family":"z-survey_sampling-poststratification","id":"FA-12616","implementations":{"attempt":{"sha256":"3193c32390a61f4ac5d701d90f4260f799b99d5fc0ce92b4ec9da67e6de79281","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows, margins):\n    total=sum(margins.values()); base=sum(w for c,w in rows)\n    return [round(w*total/base,8) for c,w in rows]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal base weights',solve([('a',N),('a',3*N)],{'a':8*N}),[2*N,6*N])\ncheck('separate margins',solve([('a',N),('b',N)],{'a':2*N,'b':6*N}),[2*N,6*N])\ncheck('already calibrated',solve([('a',N),('a',3*N)],{'a':4*N}),[N,3*N])\ncheck('single observation',solve([('a',N)],{'a':7*N}),[7*N])\ncheck('row order preserved',solve([('b',N),('a',N),('b',3*N)],{'a':2*N,'b':8*N}),[2*N,2*N,6*N])\ncheck('empty cells',solve([],{}),[])\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":"ba3f423e108b7523dad10abcfa0475dcf9e24ef8322f49b3ff12c4ebabe29385","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows, margins):\n    return [round(margins[c]/sum(k==c for k,v in rows),8) for c,w in rows]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal base weights',solve([('a',N),('a',3*N)],{'a':8*N}),[2*N,6*N])\ncheck('separate margins',solve([('a',N),('b',N)],{'a':2*N,'b':6*N}),[2*N,6*N])\ncheck('already calibrated',solve([('a',N),('a',3*N)],{'a':4*N}),[N,3*N])\ncheck('single observation',solve([('a',N)],{'a':7*N}),[7*N])\ncheck('row order preserved',solve([('b',N),('a',N),('b',3*N)],{'a':2*N,'b':8*N}),[2*N,2*N,6*N])\ncheck('empty cells',solve([],{}),[])\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":"Controlled finite fixtures; not a general survey-analysis package. 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":"z-survey_sampling-poststratification","generated_at":"2026-09-29T14:38:58.585259+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A deterministic survey-design model isolates this sampling contract before it is embedded in a larger estimation pipeline.","root_cause":"Each poststratum is assigned equal respondent weights ignoring base weights.","sha256":"3c7f229ea302246d26d2dd78fc089c7bd60c9eeca665413d5596fb5f776c2884","title":"Calibration matches record counts rather than population margins · 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":42.474,"exit_code":1,"observations":[{"actual":[2.0,6.0],"check":"unequal base weights","expected":[2,6],"passed":true},{"actual":[4.0,4.0],"check":"separate margins","expected":[2,6],"passed":false},{"actual":[1.0,3.0],"check":"already calibrated","expected":[1,3],"passed":true},{"actual":[7.0],"check":"single observation","expected":[7],"passed":true},{"actual":[2.0,2.0,6.0],"check":"row order preserved","expected":[2,2,6],"passed":true},{"actual":[],"check":"empty cells","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal base weights\", \"actual\": [2.0, 6.0], \"expected\": [2, 6], \"passed\": true}, {\"check\": \"separate margins\", \"actual\": [4.0, 4.0], \"expected\": [2, 6], \"passed\": false}, {\"check\": \"already calibrated\", \"actual\": [1.0, 3.0], \"expected\": [1, 3], \"passed\": true}, {\"check\": \"single observation\", \"actual\": [7.0], \"expected\": [7], \"passed\": true}, {\"check\": \"row order preserved\", \"actual\": [2.0, 2.0, 6.0], \"expected\": [2, 2, 6], \"passed\": true}, {\"check\": \"empty cells\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.997,"exit_code":1,"observations":[{"actual":[4.0,4.0],"check":"unequal base weights","expected":[2,6],"passed":false},{"actual":[2.0,6.0],"check":"separate margins","expected":[2,6],"passed":true},{"actual":[2.0,2.0],"check":"already calibrated","expected":[1,3],"passed":false},{"actual":[7.0],"check":"single observation","expected":[7],"passed":true},{"actual":[4.0,2.0,4.0],"check":"row order preserved","expected":[2,2,6],"passed":false},{"actual":[],"check":"empty cells","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal base weights\", \"actual\": [4.0, 4.0], \"expected\": [2, 6], \"passed\": false}, {\"check\": \"separate margins\", \"actual\": [2.0, 6.0], \"expected\": [2, 6], \"passed\": true}, {\"check\": \"already calibrated\", \"actual\": [2.0, 2.0], \"expected\": [1, 3], \"passed\": false}, {\"check\": \"single observation\", \"actual\": [7.0], \"expected\": [7], \"passed\": true}, {\"check\": \"row order preserved\", \"actual\": [4.0, 2.0, 4.0], \"expected\": [2, 2, 6], \"passed\": false}, {\"check\": \"empty cells\", \"actual\": [], \"expected\": [], \"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."}}