FA-97606 / Knitting and sewing pattern grading / Open access
Quilt binding strip planner: finishing tail · case 01
The binding exactly matches the perimeter, leaving nothing to join the ends.
ROOT CAUSE
The tail allowance for joining the ends is not added.
VERIFIED REPAIR
Need perimeter plus tail.
Unsuccessful approach: Half the tail is not enough to join the ends.
Case contract
Usable strip length = fabric_width - 2*selvage. Joining n strips with diagonal seams loses strip_width per join (n-1 joins). Need perimeter + tail. n is the smallest count with n*usable - (n-1)*strip_width >= need. Return [n, fabric cut length n*strip_width, surplus]; usable <= strip_width -> "error: fabric too narrow".
Why this case matters
Quilters cut width-of-fabric strips and join them diagonally to bind the quilt edge.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(perimeter, strip_width, fabric_width, selvage, tail):
usable = fabric_width - 2 * selvage
if usable <= strip_width:
return 'error: fabric too narrow'
need = perimeter
def length(n):
return n * usable - (n - 1) * strip_width
n = 1
while length(n) < need:
n += 1
return [n, n * strip_width, length(n) - need]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: finishing tail', [150, 5, 107, 2, 20], [2, 10, 31]],
['repair check: finishing tail', [420, 4, 110, 2, 20], [5, 20, 74]],
['generated control 1', [150, 6, 150, 1, 30], [2, 12, 110]],
['generated control 2', [150, 6.5, 150, 0, 0], [1, 6.5, 0.0]],
['generated control 3', [150, 4, 107, 2, 0], [2, 8, 52]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: finishing tail', [420, 4, 150, 1, 30], [4, 16, 130]],
['repair check: finishing tail', [420, 5, 140, 2, 30], [4, 20, 79]],
['generated control 1', [350, 4, 110, 1, 20], [4, 16, 50]],
['generated control 2', [350, 5, 107, 1, 25], [4, 20, 30]],
['generated control 3', [280, 6, 110, 1, 20], [3, 18, 12]]],
[['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['regression: finishing tail', [150, 6, 107, 0, 20], [2, 12, 38]],
['repair check: finishing tail', [350, 6.5, 140, 1, 20], [3, 19.5, 31.0]],
['generated control 1', [600, 6, 110, 1, 25], [7, 42, 95]],
['generated control 2', [150, 6.5, 110, 2, 0], [2, 13.0, 55.5]],
['generated control 3', [600, 4, 150, 0, 30], [5, 20, 104]]],
[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: finishing tail', [280, 4, 150, 2, 20], [3, 12, 130]],
['repair check: finishing tail', [420, 6.5, 107, 2, 25], [5, 32.5, 44.0]],
['generated control 1', [200, 6.5, 150, 2, 0], [2, 13.0, 85.5]],
['generated control 2', [420, 5, 150, 1, 0], [3, 15, 14]],
['generated control 3', [200, 6.5, 107, 2, 30], [3, 19.5, 66.0]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: finishing tail', [350, 4, 107, 2, 20], [4, 16, 30]],
['repair check: finishing tail', [420, 6.5, 140, 0, 25], [4, 26.0, 95.5]],
['generated control 1', [350, 5, 140, 1, 0], [3, 15, 54]],
['generated control 2', [600, 6.5, 110, 2, 20], [7, 45.5, 83.0]],
['generated control 3', [150, 5, 140, 1, 20], [2, 10, 101]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| baby quilt | [3, 18, 32] | [3, 18, 7] | Failed |
| two strips | [2, 12, 10] | [2, 12, 10] | Passed |
| narrow fabric | error: fabric too narrow | error: fabric too narrow | Passed |
| regression: finishing tail | [2, 10, 51] | [2, 10, 31] | Failed |
| repair check: finishing tail | [5, 20, 94] | [5, 20, 74] | Failed |
| generated control 1 | [2, 12, 140] | [2, 12, 110] | Failed |
| generated control 2 | [1, 6.5, 0.0] | [1, 6.5, 0.0] | Passed |
| generated control 3 | [2, 8, 52] | [2, 8, 52] | Passed |
SHA-256 / 92f665cb6d7bcbf574d7918e0a6a7b309d384b35eb821d3add709c73aea8ba53
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(perimeter, strip_width, fabric_width, selvage, tail):
usable = fabric_width - 2 * selvage
if usable <= strip_width:
return 'error: fabric too narrow'
need = perimeter + tail // 2
def length(n):
return n * usable - (n - 1) * strip_width
n = 1
while length(n) < need:
n += 1
return [n, n * strip_width, length(n) - need]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: finishing tail', [150, 5, 107, 2, 20], [2, 10, 31]],
['repair check: finishing tail', [420, 4, 110, 2, 20], [5, 20, 74]],
['generated control 1', [150, 6, 150, 1, 30], [2, 12, 110]],
['generated control 2', [150, 6.5, 150, 0, 0], [1, 6.5, 0.0]],
['generated control 3', [150, 4, 107, 2, 0], [2, 8, 52]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: finishing tail', [420, 4, 150, 1, 30], [4, 16, 130]],
['repair check: finishing tail', [420, 5, 140, 2, 30], [4, 20, 79]],
['generated control 1', [350, 4, 110, 1, 20], [4, 16, 50]],
['generated control 2', [350, 5, 107, 1, 25], [4, 20, 30]],
['generated control 3', [280, 6, 110, 1, 20], [3, 18, 12]]],
[['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['regression: finishing tail', [150, 6, 107, 0, 20], [2, 12, 38]],
['repair check: finishing tail', [350, 6.5, 140, 1, 20], [3, 19.5, 31.0]],
['generated control 1', [600, 6, 110, 1, 25], [7, 42, 95]],
['generated control 2', [150, 6.5, 110, 2, 0], [2, 13.0, 55.5]],
['generated control 3', [600, 4, 150, 0, 30], [5, 20, 104]]],
[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: finishing tail', [280, 4, 150, 2, 20], [3, 12, 130]],
['repair check: finishing tail', [420, 6.5, 107, 2, 25], [5, 32.5, 44.0]],
['generated control 1', [200, 6.5, 150, 2, 0], [2, 13.0, 85.5]],
['generated control 2', [420, 5, 150, 1, 0], [3, 15, 14]],
['generated control 3', [200, 6.5, 107, 2, 30], [3, 19.5, 66.0]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: finishing tail', [350, 4, 107, 2, 20], [4, 16, 30]],
['repair check: finishing tail', [420, 6.5, 140, 0, 25], [4, 26.0, 95.5]],
['generated control 1', [350, 5, 140, 1, 0], [3, 15, 54]],
['generated control 2', [600, 6.5, 110, 2, 20], [7, 45.5, 83.0]],
['generated control 3', [150, 5, 140, 1, 20], [2, 10, 101]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| baby quilt | [3, 18, 20] | [3, 18, 7] | Failed |
| two strips | [2, 12, 10] | [2, 12, 10] | Passed |
| narrow fabric | error: fabric too narrow | error: fabric too narrow | Passed |
| regression: finishing tail | [2, 10, 41] | [2, 10, 31] | Failed |
| repair check: finishing tail | [5, 20, 84] | [5, 20, 74] | Failed |
| generated control 1 | [2, 12, 125] | [2, 12, 110] | Failed |
| generated control 2 | [1, 6.5, 0.0] | [1, 6.5, 0.0] | Passed |
| generated control 3 | [2, 8, 52] | [2, 8, 52] | Passed |
SHA-256 / c05e0b56fa08a90f5b03bb162e3bff875b62e8ed827dff8317033123cb98ca13
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(perimeter, strip_width, fabric_width, selvage, tail):
usable = fabric_width - 2 * selvage
if usable <= strip_width:
return 'error: fabric too narrow'
need = perimeter + tail
def length(n):
return n * usable - (n - 1) * strip_width
n = 1
while length(n) < need:
n += 1
return [n, n * strip_width, length(n) - need]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: finishing tail', [150, 5, 107, 2, 20], [2, 10, 31]],
['repair check: finishing tail', [420, 4, 110, 2, 20], [5, 20, 74]],
['generated control 1', [150, 6, 150, 1, 30], [2, 12, 110]],
['generated control 2', [150, 6.5, 150, 0, 0], [1, 6.5, 0.0]],
['generated control 3', [150, 4, 107, 2, 0], [2, 8, 52]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: finishing tail', [420, 4, 150, 1, 30], [4, 16, 130]],
['repair check: finishing tail', [420, 5, 140, 2, 30], [4, 20, 79]],
['generated control 1', [350, 4, 110, 1, 20], [4, 16, 50]],
['generated control 2', [350, 5, 107, 1, 25], [4, 20, 30]],
['generated control 3', [280, 6, 110, 1, 20], [3, 18, 12]]],
[['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['regression: finishing tail', [150, 6, 107, 0, 20], [2, 12, 38]],
['repair check: finishing tail', [350, 6.5, 140, 1, 20], [3, 19.5, 31.0]],
['generated control 1', [600, 6, 110, 1, 25], [7, 42, 95]],
['generated control 2', [150, 6.5, 110, 2, 0], [2, 13.0, 55.5]],
['generated control 3', [600, 4, 150, 0, 30], [5, 20, 104]]],
[['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]], ['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['regression: finishing tail', [280, 4, 150, 2, 20], [3, 12, 130]],
['repair check: finishing tail', [420, 6.5, 107, 2, 25], [5, 32.5, 44.0]],
['generated control 1', [200, 6.5, 150, 2, 0], [2, 13.0, 85.5]],
['generated control 2', [420, 5, 150, 1, 0], [3, 15, 14]],
['generated control 3', [200, 6.5, 107, 2, 30], [3, 19.5, 66.0]]],
[['two strips', [196, 6, 110, 2, 0], [2, 12, 10]],
['narrow fabric', [100, 6, 6, 0, 0], 'error: fabric too narrow'],
['baby quilt', [280, 6, 110, 1, 25], [3, 18, 7]],
['regression: finishing tail', [350, 4, 107, 2, 20], [4, 16, 30]],
['repair check: finishing tail', [420, 6.5, 140, 0, 25], [4, 26.0, 95.5]],
['generated control 1', [350, 5, 140, 1, 0], [3, 15, 54]],
['generated control 2', [600, 6.5, 110, 2, 20], [7, 45.5, 83.0]],
['generated control 3', [150, 5, 140, 1, 20], [2, 10, 101]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| baby quilt | [3, 18, 7] | [3, 18, 7] | Passed |
| two strips | [2, 12, 10] | [2, 12, 10] | Passed |
| narrow fabric | error: fabric too narrow | error: fabric too narrow | Passed |
| regression: finishing tail | [2, 10, 31] | [2, 10, 31] | Passed |
| repair check: finishing tail | [5, 20, 74] | [5, 20, 74] | Passed |
| generated control 1 | [2, 12, 110] | [2, 12, 110] | Passed |
| generated control 2 | [1, 6.5, 0.0] | [1, 6.5, 0.0] | Passed |
| generated control 3 | [2, 8, 52] | [2, 8, 52] | Passed |
SHA-256 / 7a6a91adef7246afb18141e380f277a333f2403e5a2ac3117d01d45922d9460d
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:52:33.777692+00:00.
Case digest / 80f7039b875616cca411b9c34d552459a2bbdab13a9913acca6f2912571936a8