{"abstract":"A narrow strap in an 8-stitch cable casts on only selvedge stitches.","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":"A floor of one stitch is not a whole repeat.","family":"w2-knitting_and_sewing_pattern_grading-gauge-cast-on-minimum-one-repeat","id":"FA-97356","implementations":{"attempt":{"sha256":"6fcf085f3ca4f50dd7d5e77818a519bd92f106c14bc06ad0ef8837b6ca2424ff","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(1, 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: minimum one repeat', [3, '24', 8, 3, -2], [14, 3.3]],\n  ['repair check: minimum one repeat', [3, '20', 8, 2, -2], [12, 4.0]],\n  ['generated control 1', [52.5, '20', 6, 2, -5], [100, 48.0]],\n  ['generated control 2', [52.5, '27.5', 6, 1, -2], [140, 50.2]],\n  ['generated control 3', [10, '22', 12, 1, 7.5], [38, 16.4]]],\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: minimum one repeat', [3, '22', 6, 2, -2], [10, 2.7]],\n  ['repair check: minimum one repeat', [3, '24', 6, 1, -2], [8, 2.5]],\n  ['generated control 1', [52.5, '20', 6, 1, -2], [104, 51.0]],\n  ['generated control 2', [3, '16', 1, 3, -2], [8, 1.3]],\n  ['generated control 3', [50, '22', 1, 3, 7.5], [133, 57.7]]],\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: minimum one repeat', [3, '24', 12, 2, -2], [16, 5.0]],\n  ['repair check: minimum one repeat', [3, '18', 12, 0, -2], [12, 6.7]],\n  ['generated control 1', [45, '16', 6, 2, 5], [82, 48.8]],\n  ['generated control 2', [30, '27.5', 4, 1, -5], [70, 24.7]],\n  ['generated control 3', [45, '20', 6, 1, 7.5], [110, 54.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: minimum one repeat', [3, '18', 12, 2, -2], [16, 6.7]],\n  ['repair check: minimum one repeat', [3, '20', 6, 0, -2], [6, 3.0]],\n  ['generated control 1', [3, '22', 4, 3, -5], 'error: bad measurements'],\n  ['generated control 2', [8, '22', 12, 3, -5], [18, 5.5]],\n  ['generated control 3', [10, '22', 2, 3, 10], [50, 20.0]]],\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: minimum one repeat', [3, '18', 12, 1, 0], [14, 6.7]],\n  ['repair check: minimum one repeat', [3, '22', 12, 3, -2], [18, 5.5]],\n  ['generated control 1', [10, '18', 6, 0, 7.5], [30, 16.7]],\n  ['generated control 2', [3, '18', 6, 2, -5], 'error: bad measurements'],\n  ['generated control 3', [52.5, '24', 1, 3, -2], [127, 50.4]]]]\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":"f5bf6759c888f851c4556a0620697fe04f98b667ea434997d75f7b12fa194e20","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 = 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: minimum one repeat', [3, '24', 8, 3, -2], [14, 3.3]],\n  ['repair check: minimum one repeat', [3, '20', 8, 2, -2], [12, 4.0]],\n  ['generated control 1', [52.5, '20', 6, 2, -5], [100, 48.0]],\n  ['generated control 2', [52.5, '27.5', 6, 1, -2], [140, 50.2]],\n  ['generated control 3', [10, '22', 12, 1, 7.5], [38, 16.4]]],\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: minimum one repeat', [3, '22', 6, 2, -2], [10, 2.7]],\n  ['repair check: minimum one repeat', [3, '24', 6, 1, -2], [8, 2.5]],\n  ['generated control 1', [52.5, '20', 6, 1, -2], [104, 51.0]],\n  ['generated control 2', [3, '16', 1, 3, -2], [8, 1.3]],\n  ['generated control 3', [50, '22', 1, 3, 7.5], [133, 57.7]]],\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: minimum one repeat', [3, '24', 12, 2, -2], [16, 5.0]],\n  ['repair check: minimum one repeat', [3, '18', 12, 0, -2], [12, 6.7]],\n  ['generated control 1', [45, '16', 6, 2, 5], [82, 48.8]],\n  ['generated control 2', [30, '27.5', 4, 1, -5], [70, 24.7]],\n  ['generated control 3', [45, '20', 6, 1, 7.5], [110, 54.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: minimum one repeat', [3, '18', 12, 2, -2], [16, 6.7]],\n  ['repair check: minimum one repeat', [3, '20', 6, 0, -2], [6, 3.0]],\n  ['generated control 1', [3, '22', 4, 3, -5], 'error: bad measurements'],\n  ['generated control 2', [8, '22', 12, 3, -5], [18, 5.5]],\n  ['generated control 3', [10, '22', 2, 3, 10], [50, 20.0]]],\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: minimum one repeat', [3, '18', 12, 1, 0], [14, 6.7]],\n  ['repair check: minimum one repeat', [3, '22', 12, 3, -2], [18, 5.5]],\n  ['generated control 1', [10, '18', 6, 0, 7.5], [30, 16.7]],\n  ['generated control 2', [3, '18', 6, 2, -5], 'error: bad measurements'],\n  ['generated control 3', [52.5, '24', 1, 3, -2], [127, 50.4]]]]\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":"0ea2b21be2310316e26836fb26b8cd593ad569304117525f539b75b6383b2bd5","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: minimum one repeat', [3, '24', 8, 3, -2], [14, 3.3]],\n  ['repair check: minimum one repeat', [3, '20', 8, 2, -2], [12, 4.0]],\n  ['generated control 1', [52.5, '20', 6, 2, -5], [100, 48.0]],\n  ['generated control 2', [52.5, '27.5', 6, 1, -2], [140, 50.2]],\n  ['generated control 3', [10, '22', 12, 1, 7.5], [38, 16.4]]],\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: minimum one repeat', [3, '22', 6, 2, -2], [10, 2.7]],\n  ['repair check: minimum one repeat', [3, '24', 6, 1, -2], [8, 2.5]],\n  ['generated control 1', [52.5, '20', 6, 1, -2], [104, 51.0]],\n  ['generated control 2', [3, '16', 1, 3, -2], [8, 1.3]],\n  ['generated control 3', [50, '22', 1, 3, 7.5], [133, 57.7]]],\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: minimum one repeat', [3, '24', 12, 2, -2], [16, 5.0]],\n  ['repair check: minimum one repeat', [3, '18', 12, 0, -2], [12, 6.7]],\n  ['generated control 1', [45, '16', 6, 2, 5], [82, 48.8]],\n  ['generated control 2', [30, '27.5', 4, 1, -5], [70, 24.7]],\n  ['generated control 3', [45, '20', 6, 1, 7.5], [110, 54.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: minimum one repeat', [3, '18', 12, 2, -2], [16, 6.7]],\n  ['repair check: minimum one repeat', [3, '20', 6, 0, -2], [6, 3.0]],\n  ['generated control 1', [3, '22', 4, 3, -5], 'error: bad measurements'],\n  ['generated control 2', [8, '22', 12, 3, -5], [18, 5.5]],\n  ['generated control 3', [10, '22', 2, 3, 10], [50, 20.0]]],\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: minimum one repeat', [3, '18', 12, 1, 0], [14, 6.7]],\n  ['repair check: minimum one repeat', [3, '22', 12, 3, -2], [18, 5.5]],\n  ['generated control 1', [10, '18', 6, 0, 7.5], [30, 16.7]],\n  ['generated control 2', [3, '18', 6, 2, -5], 'error: bad measurements'],\n  ['generated control 3', [52.5, '24', 1, 3, -2], [127, 50.4]]]]\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-minimum-one-repeat","generated_at":"2026-09-29T14:52:31.410393+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":"Clamp body stitches to at least one repeat.","root_cause":"A zero-repeat rounding result is not raised to one full repeat.","sha256":"5b6d263fb6cc79ce77bb52e2d8de63ddf453c385d95213ff7ceb3172ab5a5278","title":"Gauge-based cast-on calculator: minimum one repeat · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":45.544,"exit_code":1,"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":[7,0.4],"check":"regression: minimum one repeat","expected":[14,3.3],"passed":false},{"actual":[5,0.5],"check":"repair check: minimum one repeat","expected":[12,4.0],"passed":false},{"actual":[100,48.0],"check":"generated control 1","expected":[100,48.0],"passed":true},{"actual":[140,50.2],"check":"generated control 2","expected":[140,50.2],"passed":true},{"actual":[38,16.4],"check":"generated control 3","expected":[38,16.4],"passed":true}],"passed":false,"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: minimum one repeat\", \"actual\": [7, 0.4], \"expected\": [14, 3.3], \"passed\": false}, {\"check\": \"repair check: minimum one repeat\", \"actual\": [5, 0.5], \"expected\": [12, 4.0], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [100, 48.0], \"expected\": [100, 48.0], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [140, 50.2], \"expected\": [140, 50.2], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [38, 16.4], \"expected\": [38, 16.4], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.194,"exit_code":1,"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":[6,0.0],"check":"regression: minimum one repeat","expected":[14,3.3],"passed":false},{"actual":[4,0.0],"check":"repair check: minimum one repeat","expected":[12,4.0],"passed":false},{"actual":[100,48.0],"check":"generated control 1","expected":[100,48.0],"passed":true},{"actual":[140,50.2],"check":"generated control 2","expected":[140,50.2],"passed":true},{"actual":[38,16.4],"check":"generated control 3","expected":[38,16.4],"passed":true}],"passed":false,"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: minimum one repeat\", \"actual\": [6, 0.0], \"expected\": [14, 3.3], \"passed\": false}, {\"check\": \"repair check: minimum one repeat\", \"actual\": [4, 0.0], \"expected\": [12, 4.0], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [100, 48.0], \"expected\": [100, 48.0], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [140, 50.2], \"expected\": [140, 50.2], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [38, 16.4], \"expected\": [38, 16.4], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":46.819,"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":[14,3.3],"check":"regression: minimum one repeat","expected":[14,3.3],"passed":true},{"actual":[12,4.0],"check":"repair check: minimum one repeat","expected":[12,4.0],"passed":true},{"actual":[100,48.0],"check":"generated control 1","expected":[100,48.0],"passed":true},{"actual":[140,50.2],"check":"generated control 2","expected":[140,50.2],"passed":true},{"actual":[38,16.4],"check":"generated control 3","expected":[38,16.4],"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: minimum one repeat\", \"actual\": [14, 3.3], \"expected\": [14, 3.3], \"passed\": true}, {\"check\": \"repair check: minimum one repeat\", \"actual\": [12, 4.0], \"expected\": [12, 4.0], \"passed\": true}, {\"check\": \"generated control 1\", \"actual\": [100, 48.0], \"expected\": [100, 48.0], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [140, 50.2], \"expected\": [140, 50.2], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [38, 16.4], \"expected\": [38, 16.4], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}