{"abstract":"A need of 2.3 skeins buys 2 and the project runs out.","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":"floor+1 buys a spare skein when the need is an exact multiple.","family":"w2-knitting_and_sewing_pattern_grading-yardage-estimate-skein-count","id":"FA-97426","implementations":{"attempt":{"sha256":"e4e18c1125808ff00f0d0d1b99b565906fb5dfca2c37d9273acbfe5b49d3ca2c","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)) / sw_area * Fraction(str(swatch_g))\n    meters = grams * Fraction(skein_m, skein_g)\n    meters = meters * (1 + Fraction(margin_pct, 100))\n    skeins = math.floor(meters / skein_m) + 1\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: skein count', [20, 12, 15, 2000, 100, 125, 0], [278, 3, 97]],\n  ['repair check: skein count', [15, 12, 15, 2400, 100, 100, 0], [200, 2, 0]],\n  ['generated control 1', [12, 10, 15, 6000, 100, 400, 15], [2208, 6, 192]],\n  ['generated control 2', [8, 15, 10, 6000, 50, 100, 0], [640, 7, 60]],\n  ['generated control 3', [8, 10, 10, 2400, 50, 125, 15], [552, 5, 73]]],\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: skein count', [12, 15, 12, 2000, 100, 200, 0], [267, 2, 133]],\n  ['repair check: skein count', [20, 15, 10, 9000, 100, 125, 0], [1500, 12, 0]],\n  ['generated control 1', [10, 10, 12, 6000, 100, 200, 15], [1150, 6, 50]],\n  ['generated control 2', [12, 10, 10, 9000, 50, 100, 15], [2484, 25, 16]],\n  ['generated control 3', [15, 10, 15, 2400, 50, 200, 10], [1056, 6, 144]]],\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: skein count', [12, 15, 12, 1500, 100, 150, 15], [173, 2, 128]],\n  ['repair check: skein count', [20, 10, 10, 3000, 100, 125, 0], [750, 6, 0]],\n  ['generated control 1', [15, 12, 15, 2400, 100, 100, 10], [220, 3, 80]],\n  ['generated control 2', [8, 15, 12, 6000, 50, 125, 0], [667, 6, 83]],\n  ['generated control 3', [8, 10, 10, 9000, 100, 125, 15], [1035, 9, 90]]],\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: skein count', [8, 15, 12, 6000, 50, 400, 20], [2560, 7, 240]],\n  ['repair check: skein count', [20, 10, 10, 6000, 100, 150, 0], [1800, 12, 0]],\n  ['generated control 1', [8, 15, 12, 3000, 50, 400, 10], [1173, 3, 27]],\n  ['generated control 2', [12, 15, 15, 9000, 50, 200, 0], [1920, 10, 80]],\n  ['generated control 3', [15, 10, 10, 2000, 50, 125, 10], [825, 7, 50]]],\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: skein count', [10, 15, 15, 4800, 50, 150, 0], [640, 5, 110]],\n  ['repair check: skein count', [20, 12, 12, 9000, 50, 400, 20], [12000, 30, 0]],\n  ['generated control 1', [15, 15, 15, 4800, 50, 125, 20], [960, 8, 40]],\n  ['generated control 2', [8, 12, 15, 1500, 50, 400, 10], [587, 2, 213]],\n  ['generated control 3', [10, 12, 12, 2400, 50, 200, 10], [733, 4, 67]]]]\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":"25a216e5685e0a0cca6f540c897d11692c3666e16745205eb464ad1f006a2587","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)) / sw_area * Fraction(str(swatch_g))\n    meters = grams * Fraction(skein_m, skein_g)\n    meters = meters * (1 + Fraction(margin_pct, 100))\n    skeins = math.floor(meters / skein_m + Fraction(1, 2))\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: skein count', [20, 12, 15, 2000, 100, 125, 0], [278, 3, 97]],\n  ['repair check: skein count', [15, 12, 15, 2400, 100, 100, 0], [200, 2, 0]],\n  ['generated control 1', [12, 10, 15, 6000, 100, 400, 15], [2208, 6, 192]],\n  ['generated control 2', [8, 15, 10, 6000, 50, 100, 0], [640, 7, 60]],\n  ['generated control 3', [8, 10, 10, 2400, 50, 125, 15], [552, 5, 73]]],\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: skein count', [12, 15, 12, 2000, 100, 200, 0], [267, 2, 133]],\n  ['repair check: skein count', [20, 15, 10, 9000, 100, 125, 0], [1500, 12, 0]],\n  ['generated control 1', [10, 10, 12, 6000, 100, 200, 15], [1150, 6, 50]],\n  ['generated control 2', [12, 10, 10, 9000, 50, 100, 15], [2484, 25, 16]],\n  ['generated control 3', [15, 10, 15, 2400, 50, 200, 10], [1056, 6, 144]]],\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: skein count', [12, 15, 12, 1500, 100, 150, 15], [173, 2, 128]],\n  ['repair check: skein count', [20, 10, 10, 3000, 100, 125, 0], [750, 6, 0]],\n  ['generated control 1', [15, 12, 15, 2400, 100, 100, 10], [220, 3, 80]],\n  ['generated control 2', [8, 15, 12, 6000, 50, 125, 0], [667, 6, 83]],\n  ['generated control 3', [8, 10, 10, 9000, 100, 125, 15], [1035, 9, 90]]],\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: skein count', [8, 15, 12, 6000, 50, 400, 20], [2560, 7, 240]],\n  ['repair check: skein count', [20, 10, 10, 6000, 100, 150, 0], [1800, 12, 0]],\n  ['generated control 1', [8, 15, 12, 3000, 50, 400, 10], [1173, 3, 27]],\n  ['generated control 2', [12, 15, 15, 9000, 50, 200, 0], [1920, 10, 80]],\n  ['generated control 3', [15, 10, 10, 2000, 50, 125, 10], [825, 7, 50]]],\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: skein count', [10, 15, 15, 4800, 50, 150, 0], [640, 5, 110]],\n  ['repair check: skein count', [20, 12, 12, 9000, 50, 400, 20], [12000, 30, 0]],\n  ['generated control 1', [15, 15, 15, 4800, 50, 125, 20], [960, 8, 40]],\n  ['generated control 2', [8, 12, 15, 1500, 50, 400, 10], [587, 2, 213]],\n  ['generated control 3', [10, 12, 12, 2400, 50, 200, 10], [733, 4, 67]]]]\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-skein-count","generated_at":"2026-09-29T14:52:32.100752+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":"Skeins are rounded to the nearest instead of up.","sha256":"28aee9cfc6a7a9e592bed677ee9639a453194e41f6a360c0df746f01877a71c3","title":"Yarn yardage estimator: skein count · 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":43.838,"exit_code":1,"observations":[{"actual":[400,3,200],"check":"exact two skeins","expected":[400,2,0],"passed":false},{"actual":[1320,11,55],"check":"with margin","expected":[1320,11,55],"passed":true},{"actual":"error: swatch","check":"zero swatch","expected":"error: swatch","passed":true},{"actual":[278,3,97],"check":"regression: skein count","expected":[278,3,97],"passed":true},{"actual":[200,3,100],"check":"repair check: skein count","expected":[200,2,0],"passed":false},{"actual":[2208,6,192],"check":"generated control 1","expected":[2208,6,192],"passed":true},{"actual":[640,7,60],"check":"generated control 2","expected":[640,7,60],"passed":true},{"actual":[552,5,73],"check":"generated control 3","expected":[552,5,73],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"exact two skeins\", \"actual\": [400, 3, 200], \"expected\": [400, 2, 0], \"passed\": false}, {\"check\": \"with margin\", \"actual\": [1320, 11, 55], \"expected\": [1320, 11, 55], \"passed\": true}, {\"check\": \"zero swatch\", \"actual\": \"error: swatch\", \"expected\": \"error: swatch\", \"passed\": true}, {\"check\": \"regression: skein count\", \"actual\": [278, 3, 97], \"expected\": [278, 3, 97], \"passed\": true}, {\"check\": \"repair check: skein count\", \"actual\": [200, 3, 100], \"expected\": [200, 2, 0], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [2208, 6, 192], \"expected\": [2208, 6, 192], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [640, 7, 60], \"expected\": [640, 7, 60], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [552, 5, 73], \"expected\": [552, 5, 73], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":47.813,"exit_code":1,"observations":[{"actual":[400,2,0],"check":"exact two skeins","expected":[400,2,0],"passed":true},{"actual":[1320,11,55],"check":"with margin","expected":[1320,11,55],"passed":true},{"actual":"error: swatch","check":"zero swatch","expected":"error: swatch","passed":true},{"actual":[278,2,-28],"check":"regression: skein count","expected":[278,3,97],"passed":false},{"actual":[200,2,0],"check":"repair check: skein count","expected":[200,2,0],"passed":true},{"actual":[2208,6,192],"check":"generated control 1","expected":[2208,6,192],"passed":true},{"actual":[640,6,-40],"check":"generated control 2","expected":[640,7,60],"passed":false},{"actual":[552,4,-52],"check":"generated control 3","expected":[552,5,73],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"exact two skeins\", \"actual\": [400, 2, 0], \"expected\": [400, 2, 0], \"passed\": true}, {\"check\": \"with margin\", \"actual\": [1320, 11, 55], \"expected\": [1320, 11, 55], \"passed\": true}, {\"check\": \"zero swatch\", \"actual\": \"error: swatch\", \"expected\": \"error: swatch\", \"passed\": true}, {\"check\": \"regression: skein count\", \"actual\": [278, 2, -28], \"expected\": [278, 3, 97], \"passed\": false}, {\"check\": \"repair check: skein count\", \"actual\": [200, 2, 0], \"expected\": [200, 2, 0], \"passed\": true}, {\"check\": \"generated control 1\", \"actual\": [2208, 6, 192], \"expected\": [2208, 6, 192], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [640, 6, -40], \"expected\": [640, 7, 60], \"passed\": false}, {\"check\": \"generated control 3\", \"actual\": [552, 4, -52], \"expected\": [552, 5, 73], \"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."}}