{"abstract":"A one-way print piece is turned sideways, putting the nap the wrong way.","category":"Knitting and sewing pattern grading","checks":8,"contract":"Pieces [w, h, qty] (cm; w across the fabric). A piece wider than the fabric is rotated if the fabric is not directional and its height fits, else \"error: piece too wide\". Expand qty, sort by (height, width) descending, then shelf-pack: start a new row when the row width plus the piece would exceed the fabric width; each row is as tall as its tallest piece. Return [length_cm, eighths_of_a_yard] with eighths = ceiling(length/91.44*8).","contract_signature":"pieces, width, directional","evaluation_group":"w2-knitting_and_sewing_pattern_grading-layout-length","failed_approach":"Requiring both conditions still rotates directional pieces that fit sideways.","family":"w2-knitting_and_sewing_pattern_grading-layout-length-nap-rotation","id":"FA-97571","implementations":{"attempt":{"sha256":"c281e2fda5acef2644b2d70bd804d0c0676930bcfa4e156926e7f61cca65fe35","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(pieces, width, directional):\n    items = []\n    for w, h, qty in pieces:\n        for _ in range(qty):\n            if w > width:\n                if directional and h > width:\n                    return 'error: piece too wide'\n                w, h = h, w\n            items.append((h, w))\n    items.sort(reverse=True)\n    length = 0\n    row_w = 0\n    row_h = 0\n    for h, w in items:\n        if row_w + w > width:\n            length += row_h\n            row_w, row_h = 0, 0\n        row_w += w\n        row_h = max(row_h, h)\n    length += row_h\n    return [length, math.ceil(Fraction(length) / Fraction(9144, 100) * 8)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['two pieces one row', [[[70, 60, 2]], 140, False], [60, 6]],\n  ['rotate wide piece', [[[150, 60, 1]], 140, False], [150, 14]],\n  ['directional wide piece', [[[150, 60, 1]], 140, True], 'error: piece too wide'],\n  ['regression: nap rotation', [[[150, 80, 1], [70, 30, 3], [110, 45, 2], [35, 30, 3]], 140, True],\n   'error: piece too wide'],\n  ['repair check: nap rotation', [[[110, 80, 3], [150, 60, 2], [110, 45, 2], [55, 60, 2]], 110, True],\n   'error: piece too wide'],\n  ['generated control 1', [[[35, 80, 1]], 140, False], [80, 7]],\n  ['generated control 2', [[[35, 100, 1], [150, 80, 1]], 140, False], [150, 14]],\n  ['generated control 3', [[[55, 30, 1]], 150, False], [30, 3]]],\n [['rotate wide piece', [[[150, 60, 1]], 140, False], [150, 14]],\n  ['directional wide piece', [[[150, 60, 1]], 140, True], 'error: piece too wide'],\n  ['exact fit row', [[[55, 80, 2], [40, 45, 1]], 150, False], [80, 7]],\n  ['regression: nap rotation', [[[150, 45, 1]], 140, True], 'error: piece too wide'],\n  ['repair check: nap rotation', [[[70, 45, 1], [35, 60, 1], [70, 80, 1], [150, 30, 1]], 110, True],\n   'error: piece too wide'],\n  ['generated control 1', [[[20, 100, 3], [35, 100, 1], [40, 80, 1], [20, 80, 3]], 140, True], [180, 16]],\n  ['generated control 2', [[[35, 80, 2]], 150, False], [80, 7]],\n  ['generated control 3', [[[35, 45, 1], [35, 45, 1]], 140, True], [45, 4]]],\n [['directional wide piece', [[[150, 60, 1]], 140, True], 'error: piece too wide'],\n  ['exact fit row', [[[55, 80, 2], [40, 45, 1]], 150, False], [80, 7]],\n  ['two pieces one row', [[[70, 60, 2]], 140, False], [60, 6]],\n  ['regression: nap rotation', [[[40, 80, 1], [150, 100, 1], [70, 30, 3]], 140, True],\n   'error: piece too wide'],\n  ['repair check: nap rotation', [[[150, 60, 3], [20, 30, 2]], 140, True], 'error: piece too wide'],\n  ['generated control 1', [[[20, 80, 1], [70, 100, 2]], 110, False], [200, 18]],\n  ['generated control 2', [[[70, 80, 3], [35, 100, 1], [55, 100, 2]], 150, False], [260, 23]],\n  ['generated control 3', [[[70, 100, 2], [20, 80, 1]], 150, False], [180, 16]]],\n [['exact fit row', [[[55, 80, 2], [40, 45, 1]], 150, False], [80, 7]],\n  ['two pieces one row', [[[70, 60, 2]], 140, False], [60, 6]],\n  ['rotate wide piece', [[[150, 60, 1]], 140, False], [150, 14]],\n  ['regression: nap rotation', [[[150, 100, 2], [35, 80, 1], [55, 60, 1]], 110, True],\n   'error: piece too wide'],\n  ['repair check: nap rotation', [[[150, 60, 1], [40, 100, 2], [40, 45, 3]], 110, True],\n   'error: piece too wide'],\n  ['generated control 1', [[[40, 80, 3], [20, 60, 1], [35, 30, 3]], 140, True], [110, 10]],\n  ['generated control 2', [[[40, 45, 3], [35, 100, 1]], 110, True], [145, 13]],\n  ['generated control 3', [[[40, 45, 1]], 150, True], [45, 4]]],\n [['two pieces one row', [[[70, 60, 2]], 140, False], [60, 6]],\n  ['rotate wide piece', [[[150, 60, 1]], 140, False], [150, 14]],\n  ['directional wide piece', [[[150, 60, 1]], 140, True], 'error: piece too wide'],\n  ['regression: nap rotation', [[[150, 30, 1], [40, 80, 1], [70, 100, 2]], 140, True],\n   'error: piece too wide'],\n  ['repair check: nap rotation', [[[150, 100, 3], [70, 100, 1], [20, 30, 1], [55, 60, 1]], 110, True],\n   'error: piece too wide'],\n  ['generated control 1', [[[40, 100, 1], [55, 45, 3], [150, 45, 2], [110, 30, 1]], 140, False], [270, 24]],\n  ['generated control 2', [[[55, 100, 3], [70, 60, 1], [35, 45, 2]], 140, False], [245, 22]],\n  ['generated control 3', [[[35, 45, 2]], 140, False], [45, 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":"fb466e15a32bb152eb27ec31163925ae18a71552d29ea640241792778266ac7b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(pieces, width, directional):\n    items = []\n    for w, h, qty in pieces:\n        for _ in range(qty):\n            if w > width:\n                if h > width:\n                    return 'error: piece too wide'\n                w, h = h, w\n            items.append((h, w))\n    items.sort(reverse=True)\n    length = 0\n    row_w = 0\n    row_h = 0\n    for h, w in items:\n        if row_w + w > width:\n            length += row_h\n            row_w, row_h = 0, 0\n        row_w += w\n        row_h = max(row_h, h)\n    length += row_h\n    return [length, math.ceil(Fraction(length) / Fraction(9144, 100) * 8)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['two pieces one row', [[[70, 60, 2]], 140, False], [60, 6]],\n  ['rotate wide piece', [[[150, 60, 1]], 140, False], [150, 14]],\n  ['directional wide piece', [[[150, 60, 1]], 140, True], 'error: piece too wide'],\n  ['regression: nap rotation', [[[150, 80, 1], [70, 30, 3], [110, 45, 2], [35, 30, 3]], 140, True],\n   'error: piece too wide'],\n  ['repair check: nap rotation', [[[110, 80, 3], [150, 60, 2], [110, 45, 2], [55, 60, 2]], 110, True],\n   'error: piece too wide'],\n  ['generated control 1', [[[35, 80, 1]], 140, False], [80, 7]],\n  ['generated control 2', [[[35, 100, 1], [150, 80, 1]], 140, False], [150, 14]],\n  ['generated control 3', [[[55, 30, 1]], 150, False], [30, 3]]],\n [['rotate wide piece', [[[150, 60, 1]], 140, False], [150, 14]],\n  ['directional wide piece', [[[150, 60, 1]], 140, True], 'error: piece too wide'],\n  ['exact fit row', [[[55, 80, 2], [40, 45, 1]], 150, False], [80, 7]],\n  ['regression: nap rotation', [[[150, 45, 1]], 140, True], 'error: piece too wide'],\n  ['repair check: nap rotation', [[[70, 45, 1], [35, 60, 1], [70, 80, 1], [150, 30, 1]], 110, True],\n   'error: piece too wide'],\n  ['generated control 1', [[[20, 100, 3], [35, 100, 1], [40, 80, 1], [20, 80, 3]], 140, True], [180, 16]],\n  ['generated control 2', [[[35, 80, 2]], 150, False], [80, 7]],\n  ['generated control 3', [[[35, 45, 1], [35, 45, 1]], 140, True], [45, 4]]],\n [['directional wide piece', [[[150, 60, 1]], 140, True], 'error: piece too wide'],\n  ['exact fit row', [[[55, 80, 2], [40, 45, 1]], 150, False], [80, 7]],\n  ['two pieces one row', [[[70, 60, 2]], 140, False], [60, 6]],\n  ['regression: nap rotation', [[[40, 80, 1], [150, 100, 1], [70, 30, 3]], 140, True],\n   'error: piece too wide'],\n  ['repair check: nap rotation', [[[150, 60, 3], [20, 30, 2]], 140, True], 'error: piece too wide'],\n  ['generated control 1', [[[20, 80, 1], [70, 100, 2]], 110, False], [200, 18]],\n  ['generated control 2', [[[70, 80, 3], [35, 100, 1], [55, 100, 2]], 150, False], [260, 23]],\n  ['generated control 3', [[[70, 100, 2], [20, 80, 1]], 150, False], [180, 16]]],\n [['exact fit row', [[[55, 80, 2], [40, 45, 1]], 150, False], [80, 7]],\n  ['two pieces one row', [[[70, 60, 2]], 140, False], [60, 6]],\n  ['rotate wide piece', [[[150, 60, 1]], 140, False], [150, 14]],\n  ['regression: nap rotation', [[[150, 100, 2], [35, 80, 1], [55, 60, 1]], 110, True],\n   'error: piece too wide'],\n  ['repair check: nap rotation', [[[150, 60, 1], [40, 100, 2], [40, 45, 3]], 110, True],\n   'error: piece too wide'],\n  ['generated control 1', [[[40, 80, 3], [20, 60, 1], [35, 30, 3]], 140, True], [110, 10]],\n  ['generated control 2', [[[40, 45, 3], [35, 100, 1]], 110, True], [145, 13]],\n  ['generated control 3', [[[40, 45, 1]], 150, True], [45, 4]]],\n [['two pieces one row', [[[70, 60, 2]], 140, False], [60, 6]],\n  ['rotate wide piece', [[[150, 60, 1]], 140, False], [150, 14]],\n  ['directional wide piece', [[[150, 60, 1]], 140, True], 'error: piece too wide'],\n  ['regression: nap rotation', [[[150, 30, 1], [40, 80, 1], [70, 100, 2]], 140, True],\n   'error: piece too wide'],\n  ['repair check: nap rotation', [[[150, 100, 3], [70, 100, 1], [20, 30, 1], [55, 60, 1]], 110, True],\n   'error: piece too wide'],\n  ['generated control 1', [[[40, 100, 1], [55, 45, 3], [150, 45, 2], [110, 30, 1]], 140, False], [270, 24]],\n  ['generated control 2', [[[55, 100, 3], [70, 60, 1], [35, 45, 2]], 140, False], [245, 22]],\n  ['generated control 3', [[[35, 45, 2]], 140, False], [45, 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-layout-length-nap-rotation","generated_at":"2026-09-29T14:52:33.486842+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Pattern envelopes and cutting planners estimate yardage from piece layouts and nap direction.","root_cause":"Directional fabric does not block rotation.","sha256":"c19abd939f300a960637719ffeedc5f4ae8c2ceb74c84c9dd650796d163a5fbf","title":"Cutting layout fabric length: nap rotation · 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":44.976,"exit_code":1,"observations":[{"actual":[60,6],"check":"two pieces one row","expected":[60,6],"passed":true},{"actual":[150,14],"check":"rotate wide piece","expected":[150,14],"passed":true},{"actual":[150,14],"check":"directional wide piece","expected":"error: piece too wide","passed":false},{"actual":[330,29],"check":"regression: nap rotation","expected":"error: piece too wide","passed":false},{"actual":[690,61],"check":"repair check: nap rotation","expected":"error: piece too wide","passed":false},{"actual":[80,7],"check":"generated control 1","expected":[80,7],"passed":true},{"actual":[150,14],"check":"generated control 2","expected":[150,14],"passed":true},{"actual":[30,3],"check":"generated control 3","expected":[30,3],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two pieces one row\", \"actual\": [60, 6], \"expected\": [60, 6], \"passed\": true}, {\"check\": \"rotate wide piece\", \"actual\": [150, 14], \"expected\": [150, 14], \"passed\": true}, {\"check\": \"directional wide piece\", \"actual\": [150, 14], \"expected\": \"error: piece too wide\", \"passed\": false}, {\"check\": \"regression: nap rotation\", \"actual\": [330, 29], \"expected\": \"error: piece too wide\", \"passed\": false}, {\"check\": \"repair check: nap rotation\", \"actual\": [690, 61], \"expected\": \"error: piece too wide\", \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [80, 7], \"expected\": [80, 7], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [150, 14], \"expected\": [150, 14], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [30, 3], \"expected\": [30, 3], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.184,"exit_code":1,"observations":[{"actual":[60,6],"check":"two pieces one row","expected":[60,6],"passed":true},{"actual":[150,14],"check":"rotate wide piece","expected":[150,14],"passed":true},{"actual":[150,14],"check":"directional wide piece","expected":"error: piece too wide","passed":false},{"actual":[330,29],"check":"regression: nap rotation","expected":"error: piece too wide","passed":false},{"actual":[690,61],"check":"repair check: nap rotation","expected":"error: piece too wide","passed":false},{"actual":[80,7],"check":"generated control 1","expected":[80,7],"passed":true},{"actual":[150,14],"check":"generated control 2","expected":[150,14],"passed":true},{"actual":[30,3],"check":"generated control 3","expected":[30,3],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"two pieces one row\", \"actual\": [60, 6], \"expected\": [60, 6], \"passed\": true}, {\"check\": \"rotate wide piece\", \"actual\": [150, 14], \"expected\": [150, 14], \"passed\": true}, {\"check\": \"directional wide piece\", \"actual\": [150, 14], \"expected\": \"error: piece too wide\", \"passed\": false}, {\"check\": \"regression: nap rotation\", \"actual\": [330, 29], \"expected\": \"error: piece too wide\", \"passed\": false}, {\"check\": \"repair check: nap rotation\", \"actual\": [690, 61], \"expected\": \"error: piece too wide\", \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [80, 7], \"expected\": [80, 7], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [150, 14], \"expected\": [150, 14], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [30, 3], \"expected\": [30, 3], \"passed\": true}], \"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."}}