{"abstract":"A whole sweater is estimated at a fraction of a gram.","category":"Knitting and sewing pattern grading","checks":8,"contract":"grams = garment_area / swatch_area * swatch_g; meters = grams * skein_m/skein_g; add margin_pct as a multiplier (meters*(1+margin/100)). skeins = ceiling(meters/skein_m); leftover = skeins*skein_m - meters. Return [meters, skeins, leftover] with meters and leftover half-up integers. Non-positive swatch area or skein weight -> \"error: swatch\".","contract_signature":"swatch_g, swatch_w_cm, swatch_h_cm, garment_area_cm2, skein_g, skein_m, margin_pct","evaluation_group":"w2-knitting_and_sewing_pattern_grading-yardage-estimate","failed_approach":"Dividing by width plus height uses the swatch perimeter instead of its area.","family":"w2-knitting_and_sewing_pattern_grading-yardage-estimate-area-ratio","id":"FA-97411","implementations":{"attempt":{"sha256":"34f242d48c1114bd9add1e0fcd757f1f8b973f2648c7e3010a43eabe0f300d06","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(swatch_g, swatch_w_cm, swatch_h_cm, garment_area_cm2, skein_g, skein_m, margin_pct):\n    sw_area = Fraction(str(swatch_w_cm)) * Fraction(str(swatch_h_cm))\n    if sw_area <= 0 or skein_g <= 0:\n        return 'error: swatch'\n    grams = Fraction(str(garment_area_cm2)) / (Fraction(str(swatch_w_cm)) + Fraction(str(swatch_h_cm))) * Fraction(str(swatch_g))\n    meters = grams * Fraction(skein_m, skein_g)\n    meters = meters * (1 + Fraction(margin_pct, 100))\n    skeins = math.ceil(meters / skein_m)\n    leftover = skeins * skein_m - meters\n    return [math.floor(meters + Fraction(1, 2)), skeins, math.floor(leftover + Fraction(1, 2))]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['regression: area ratio', [8, 12, 10, 2400, 100, 125, 15], [230, 2, 20]],\n  ['repair check: area ratio', [10, 12, 15, 2000, 50, 400, 10], [978, 3, 222]],\n  ['generated control 1', [12, 15, 10, 9000, 50, 100, 20], [1728, 18, 72]],\n  ['generated control 2', [20, 12, 15, 2400, 100, 125, 10], [367, 3, 8]],\n  ['generated control 3', [8, 12, 15, 2400, 50, 400, 0], [853, 3, 347]]],\n [['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['regression: area ratio', [15, 10, 15, 6000, 50, 100, 10], [1320, 14, 80]],\n  ['repair check: area ratio', [20, 15, 12, 1500, 100, 200, 15], [383, 2, 17]],\n  ['generated control 1', [12, 15, 10, 1500, 50, 200, 20], [576, 3, 24]],\n  ['generated control 2', [10, 10, 15, 1500, 100, 400, 0], [400, 1, 0]],\n  ['generated control 3', [10, 12, 15, 6000, 50, 100, 20], [800, 8, 0]]],\n [['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['regression: area ratio', [10, 15, 12, 2000, 50, 400, 15], [1022, 3, 178]],\n  ['repair check: area ratio', [8, 12, 15, 2000, 50, 125, 10], [244, 2, 6]],\n  ['generated control 1', [8, 15, 15, 2400, 50, 100, 15], [196, 2, 4]],\n  ['generated control 2', [15, 10, 10, 2000, 50, 200, 20], [1440, 8, 160]],\n  ['generated control 3', [10, 15, 15, 4800, 100, 400, 10], [939, 3, 261]]],\n [['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['regression: area ratio', [20, 15, 12, 2000, 50, 400, 0], [1778, 5, 222]],\n  ['repair check: area ratio', [10, 12, 15, 1500, 50, 100, 10], [183, 2, 17]],\n  ['generated control 1', [15, 10, 12, 2000, 50, 125, 20], [750, 6, 0]],\n  ['generated control 2', [10, 10, 10, 4800, 100, 400, 10], [2112, 6, 288]],\n  ['generated control 3', [15, 10, 12, 2400, 50, 100, 20], [720, 8, 80]]],\n [['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['regression: area ratio', [20, 10, 15, 6000, 50, 125, 15], [2300, 19, 75]],\n  ['repair check: area ratio', [15, 15, 12, 3000, 100, 100, 0], [250, 3, 50]],\n  ['generated control 1', [20, 10, 15, 9000, 50, 150, 10], [3960, 27, 90]],\n  ['generated control 2', [12, 10, 15, 3000, 100, 100, 20], [288, 3, 12]],\n  ['generated control 3', [20, 12, 10, 6000, 50, 200, 0], [4000, 20, 0]]]]\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":"743f630e52e6dfa12d164552d240622a664d64e9ad3288bf28bb64b9fb4ea0f6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(swatch_g, swatch_w_cm, swatch_h_cm, garment_area_cm2, skein_g, skein_m, margin_pct):\n    sw_area = Fraction(str(swatch_w_cm)) * Fraction(str(swatch_h_cm))\n    if sw_area <= 0 or skein_g <= 0:\n        return 'error: swatch'\n    grams = sw_area / Fraction(str(garment_area_cm2)) * Fraction(str(swatch_g))\n    meters = grams * Fraction(skein_m, skein_g)\n    meters = meters * (1 + Fraction(margin_pct, 100))\n    skeins = math.ceil(meters / skein_m)\n    leftover = skeins * skein_m - meters\n    return [math.floor(meters + Fraction(1, 2)), skeins, math.floor(leftover + Fraction(1, 2))]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['regression: area ratio', [8, 12, 10, 2400, 100, 125, 15], [230, 2, 20]],\n  ['repair check: area ratio', [10, 12, 15, 2000, 50, 400, 10], [978, 3, 222]],\n  ['generated control 1', [12, 15, 10, 9000, 50, 100, 20], [1728, 18, 72]],\n  ['generated control 2', [20, 12, 15, 2400, 100, 125, 10], [367, 3, 8]],\n  ['generated control 3', [8, 12, 15, 2400, 50, 400, 0], [853, 3, 347]]],\n [['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['regression: area ratio', [15, 10, 15, 6000, 50, 100, 10], [1320, 14, 80]],\n  ['repair check: area ratio', [20, 15, 12, 1500, 100, 200, 15], [383, 2, 17]],\n  ['generated control 1', [12, 15, 10, 1500, 50, 200, 20], [576, 3, 24]],\n  ['generated control 2', [10, 10, 15, 1500, 100, 400, 0], [400, 1, 0]],\n  ['generated control 3', [10, 12, 15, 6000, 50, 100, 20], [800, 8, 0]]],\n [['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['regression: area ratio', [10, 15, 12, 2000, 50, 400, 15], [1022, 3, 178]],\n  ['repair check: area ratio', [8, 12, 15, 2000, 50, 125, 10], [244, 2, 6]],\n  ['generated control 1', [8, 15, 15, 2400, 50, 100, 15], [196, 2, 4]],\n  ['generated control 2', [15, 10, 10, 2000, 50, 200, 20], [1440, 8, 160]],\n  ['generated control 3', [10, 15, 15, 4800, 100, 400, 10], [939, 3, 261]]],\n [['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['regression: area ratio', [20, 15, 12, 2000, 50, 400, 0], [1778, 5, 222]],\n  ['repair check: area ratio', [10, 12, 15, 1500, 50, 100, 10], [183, 2, 17]],\n  ['generated control 1', [15, 10, 12, 2000, 50, 125, 20], [750, 6, 0]],\n  ['generated control 2', [10, 10, 10, 4800, 100, 400, 10], [2112, 6, 288]],\n  ['generated control 3', [15, 10, 12, 2400, 50, 100, 20], [720, 8, 80]]],\n [['with margin', [12, 10, 12, 4800, 50, 125, 10], [1320, 11, 55]],\n  ['zero swatch', [10, 0, 10, 2000, 100, 200, 0], 'error: swatch'],\n  ['exact two skeins', [10, 10, 10, 2000, 100, 200, 0], [400, 2, 0]],\n  ['regression: area ratio', [20, 10, 15, 6000, 50, 125, 15], [2300, 19, 75]],\n  ['repair check: area ratio', [15, 15, 12, 3000, 100, 100, 0], [250, 3, 50]],\n  ['generated control 1', [20, 10, 15, 9000, 50, 150, 10], [3960, 27, 90]],\n  ['generated control 2', [12, 10, 15, 3000, 100, 100, 20], [288, 3, 12]],\n  ['generated control 3', [20, 12, 10, 6000, 50, 200, 0], [4000, 20, 0]]]]\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":"A deterministic toy contract stated in full here; it is a bounded teaching model, not an authoritative reference or standards implementation. 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-knitting_and_sewing_pattern_grading-yardage-estimate-area-ratio","generated_at":"2026-09-29T14:52:31.917979+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Designers and knitters estimate how many skeins to buy from a weighed swatch.","root_cause":"The swatch-to-garment area ratio is inverted.","sha256":"8e366ba099ec815e5efc012c397a582c14ac40aa63ad9ba2adbc54813f0cf3a3","title":"Yarn yardage estimator: area ratio · 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.62,"exit_code":1,"observations":[{"actual":[2000,10,0],"check":"exact two skeins","expected":[400,2,0],"passed":false},{"actual":[7200,58,50],"check":"with margin","expected":[1320,11,55],"passed":false},{"actual":"error: swatch","check":"zero swatch","expected":"error: swatch","passed":true},{"actual":[1255,11,120],"check":"regression: area ratio","expected":[230,2,20],"passed":false},{"actual":[6519,17,281],"check":"repair check: area ratio","expected":[978,3,222],"passed":false},{"actual":[10368,104,32],"check":"generated control 1","expected":[1728,18,72],"passed":false},{"actual":[2444,20,56],"check":"generated control 2","expected":[367,3,8],"passed":false},{"actual":[5689,15,311],"check":"generated control 3","expected":[853,3,347],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"exact two skeins\", \"actual\": [2000, 10, 0], \"expected\": [400, 2, 0], \"passed\": false}, {\"check\": \"with margin\", \"actual\": [7200, 58, 50], \"expected\": [1320, 11, 55], \"passed\": false}, {\"check\": \"zero swatch\", \"actual\": \"error: swatch\", \"expected\": \"error: swatch\", \"passed\": true}, {\"check\": \"regression: area ratio\", \"actual\": [1255, 11, 120], \"expected\": [230, 2, 20], \"passed\": false}, {\"check\": \"repair check: area ratio\", \"actual\": [6519, 17, 281], \"expected\": [978, 3, 222], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [10368, 104, 32], \"expected\": [1728, 18, 72], \"passed\": false}, {\"check\": \"generated control 2\", \"actual\": [2444, 20, 56], \"expected\": [367, 3, 8], \"passed\": false}, {\"check\": \"generated control 3\", \"actual\": [5689, 15, 311], \"expected\": [853, 3, 347], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.941,"exit_code":1,"observations":[{"actual":[1,1,199],"check":"exact two skeins","expected":[400,2,0],"passed":false},{"actual":[1,1,124],"check":"with margin","expected":[1320,11,55],"passed":false},{"actual":"error: swatch","check":"zero swatch","expected":"error: swatch","passed":true},{"actual":[1,1,124],"check":"regression: area ratio","expected":[230,2,20],"passed":false},{"actual":[8,1,392],"check":"repair check: area ratio","expected":[978,3,222],"passed":false},{"actual":[0,1,100],"check":"generated control 1","expected":[1728,18,72],"passed":false},{"actual":[2,1,123],"check":"generated control 2","expected":[367,3,8],"passed":false},{"actual":[5,1,395],"check":"generated control 3","expected":[853,3,347],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"exact two skeins\", \"actual\": [1, 1, 199], \"expected\": [400, 2, 0], \"passed\": false}, {\"check\": \"with margin\", \"actual\": [1, 1, 124], \"expected\": [1320, 11, 55], \"passed\": false}, {\"check\": \"zero swatch\", \"actual\": \"error: swatch\", \"expected\": \"error: swatch\", \"passed\": true}, {\"check\": \"regression: area ratio\", \"actual\": [1, 1, 124], \"expected\": [230, 2, 20], \"passed\": false}, {\"check\": \"repair check: area ratio\", \"actual\": [8, 1, 392], \"expected\": [978, 3, 222], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [0, 1, 100], \"expected\": [1728, 18, 72], \"passed\": false}, {\"check\": \"generated control 2\", \"actual\": [2, 1, 123], \"expected\": [367, 3, 8], \"passed\": false}, {\"check\": \"generated control 3\", \"actual\": [5, 1, 395], \"expected\": [853, 3, 347], \"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."}}