{"abstract":"pair sampling drops minority strata.","category":"Preference pair construction","checks":6,"contract":"Rows are [stratum,pair]. Return at most quota rows for each stratum, in original order; quota is nonnegative.","contract_signature":"rows, quota","evaluation_group":"preference-pair-stratification","failed_approach":"Sorting by stratum before truncating still spends the entire quota on the first group.","family":"w3-preference-pair-construction-pair-stratification","id":"FA-100131","implementations":{"attempt":{"sha256":"8219dca329efc7896d533f32e2584c5e38625205544dec7ef72f4d134d8405e1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows, quota):\n    return sorted(rows,key=lambda r:r[0])[:quota]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na='a'+str(N); b='b'+str(N)\nrows=[[a,1],[a,2],[a,3],[b,4],[b,5]]\ncheck('quota per group',solve(rows,2),[[a,1],[a,2],[b,4],[b,5]])\ncheck('zero quota',solve(rows,0),[])\ncheck('empty',solve([],N),[])\ncheck('one per group',solve(rows,1),[[a,1],[b,4]])\ncheck('quota beyond group',solve([[a,1],[b,2]],5),[[a,1],[b,2]])\ncheck('interleaved retains order',solve([[a,1],[b,2],[a,3],[b,4]],1),[[a,1],[b,2]])\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":"f34336176e4207f794ae1b769f92125c7984c0d624a2905cdee948178b8dd1f1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(rows, quota):\n    return rows[:quota]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na='a'+str(N); b='b'+str(N)\nrows=[[a,1],[a,2],[a,3],[b,4],[b,5]]\ncheck('quota per group',solve(rows,2),[[a,1],[a,2],[b,4],[b,5]])\ncheck('zero quota',solve(rows,0),[])\ncheck('empty',solve([],N),[])\ncheck('one per group',solve(rows,1),[[a,1],[b,4]])\ncheck('quota beyond group',solve([[a,1],[b,2]],5),[[a,1],[b,2]])\ncheck('interleaved retains order',solve([[a,1],[b,2],[a,3],[b,4]],1),[[a,1],[b,2]])\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":"These are explicit toy record contracts; they do not claim compatibility with a trainer or improved model behavior. 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":"w3-preference-pair-construction-pair-stratification","generated_at":"2026-09-30T16:48:32.171473+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A small deterministic preference-data transform makes pair semantics inspectable without a training framework.","root_cause":"A single global limit is filled by early common-stratum records.","sha256":"4ab9debf38c411a443283e59ae1e80092f370404a91cfd97b185072ac0bd0215","title":"Preference pairs: pair sampling drops minority strata · case 01","variant":1,"variant_policy":"The fixture code references N, supplied as 1 through 5. Fixed boundary checks may repeat. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":29.923,"exit_code":1,"observations":[{"actual":[["a1",1],["a1",2]],"check":"quota per group","expected":[["a1",1],["a1",2],["b1",4],["b1",5]],"passed":false},{"actual":[],"check":"zero quota","expected":[],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[["a1",1]],"check":"one per group","expected":[["a1",1],["b1",4]],"passed":false},{"actual":[["a1",1],["b1",2]],"check":"quota beyond group","expected":[["a1",1],["b1",2]],"passed":true},{"actual":[["a1",1]],"check":"interleaved retains order","expected":[["a1",1],["b1",2]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"quota per group\", \"actual\": [[\"a1\", 1], [\"a1\", 2]], \"expected\": [[\"a1\", 1], [\"a1\", 2], [\"b1\", 4], [\"b1\", 5]], \"passed\": false}, {\"check\": \"zero quota\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"one per group\", \"actual\": [[\"a1\", 1]], \"expected\": [[\"a1\", 1], [\"b1\", 4]], \"passed\": false}, {\"check\": \"quota beyond group\", \"actual\": [[\"a1\", 1], [\"b1\", 2]], \"expected\": [[\"a1\", 1], [\"b1\", 2]], \"passed\": true}, {\"check\": \"interleaved retains order\", \"actual\": [[\"a1\", 1]], \"expected\": [[\"a1\", 1], [\"b1\", 2]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":30.071,"exit_code":1,"observations":[{"actual":[["a1",1],["a1",2]],"check":"quota per group","expected":[["a1",1],["a1",2],["b1",4],["b1",5]],"passed":false},{"actual":[],"check":"zero quota","expected":[],"passed":true},{"actual":[],"check":"empty","expected":[],"passed":true},{"actual":[["a1",1]],"check":"one per group","expected":[["a1",1],["b1",4]],"passed":false},{"actual":[["a1",1],["b1",2]],"check":"quota beyond group","expected":[["a1",1],["b1",2]],"passed":true},{"actual":[["a1",1]],"check":"interleaved retains order","expected":[["a1",1],["b1",2]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"quota per group\", \"actual\": [[\"a1\", 1], [\"a1\", 2]], \"expected\": [[\"a1\", 1], [\"a1\", 2], [\"b1\", 4], [\"b1\", 5]], \"passed\": false}, {\"check\": \"zero quota\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"one per group\", \"actual\": [[\"a1\", 1]], \"expected\": [[\"a1\", 1], [\"b1\", 4]], \"passed\": false}, {\"check\": \"quota beyond group\", \"actual\": [[\"a1\", 1], [\"b1\", 2]], \"expected\": [[\"a1\", 1], [\"b1\", 2]], \"passed\": true}, {\"check\": \"interleaved retains order\", \"actual\": [[\"a1\", 1]], \"expected\": [[\"a1\", 1], [\"b1\", 2]], \"passed\": false}], \"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."}}