{"abstract":"The reported finished width includes selvedge stitches that disappear into seams.","category":"Knitting and sewing pattern grading","checks":8,"contract":"Target width = width + ease (ease may be negative). Raw stitches = target * gauge / 10 (gauge per 10 cm). Body stitches = nearest multiple of repeat, half-up in repeat units, at least one repeat. Cast on = body + 2*edge (selvedge each side). Actual body width = body*10/gauge, half-up to 0.1 cm. Non-positive target, gauge or repeat returns an error string.","evaluation_group":"w2-knitting_and_sewing_pattern_grading-gauge-cast-on","failed_approach":"Removing one selvedge still counts the other side.","family":"w2-knitting_and_sewing_pattern_grading-gauge-cast-on-actual-width-basis","id":"FA-97361","implementations":{"attempt":{"sha256":"253f0f8438f833ae244177ab664bffc95a5571f1be280b5b7096d1b7eebcdde3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(width_cm, sts_per_10cm, repeat, edge, ease_cm):\n    w = Fraction(str(width_cm)) + Fraction(str(ease_cm))\n    g = Fraction(str(sts_per_10cm))\n    if w <= 0 or g <= 0 or repeat < 1:\n        return 'error: bad measurements'\n    raw = w * g / 10\n    body = repeat * math.floor(raw / repeat + Fraction(1, 2))\n    body = max(repeat, body)\n    total = body + 2 * edge\n    actual = (total - edge) * 10 / g\n    return [total, math.floor(actual * 10 + Fraction(1, 2)) / 10]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['regression: actual width basis', [45, '22', 8, 1, 0], [98, 43.6]],\n  ['repair check: actual width basis', [50, '20', 1, 3, 5], [116, 55.0]],\n  ['generated control 1', [52.5, '27.5', 2, 2, 10], [176, 62.5]],\n  ['generated control 2', [50, '24', 8, 1, -5], [114, 46.7]],\n  ['generated control 3', [30, '16', 8, 3, -5], [46, 25.0]]],\n [['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['regression: actual width basis', [3, '18', 6, 1, 7.5], [20, 10.0]],\n  ['repair check: actual width basis', [10, '22', 2, 1, -5], [14, 5.5]],\n  ['generated control 1', [45, '18', 1, 1, -5], [74, 40.0]],\n  ['generated control 2', [8, '24', 8, 0, 7.5], [40, 16.7]],\n  ['generated control 3', [8, '27.5', 6, 2, -5], [10, 2.2]]],\n [['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['regression: actual width basis', [3, '18', 2, 2, 0], [10, 3.3]],\n  ['repair check: actual width basis', [45, '22', 6, 2, -5], [94, 40.9]],\n  ['generated control 1', [30, '16', 4, 0, 5], [56, 35.0]],\n  ['generated control 2', [50, '24', 8, 0, 0], [120, 50.0]],\n  ['generated control 3', [30, '20', 2, 1, -2], [58, 28.0]]],\n [['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['regression: actual width basis', [3, '22', 1, 2, 5], [22, 8.2]],\n  ['repair check: actual width basis', [50, '20', 2, 3, -2], [102, 48.0]],\n  ['generated control 1', [45, '16', 12, 2, -5], [64, 37.5]],\n  ['generated control 2', [10, '27.5', 6, 0, -5], [12, 4.4]],\n  ['generated control 3', [30, '22', 6, 1, -5], [56, 24.5]]],\n [['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['regression: actual width basis', [40, '22', 2, 1, 10], [112, 50.0]],\n  ['repair check: actual width basis', [50, '16', 8, 3, 0], [86, 50.0]],\n  ['generated control 1', [52.5, '27.5', 2, 0, 0], [144, 52.4]],\n  ['generated control 2', [40, '24', 6, 0, -2], [90, 37.5]],\n  ['generated control 3', [40, '18', 8, 1, -5], [66, 35.6]]]]\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":"03307b43e1a58248ee850a5d6ab38cbc9b8a9128fc0509350f332bab37c70a2b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(width_cm, sts_per_10cm, repeat, edge, ease_cm):\n    w = Fraction(str(width_cm)) + Fraction(str(ease_cm))\n    g = Fraction(str(sts_per_10cm))\n    if w <= 0 or g <= 0 or repeat < 1:\n        return 'error: bad measurements'\n    raw = w * g / 10\n    body = repeat * math.floor(raw / repeat + Fraction(1, 2))\n    body = max(repeat, body)\n    total = body + 2 * edge\n    actual = total * 10 / g\n    return [total, math.floor(actual * 10 + Fraction(1, 2)) / 10]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['regression: actual width basis', [45, '22', 8, 1, 0], [98, 43.6]],\n  ['repair check: actual width basis', [50, '20', 1, 3, 5], [116, 55.0]],\n  ['generated control 1', [52.5, '27.5', 2, 2, 10], [176, 62.5]],\n  ['generated control 2', [50, '24', 8, 1, -5], [114, 46.7]],\n  ['generated control 3', [30, '16', 8, 3, -5], [46, 25.0]]],\n [['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['regression: actual width basis', [3, '18', 6, 1, 7.5], [20, 10.0]],\n  ['repair check: actual width basis', [10, '22', 2, 1, -5], [14, 5.5]],\n  ['generated control 1', [45, '18', 1, 1, -5], [74, 40.0]],\n  ['generated control 2', [8, '24', 8, 0, 7.5], [40, 16.7]],\n  ['generated control 3', [8, '27.5', 6, 2, -5], [10, 2.2]]],\n [['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['regression: actual width basis', [3, '18', 2, 2, 0], [10, 3.3]],\n  ['repair check: actual width basis', [45, '22', 6, 2, -5], [94, 40.9]],\n  ['generated control 1', [30, '16', 4, 0, 5], [56, 35.0]],\n  ['generated control 2', [50, '24', 8, 0, 0], [120, 50.0]],\n  ['generated control 3', [30, '20', 2, 1, -2], [58, 28.0]]],\n [['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['regression: actual width basis', [3, '22', 1, 2, 5], [22, 8.2]],\n  ['repair check: actual width basis', [50, '20', 2, 3, -2], [102, 48.0]],\n  ['generated control 1', [45, '16', 12, 2, -5], [64, 37.5]],\n  ['generated control 2', [10, '27.5', 6, 0, -5], [12, 4.4]],\n  ['generated control 3', [30, '22', 6, 1, -5], [56, 24.5]]],\n [['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['regression: actual width basis', [40, '22', 2, 1, 10], [112, 50.0]],\n  ['repair check: actual width basis', [50, '16', 8, 3, 0], [86, 50.0]],\n  ['generated control 1', [52.5, '27.5', 2, 0, 0], [144, 52.4]],\n  ['generated control 2', [40, '24', 6, 0, -2], [90, 37.5]],\n  ['generated control 3', [40, '18', 8, 1, -5], [66, 35.6]]]]\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"},"fixed":{"sha256":"c487def22183aed6a3ef25f59361dc409bba1e1140c00d7e5871884c127c12c3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(width_cm, sts_per_10cm, repeat, edge, ease_cm):\n    w = Fraction(str(width_cm)) + Fraction(str(ease_cm))\n    g = Fraction(str(sts_per_10cm))\n    if w <= 0 or g <= 0 or repeat < 1:\n        return 'error: bad measurements'\n    raw = w * g / 10\n    body = repeat * math.floor(raw / repeat + Fraction(1, 2))\n    body = max(repeat, body)\n    total = body + 2 * edge\n    actual = body * 10 / g\n    return [total, math.floor(actual * 10 + Fraction(1, 2)) / 10]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['regression: actual width basis', [45, '22', 8, 1, 0], [98, 43.6]],\n  ['repair check: actual width basis', [50, '20', 1, 3, 5], [116, 55.0]],\n  ['generated control 1', [52.5, '27.5', 2, 2, 10], [176, 62.5]],\n  ['generated control 2', [50, '24', 8, 1, -5], [114, 46.7]],\n  ['generated control 3', [30, '16', 8, 3, -5], [46, 25.0]]],\n [['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['regression: actual width basis', [3, '18', 6, 1, 7.5], [20, 10.0]],\n  ['repair check: actual width basis', [10, '22', 2, 1, -5], [14, 5.5]],\n  ['generated control 1', [45, '18', 1, 1, -5], [74, 40.0]],\n  ['generated control 2', [8, '24', 8, 0, 7.5], [40, 16.7]],\n  ['generated control 3', [8, '27.5', 6, 2, -5], [10, 2.2]]],\n [['narrow strap one repeat', [3, '16', 8, 2, 0], [12, 5.0]],\n  ['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['regression: actual width basis', [3, '18', 2, 2, 0], [10, 3.3]],\n  ['repair check: actual width basis', [45, '22', 6, 2, -5], [94, 40.9]],\n  ['generated control 1', [30, '16', 4, 0, 5], [56, 35.0]],\n  ['generated control 2', [50, '24', 8, 0, 0], [120, 50.0]],\n  ['generated control 3', [30, '20', 2, 1, -2], [58, 28.0]]],\n [['negative ease', [40, '24', 2, 1, -5], [86, 35.0]],\n  ['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['regression: actual width basis', [3, '22', 1, 2, 5], [22, 8.2]],\n  ['repair check: actual width basis', [50, '20', 2, 3, -2], [102, 48.0]],\n  ['generated control 1', [45, '16', 12, 2, -5], [64, 37.5]],\n  ['generated control 2', [10, '27.5', 6, 0, -5], [12, 4.4]],\n  ['generated control 3', [30, '22', 6, 1, -5], [56, 24.5]]],\n [['invalid width', [3, '20', 2, 0, -5], 'error: bad measurements'],\n  ['plain stockinette', [50, '20', 1, 0, 0], [100, 50.0]],\n  ['rib with selvedges', [45, '22', 4, 1, 5], [114, 50.9]],\n  ['regression: actual width basis', [40, '22', 2, 1, 10], [112, 50.0]],\n  ['repair check: actual width basis', [50, '16', 8, 3, 0], [86, 50.0]],\n  ['generated control 1', [52.5, '27.5', 2, 0, 0], [144, 52.4]],\n  ['generated control 2', [40, '24', 6, 0, -2], [90, 37.5]],\n  ['generated control 3', [40, '18', 8, 1, -5], [66, 35.6]]]]\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-gauge-cast-on-actual-width-basis","generated_at":"2026-09-29T14:52:31.469169+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Knitting patterns and calculators convert a finished measurement and gauge into a stitch count that fits the stitch pattern repeat.","repair":"Compute actual width from body stitches only.","root_cause":"Actual width is computed from the cast-on including selvedges.","sha256":"a07bbd27fbefd57e4d1034f8e6485150c31f4d94841570a63e1af84317bb04f4","title":"Gauge-based cast-on calculator: actual width basis · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":46.017,"exit_code":1,"observations":[{"actual":[100,50.0],"check":"plain stockinette","expected":[100,50.0],"passed":true},{"actual":[114,51.4],"check":"rib with selvedges","expected":[114,50.9],"passed":false},{"actual":[12,6.3],"check":"narrow strap one repeat","expected":[12,5.0],"passed":false},{"actual":[98,44.1],"check":"regression: actual width basis","expected":[98,43.6],"passed":false},{"actual":[116,56.5],"check":"repair check: actual width basis","expected":[116,55.0],"passed":false},{"actual":[176,63.3],"check":"generated control 1","expected":[176,62.5],"passed":false},{"actual":[114,47.1],"check":"generated control 2","expected":[114,46.7],"passed":false},{"actual":[46,26.9],"check":"generated control 3","expected":[46,25.0],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"plain stockinette\", \"actual\": [100, 50.0], \"expected\": [100, 50.0], \"passed\": true}, {\"check\": \"rib with selvedges\", \"actual\": [114, 51.4], \"expected\": [114, 50.9], \"passed\": false}, {\"check\": \"narrow strap one repeat\", \"actual\": [12, 6.3], \"expected\": [12, 5.0], \"passed\": false}, {\"check\": \"regression: actual width basis\", \"actual\": [98, 44.1], \"expected\": [98, 43.6], \"passed\": false}, {\"check\": \"repair check: actual width basis\", \"actual\": [116, 56.5], \"expected\": [116, 55.0], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [176, 63.3], \"expected\": [176, 62.5], \"passed\": false}, {\"check\": \"generated control 2\", \"actual\": [114, 47.1], \"expected\": [114, 46.7], \"passed\": false}, {\"check\": \"generated control 3\", \"actual\": [46, 26.9], \"expected\": [46, 25.0], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":48.829,"exit_code":1,"observations":[{"actual":[100,50.0],"check":"plain stockinette","expected":[100,50.0],"passed":true},{"actual":[114,51.8],"check":"rib with selvedges","expected":[114,50.9],"passed":false},{"actual":[12,7.5],"check":"narrow strap one repeat","expected":[12,5.0],"passed":false},{"actual":[98,44.5],"check":"regression: actual width basis","expected":[98,43.6],"passed":false},{"actual":[116,58.0],"check":"repair check: actual width basis","expected":[116,55.0],"passed":false},{"actual":[176,64.0],"check":"generated control 1","expected":[176,62.5],"passed":false},{"actual":[114,47.5],"check":"generated control 2","expected":[114,46.7],"passed":false},{"actual":[46,28.8],"check":"generated control 3","expected":[46,25.0],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"plain stockinette\", \"actual\": [100, 50.0], \"expected\": [100, 50.0], \"passed\": true}, {\"check\": \"rib with selvedges\", \"actual\": [114, 51.8], \"expected\": [114, 50.9], \"passed\": false}, {\"check\": \"narrow strap one repeat\", \"actual\": [12, 7.5], \"expected\": [12, 5.0], \"passed\": false}, {\"check\": \"regression: actual width basis\", \"actual\": [98, 44.5], \"expected\": [98, 43.6], \"passed\": false}, {\"check\": \"repair check: actual width basis\", \"actual\": [116, 58.0], \"expected\": [116, 55.0], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [176, 64.0], \"expected\": [176, 62.5], \"passed\": false}, {\"check\": \"generated control 2\", \"actual\": [114, 47.5], \"expected\": [114, 46.7], \"passed\": false}, {\"check\": \"generated control 3\", \"actual\": [46, 28.8], \"expected\": [46, 25.0], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":45.332,"exit_code":0,"observations":[{"actual":[100,50.0],"check":"plain stockinette","expected":[100,50.0],"passed":true},{"actual":[114,50.9],"check":"rib with selvedges","expected":[114,50.9],"passed":true},{"actual":[12,5.0],"check":"narrow strap one repeat","expected":[12,5.0],"passed":true},{"actual":[98,43.6],"check":"regression: actual width basis","expected":[98,43.6],"passed":true},{"actual":[116,55.0],"check":"repair check: actual width basis","expected":[116,55.0],"passed":true},{"actual":[176,62.5],"check":"generated control 1","expected":[176,62.5],"passed":true},{"actual":[114,46.7],"check":"generated control 2","expected":[114,46.7],"passed":true},{"actual":[46,25.0],"check":"generated control 3","expected":[46,25.0],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"plain stockinette\", \"actual\": [100, 50.0], \"expected\": [100, 50.0], \"passed\": true}, {\"check\": \"rib with selvedges\", \"actual\": [114, 50.9], \"expected\": [114, 50.9], \"passed\": true}, {\"check\": \"narrow strap one repeat\", \"actual\": [12, 5.0], \"expected\": [12, 5.0], \"passed\": true}, {\"check\": \"regression: actual width basis\", \"actual\": [98, 43.6], \"expected\": [98, 43.6], \"passed\": true}, {\"check\": \"repair check: actual width basis\", \"actual\": [116, 55.0], \"expected\": [116, 55.0], \"passed\": true}, {\"check\": \"generated control 1\", \"actual\": [176, 62.5], \"expected\": [176, 62.5], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [114, 46.7], \"expected\": [114, 46.7], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [46, 25.0], \"expected\": [46, 25.0], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}