FAILURE MAP
← Case archive

FA-97521 / Knitting and sewing pattern grading / Open access

Sewing pattern grade rule stepper: downward grading sign · case 01

Grading a pattern down makes it bigger.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Increments are always added, even when grading to smaller sizes.

VERIFIED REPAIR

Multiply the increment by the step direction.

Unsuccessful approach: Going down with only the small increment ignores the size break.

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 = min(k, k + step)
        inc = small if SIZES[lo] < brk else large
        m += 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: downward grading sign', [14, 10, '96', 5, 6, 16], [86.0, 21.5]],
  ['repair check: downward grading sign', [22, 16, '88', 4, 7, 16], [67.0, 16.8]],
  ['generated control 1', [12, 22, '92.5', 4, 7, 16], [121.5, 30.4]],
  ['generated control 2', [6, 12, '100', 4, 7, 12], [112.0, 28.0]],
  ['generated control 3', [6, 18, '88', 4, 6, 14], [116.0, 29.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: downward grading sign', [14, 8, '88', 5, 7, 14], [73.0, 18.3]],
  ['repair check: downward grading sign', [22, 14, '100', 4, 7, 16], [75.0, 18.8]],
  ['generated control 1', [10, 6, '96', 5, 6, 12], [86.0, 21.5]],
  ['generated control 2', [10, 20, '96', 5, 6, 12], [125.0, 31.3]],
  ['generated control 3', [14, 16, '88', 4, 6, 16], [92.0, 23.0]]],
 [['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: downward grading sign', [14, 8, '96', 4, 6, 12], [82.0, 20.5]],
  ['repair check: downward grading sign', [20, 6, '96', 5, 7, 16], [57.0, 14.3]],
  ['generated control 1', [14, 22, '92.5', 4, 7, 16], [117.5, 29.4]],
  ['generated control 2', [14, 16, '88', 4, 6, 14], [94.0, 23.5]],
  ['generated control 3', [22, 22, '100', 4, 6, 14], [100.0, 25.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: downward grading sign', [18, 8, '96', 5, 7, 14], [67.0, 16.8]],
  ['repair check: downward grading sign', [20, 12, '96', 5, 7, 12], [68.0, 17.0]],
  ['generated control 1', [14, 16, '100', 5, 6, 18], [105.0, 26.3]],
  ['generated control 2', [22, 6, '100', 4, 6, 16], [62.0, 15.5]],
  ['generated control 3', [18, 24, '100', 5, 7, 12], '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]],
  ['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
  ['regression: downward grading sign', [22, 8, '92.5', 5, 7, 12], [47.5, 11.9]],
  ['repair check: downward grading sign', [16, 12, '88', 4, 7, 14], [77.0, 19.3]],
  ['generated control 1', [12, 24, '96', 5, 6, 16], 'error: size'],
  ['generated control 2', [18, 18, '100', 4, 7, 16], [100.0, 25.0]],
  ['generated control 3', [14, 22, '88', 5, 6, 16], [111.0, 27.8]]]]
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 fixtureActualExpectedOutcome
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[127.0, 31.8][93.0, 23.3]Failed
regression: downward grading sign[106.0, 26.5][86.0, 21.5]Failed
repair check: downward grading sign[109.0, 27.3][67.0, 16.8]Failed
generated control 1[121.5, 30.4][121.5, 30.4]Passed
generated control 2[112.0, 28.0][112.0, 28.0]Passed
generated control 3[116.0, 29.0][116.0, 29.0]Passed

SHA-256 / 5e0d6529a33595cbacf4a5a3662a5a5295a1dd5843a438a2d1821812816b1b86

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 = min(k, k + step)
        inc = small if SIZES[lo] < brk else large
        m += inc if j > i else -small
        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: downward grading sign', [14, 10, '96', 5, 6, 16], [86.0, 21.5]],
  ['repair check: downward grading sign', [22, 16, '88', 4, 7, 16], [67.0, 16.8]],
  ['generated control 1', [12, 22, '92.5', 4, 7, 16], [121.5, 30.4]],
  ['generated control 2', [6, 12, '100', 4, 7, 12], [112.0, 28.0]],
  ['generated control 3', [6, 18, '88', 4, 6, 14], [116.0, 29.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: downward grading sign', [14, 8, '88', 5, 7, 14], [73.0, 18.3]],
  ['repair check: downward grading sign', [22, 14, '100', 4, 7, 16], [75.0, 18.8]],
  ['generated control 1', [10, 6, '96', 5, 6, 12], [86.0, 21.5]],
  ['generated control 2', [10, 20, '96', 5, 6, 12], [125.0, 31.3]],
  ['generated control 3', [14, 16, '88', 4, 6, 16], [92.0, 23.0]]],
 [['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: downward grading sign', [14, 8, '96', 4, 6, 12], [82.0, 20.5]],
  ['repair check: downward grading sign', [20, 6, '96', 5, 7, 16], [57.0, 14.3]],
  ['generated control 1', [14, 22, '92.5', 4, 7, 16], [117.5, 29.4]],
  ['generated control 2', [14, 16, '88', 4, 6, 14], [94.0, 23.5]],
  ['generated control 3', [22, 22, '100', 4, 6, 14], [100.0, 25.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: downward grading sign', [18, 8, '96', 5, 7, 14], [67.0, 16.8]],
  ['repair check: downward grading sign', [20, 12, '96', 5, 7, 12], [68.0, 17.0]],
  ['generated control 1', [14, 16, '100', 5, 6, 18], [105.0, 26.3]],
  ['generated control 2', [22, 6, '100', 4, 6, 16], [62.0, 15.5]],
  ['generated control 3', [18, 24, '100', 5, 7, 12], '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]],
  ['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
  ['regression: downward grading sign', [22, 8, '92.5', 5, 7, 12], [47.5, 11.9]],
  ['repair check: downward grading sign', [16, 12, '88', 4, 7, 14], [77.0, 19.3]],
  ['generated control 1', [12, 24, '96', 5, 6, 16], 'error: size'],
  ['generated control 2', [18, 18, '100', 4, 7, 16], [100.0, 25.0]],
  ['generated control 3', [14, 22, '88', 5, 6, 16], [111.0, 27.8]]]]
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 fixtureActualExpectedOutcome
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[95.0, 23.8][93.0, 23.3]Failed
regression: downward grading sign[86.0, 21.5][86.0, 21.5]Passed
repair check: downward grading sign[76.0, 19.0][67.0, 16.8]Failed
generated control 1[121.5, 30.4][121.5, 30.4]Passed
generated control 2[112.0, 28.0][112.0, 28.0]Passed
generated control 3[116.0, 29.0][116.0, 29.0]Passed

SHA-256 / e1a2d8c3e9152171c6b37e7fc1b142018dc6d6286c34f7984970f1b8b2fb2dbe

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: downward grading sign', [14, 10, '96', 5, 6, 16], [86.0, 21.5]],
  ['repair check: downward grading sign', [22, 16, '88', 4, 7, 16], [67.0, 16.8]],
  ['generated control 1', [12, 22, '92.5', 4, 7, 16], [121.5, 30.4]],
  ['generated control 2', [6, 12, '100', 4, 7, 12], [112.0, 28.0]],
  ['generated control 3', [6, 18, '88', 4, 6, 14], [116.0, 29.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: downward grading sign', [14, 8, '88', 5, 7, 14], [73.0, 18.3]],
  ['repair check: downward grading sign', [22, 14, '100', 4, 7, 16], [75.0, 18.8]],
  ['generated control 1', [10, 6, '96', 5, 6, 12], [86.0, 21.5]],
  ['generated control 2', [10, 20, '96', 5, 6, 12], [125.0, 31.3]],
  ['generated control 3', [14, 16, '88', 4, 6, 16], [92.0, 23.0]]],
 [['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: downward grading sign', [14, 8, '96', 4, 6, 12], [82.0, 20.5]],
  ['repair check: downward grading sign', [20, 6, '96', 5, 7, 16], [57.0, 14.3]],
  ['generated control 1', [14, 22, '92.5', 4, 7, 16], [117.5, 29.4]],
  ['generated control 2', [14, 16, '88', 4, 6, 14], [94.0, 23.5]],
  ['generated control 3', [22, 22, '100', 4, 6, 14], [100.0, 25.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: downward grading sign', [18, 8, '96', 5, 7, 14], [67.0, 16.8]],
  ['repair check: downward grading sign', [20, 12, '96', 5, 7, 12], [68.0, 17.0]],
  ['generated control 1', [14, 16, '100', 5, 6, 18], [105.0, 26.3]],
  ['generated control 2', [22, 6, '100', 4, 6, 16], [62.0, 15.5]],
  ['generated control 3', [18, 24, '100', 5, 7, 12], '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]],
  ['down across the break', [20, 14, '110', 5, 6, 16], [93.0, 23.3]],
  ['regression: downward grading sign', [22, 8, '92.5', 5, 7, 12], [47.5, 11.9]],
  ['repair check: downward grading sign', [16, 12, '88', 4, 7, 14], [77.0, 19.3]],
  ['generated control 1', [12, 24, '96', 5, 6, 16], 'error: size'],
  ['generated control 2', [18, 18, '100', 4, 7, 16], [100.0, 25.0]],
  ['generated control 3', [14, 22, '88', 5, 6, 16], [111.0, 27.8]]]]
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 fixtureActualExpectedOutcome
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: downward grading sign[86.0, 21.5][86.0, 21.5]Passed
repair check: downward grading sign[67.0, 16.8][67.0, 16.8]Passed
generated control 1[121.5, 30.4][121.5, 30.4]Passed
generated control 2[112.0, 28.0][112.0, 28.0]Passed
generated control 3[116.0, 29.0][116.0, 29.0]Passed

SHA-256 / b97a85c9b3b61a3fb9e9b3367184f67e5aa484a43ab292f232377bab61ef5083

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.007441+00:00.

Case digest / 9127947e5f0ed5218fce3510cb1bdca5907c81178e43b53832e42549aee921fd