FA-97516 / Knitting and sewing pattern grading / Open access
Sewing pattern grade rule stepper: step interval size · case 01
Grading from 14 to 16 uses the large increment though the step starts below the break.
ROOT CAUSE
The increment is chosen from the destination size of each step instead of its lower size.
VERIFIED REPAIR
Use the lower size of the step interval.
Unsuccessful approach: Using the start size is right going up but wrong going down.
Case contract
Sizes 6..22 in steps of 2 (others -> "error: size"). Grading one size step between sizes s and s+2 changes the circumference by `small` cm if the lower size s < brk, else `large`. Going down subtracts the same step amounts. Return [circumference, per quarter-panel = circumference/4], both half-up to 0.1.
Why this case matters
Sewing pattern grading applies different increments above a size break and distributes them across front and back pieces.
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(base_size, target_size, base_cm, small, large, brk):
SIZES = [6, 8, 10, 12, 14, 16, 18, 20, 22]
if base_size not in SIZES or target_size not in SIZES:
return 'error: size'
i, j = SIZES.index(base_size), SIZES.index(target_size)
m = Fraction(str(base_cm))
step = 1 if j > i else -1
k = i
while k != j:
lo = k + step
inc = small if SIZES[lo] < brk else large
m += step * inc
k += step
q = m / 4
return [math.floor(m * 10 + Fraction(1, 2)) / 10, math.floor(q * 10 + Fraction(1, 2)) / 10]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['regression: step interval size', [10, 20, '92.5', 4, 6, 16], [116.5, 29.1]],
['repair check: step interval size', [20, 8, '92.5', 4, 7, 16], [62.5, 15.6]],
['generated control 1', [14, 16, '96', 4, 7, 12], [103.0, 25.8]],
['generated control 2', [18, 16, '100', 5, 7, 16], [93.0, 23.3]],
['generated control 3', [16, 16, '96', 5, 7, 14], [96.0, 24.0]]],
[['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['regression: step interval size', [6, 18, '92.5', 5, 7, 18], [122.5, 30.6]],
['repair check: step interval size', [14, 10, '92.5', 5, 6, 12], [81.5, 20.4]],
['generated control 1', [12, 14, '92.5', 5, 7, 18], [97.5, 24.4]],
['generated control 2', [18, 10, '96', 4, 7, 14], [74.0, 18.5]],
['generated control 3', [16, 14, '88', 4, 6, 14], [82.0, 20.5]]],
[['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['regression: step interval size', [10, 22, '88', 4, 6, 12], [122.0, 30.5]],
['repair check: step interval size', [14, 10, '100', 4, 6, 14], [92.0, 23.0]],
['generated control 1', [6, 6, '88', 4, 7, 14], [88.0, 22.0]],
['generated control 2', [16, 22, '88', 4, 6, 14], [106.0, 26.5]],
['generated control 3', [20, 20, '88', 5, 6, 16], [88.0, 22.0]]],
[['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['regression: step interval size', [10, 22, '88', 5, 7, 12], [128.0, 32.0]],
['repair check: step interval size', [22, 14, '100', 5, 6, 16], [77.0, 19.3]],
['generated control 1', [8, 6, '88', 5, 7, 16], [83.0, 20.8]],
['generated control 2', [16, 20, '100', 5, 7, 14], [114.0, 28.5]],
['generated control 3', [12, 6, '92.5', 5, 7, 14], [77.5, 19.4]]],
[['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['regression: step interval size', [12, 20, '100', 4, 7, 18], [119.0, 29.8]],
['repair check: step interval size', [18, 16, '96', 4, 6, 18], [92.0, 23.0]],
['generated control 1', [10, 16, '100', 5, 6, 14], [116.0, 29.0]],
['generated control 2', [12, 18, '100', 4, 7, 14], [118.0, 29.5]],
['generated control 3', [16, 8, '96', 5, 7, 14], [74.0, 18.5]]]]
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 |
|---|---|---|---|
| same size | [92.5, 23.1] | [92.5, 23.1] | Passed |
| across the break | [114.0, 28.5] | [113.0, 28.3] | Failed |
| down across the break | [93.0, 23.3] | [93.0, 23.3] | Passed |
| regression: step interval size | [118.5, 29.6] | [116.5, 29.1] | Failed |
| repair check: step interval size | [62.5, 15.6] | [62.5, 15.6] | Passed |
| generated control 1 | [103.0, 25.8] | [103.0, 25.8] | Passed |
| generated control 2 | [93.0, 23.3] | [93.0, 23.3] | Passed |
| generated control 3 | [96.0, 24.0] | [96.0, 24.0] | Passed |
SHA-256 / 0897b252d25ee0814b62b5c7316570b6e12f87e4590d6a5a1a31d8c38d8c5f7d
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(base_size, target_size, base_cm, small, large, brk):
SIZES = [6, 8, 10, 12, 14, 16, 18, 20, 22]
if base_size not in SIZES or target_size not in SIZES:
return 'error: size'
i, j = SIZES.index(base_size), SIZES.index(target_size)
m = Fraction(str(base_cm))
step = 1 if j > i else -1
k = i
while k != j:
lo = k
inc = small if SIZES[lo] < brk else large
m += step * inc
k += step
q = m / 4
return [math.floor(m * 10 + Fraction(1, 2)) / 10, math.floor(q * 10 + Fraction(1, 2)) / 10]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['regression: step interval size', [10, 20, '92.5', 4, 6, 16], [116.5, 29.1]],
['repair check: step interval size', [20, 8, '92.5', 4, 7, 16], [62.5, 15.6]],
['generated control 1', [14, 16, '96', 4, 7, 12], [103.0, 25.8]],
['generated control 2', [18, 16, '100', 5, 7, 16], [93.0, 23.3]],
['generated control 3', [16, 16, '96', 5, 7, 14], [96.0, 24.0]]],
[['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['regression: step interval size', [6, 18, '92.5', 5, 7, 18], [122.5, 30.6]],
['repair check: step interval size', [14, 10, '92.5', 5, 6, 12], [81.5, 20.4]],
['generated control 1', [12, 14, '92.5', 5, 7, 18], [97.5, 24.4]],
['generated control 2', [18, 10, '96', 4, 7, 14], [74.0, 18.5]],
['generated control 3', [16, 14, '88', 4, 6, 14], [82.0, 20.5]]],
[['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['regression: step interval size', [10, 22, '88', 4, 6, 12], [122.0, 30.5]],
['repair check: step interval size', [14, 10, '100', 4, 6, 14], [92.0, 23.0]],
['generated control 1', [6, 6, '88', 4, 7, 14], [88.0, 22.0]],
['generated control 2', [16, 22, '88', 4, 6, 14], [106.0, 26.5]],
['generated control 3', [20, 20, '88', 5, 6, 16], [88.0, 22.0]]],
[['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['regression: step interval size', [10, 22, '88', 5, 7, 12], [128.0, 32.0]],
['repair check: step interval size', [22, 14, '100', 5, 6, 16], [77.0, 19.3]],
['generated control 1', [8, 6, '88', 5, 7, 16], [83.0, 20.8]],
['generated control 2', [16, 20, '100', 5, 7, 14], [114.0, 28.5]],
['generated control 3', [12, 6, '92.5', 5, 7, 14], [77.5, 19.4]]],
[['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['regression: step interval size', [12, 20, '100', 4, 7, 18], [119.0, 29.8]],
['repair check: step interval size', [18, 16, '96', 4, 6, 18], [92.0, 23.0]],
['generated control 1', [10, 16, '100', 5, 6, 14], [116.0, 29.0]],
['generated control 2', [12, 18, '100', 4, 7, 14], [118.0, 29.5]],
['generated control 3', [16, 8, '96', 5, 7, 14], [74.0, 18.5]]]]
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 |
|---|---|---|---|
| same size | [92.5, 23.1] | [92.5, 23.1] | Passed |
| across the break | [113.0, 28.3] | [113.0, 28.3] | Passed |
| down across the break | [92.0, 23.0] | [93.0, 23.3] | Failed |
| regression: step interval size | [116.5, 29.1] | [116.5, 29.1] | Passed |
| repair check: step interval size | [59.5, 14.9] | [62.5, 15.6] | Failed |
| generated control 1 | [103.0, 25.8] | [103.0, 25.8] | Passed |
| generated control 2 | [93.0, 23.3] | [93.0, 23.3] | Passed |
| generated control 3 | [96.0, 24.0] | [96.0, 24.0] | Passed |
SHA-256 / 40aaa3a81327074c2028d13d4c46b52d0b32931f141d9d8e416b5e5c6e5f063d
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(base_size, target_size, base_cm, small, large, brk):
SIZES = [6, 8, 10, 12, 14, 16, 18, 20, 22]
if base_size not in SIZES or target_size not in SIZES:
return 'error: size'
i, j = SIZES.index(base_size), SIZES.index(target_size)
m = Fraction(str(base_cm))
step = 1 if j > i else -1
k = i
while k != j:
lo = min(k, k + step)
inc = small if SIZES[lo] < brk else large
m += step * inc
k += step
q = m / 4
return [math.floor(m * 10 + Fraction(1, 2)) / 10, math.floor(q * 10 + Fraction(1, 2)) / 10]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['regression: step interval size', [10, 20, '92.5', 4, 6, 16], [116.5, 29.1]],
['repair check: step interval size', [20, 8, '92.5', 4, 7, 16], [62.5, 15.6]],
['generated control 1', [14, 16, '96', 4, 7, 12], [103.0, 25.8]],
['generated control 2', [18, 16, '100', 5, 7, 16], [93.0, 23.3]],
['generated control 3', [16, 16, '96', 5, 7, 14], [96.0, 24.0]]],
[['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['regression: step interval size', [6, 18, '92.5', 5, 7, 18], [122.5, 30.6]],
['repair check: step interval size', [14, 10, '92.5', 5, 6, 12], [81.5, 20.4]],
['generated control 1', [12, 14, '92.5', 5, 7, 18], [97.5, 24.4]],
['generated control 2', [18, 10, '96', 4, 7, 14], [74.0, 18.5]],
['generated control 3', [16, 14, '88', 4, 6, 14], [82.0, 20.5]]],
[['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['regression: step interval size', [10, 22, '88', 4, 6, 12], [122.0, 30.5]],
['repair check: step interval size', [14, 10, '100', 4, 6, 14], [92.0, 23.0]],
['generated control 1', [6, 6, '88', 4, 7, 14], [88.0, 22.0]],
['generated control 2', [16, 22, '88', 4, 6, 14], [106.0, 26.5]],
['generated control 3', [20, 20, '88', 5, 6, 16], [88.0, 22.0]]],
[['unknown size', [12, 24, '92', 5, 6, 16], 'error: size'],
['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['regression: step interval size', [10, 22, '88', 5, 7, 12], [128.0, 32.0]],
['repair check: step interval size', [22, 14, '100', 5, 6, 16], [77.0, 19.3]],
['generated control 1', [8, 6, '88', 5, 7, 16], [83.0, 20.8]],
['generated control 2', [16, 20, '100', 5, 7, 14], [114.0, 28.5]],
['generated control 3', [12, 6, '92.5', 5, 7, 14], [77.5, 19.4]]],
[['same size', [12, 12, '92.5', 5, 6, 16], [92.5, 23.1]],
['across the break', [14, 20, '96', 5, 6, 16], [113.0, 28.3]],
['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
['regression: step interval size', [12, 20, '100', 4, 7, 18], [119.0, 29.8]],
['repair check: step interval size', [18, 16, '96', 4, 6, 18], [92.0, 23.0]],
['generated control 1', [10, 16, '100', 5, 6, 14], [116.0, 29.0]],
['generated control 2', [12, 18, '100', 4, 7, 14], [118.0, 29.5]],
['generated control 3', [16, 8, '96', 5, 7, 14], [74.0, 18.5]]]]
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 |
|---|---|---|---|
| same size | [92.5, 23.1] | [92.5, 23.1] | Passed |
| across the break | [113.0, 28.3] | [113.0, 28.3] | Passed |
| down across the break | [93.0, 23.3] | [93.0, 23.3] | Passed |
| regression: step interval size | [116.5, 29.1] | [116.5, 29.1] | Passed |
| repair check: step interval size | [62.5, 15.6] | [62.5, 15.6] | Passed |
| generated control 1 | [103.0, 25.8] | [103.0, 25.8] | Passed |
| generated control 2 | [93.0, 23.3] | [93.0, 23.3] | Passed |
| generated control 3 | [96.0, 24.0] | [96.0, 24.0] | Passed |
SHA-256 / 25c4e95d1e1e2838dde710895370ab706a3f79297f8462a234b7cf52f9c92d91
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.008192+00:00.
Case digest / 6503435ff3fd7767b2d463978ed4b4ce3b92bfaf0f2700ddc32e370acb616cc3