FAILURE MAP
← Case archive

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

Sleeve taper decrease schedule: odd difference test · case 01

Going from 53 to 48 stitches is accepted and one stitch vanishes.

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

ROOT CAUSE

Parity is checked on the upper-arm count instead of the difference.

VERIFIED REPAIR

Reject an odd stitch difference.

Unsuccessful approach: Checking the cuff count is just as unrelated to the difference.

Case contract

Top-down sleeve from upper_sts to cuff_sts, decreasing 2 stitches per decrease row within rows rows. Errors: cuff wider ("error: cuff wider than upper arm"), odd difference ("error: odd difference"), rows fewer than decrease rows ("error: not enough rows"). pairs = difference/2; a = rows // pairs; y = rows - a*pairs decreases every a+1 rows, x = pairs-y every a rows. Return [[a, x], [a+1, y]] omitting a zero count; [] for no decreases.

Why this case matters

Pattern writers turn a stitch-count change over a length into "decrease every N rows X times".

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(cuff_sts, upper_sts, rows):
    diff = upper_sts - cuff_sts
    if diff < 0:
        return 'error: cuff wider than upper arm'
    if upper_sts % 2:
        return 'error: odd difference'
    pairs = diff // 2
    if pairs == 0:
        return []
    a = rows // pairs
    if a == 0:
        return 'error: not enough rows'
    y = rows - a * pairs
    x = pairs - y
    plan = []
    if x:
        plan.append([a, x])
    if y:
        plan.append([a + 1, y])
    return plan
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
  ['odd difference', [48, 53, 60], 'error: odd difference'],
  ['regression: odd difference test', [51, 58, 40], 'error: odd difference'],
  ['repair check: odd difference test', [40, 47, 10], 'error: odd difference'],
  ['generated control 1', [60, 68, 5], [[1, 3], [2, 1]]], ['generated control 2', [44, 52, 60], [[15, 4]]],
  ['generated control 3', [56, 68, 10], [[1, 2], [2, 4]]]],
 [['two rates', [44, 60, 90], [[11, 6], [12, 2]]], ['odd difference', [48, 53, 60], 'error: odd difference'],
  ['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['regression: odd difference test', [51, 59, 40], [[10, 4]]],
  ['repair check: odd difference test', [51, 51, 5], []], ['generated control 1', [44, 46, 40], [[40, 1]]],
  ['generated control 2', [40, 60, 40], [[4, 10]]], ['generated control 3', [48, 60, 40], [[6, 2], [7, 4]]]],
 [['odd difference', [48, 53, 60], 'error: odd difference'],
  ['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['regression: odd difference test', [51, 71, 40], [[4, 10]]],
  ['repair check: odd difference test', [48, 55, 40], 'error: odd difference'],
  ['generated control 1', [60, 76, 5], 'error: not enough rows'],
  ['generated control 2', [40, 45, 72], 'error: odd difference'], ['generated control 3', [40, 40, 5], []]],
 [['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['even schedule', [48, 64, 80], [[10, 8]]],
  ['regression: odd difference test', [45, 52, 72], 'error: odd difference'],
  ['repair check: odd difference test', [40, 47, 100], 'error: odd difference'],
  ['generated control 1', [56, 72, 100], [[12, 4], [13, 4]]],
  ['generated control 2', [44, 60, 10], [[1, 6], [2, 2]]], ['generated control 3', [60, 80, 60], [[6, 10]]]],
 [['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
  ['regression: odd difference test', [51, 53, 40], [[40, 1]]],
  ['repair check: odd difference test', [60, 67, 90], 'error: odd difference'],
  ['generated control 1', [44, 60, 60], [[7, 4], [8, 4]]], ['generated control 2', [50, 52, 10], [[10, 1]]],
  ['generated control 3', [48, 60, 10], [[1, 2], [2, 4]]]]]
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
even schedule[[10, 8]][[10, 8]]Passed
two rates[[11, 6], [12, 2]][[11, 6], [12, 2]]Passed
odd differenceerror: odd differenceerror: odd differencePassed
regression: odd difference test[[13, 2], [14, 1]]error: odd differenceFailed
repair check: odd difference testerror: odd differenceerror: odd differencePassed
generated control 1[[1, 3], [2, 1]][[1, 3], [2, 1]]Passed
generated control 2[[15, 4]][[15, 4]]Passed
generated control 3[[1, 2], [2, 4]][[1, 2], [2, 4]]Passed

SHA-256 / b6e49cfb3acf2f8a47876b9241bb4635a50d8c1506e0cccd63a90add7a35475a

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(cuff_sts, upper_sts, rows):
    diff = upper_sts - cuff_sts
    if diff < 0:
        return 'error: cuff wider than upper arm'
    if cuff_sts % 2:
        return 'error: odd difference'
    pairs = diff // 2
    if pairs == 0:
        return []
    a = rows // pairs
    if a == 0:
        return 'error: not enough rows'
    y = rows - a * pairs
    x = pairs - y
    plan = []
    if x:
        plan.append([a, x])
    if y:
        plan.append([a + 1, y])
    return plan
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
  ['odd difference', [48, 53, 60], 'error: odd difference'],
  ['regression: odd difference test', [51, 58, 40], 'error: odd difference'],
  ['repair check: odd difference test', [40, 47, 10], 'error: odd difference'],
  ['generated control 1', [60, 68, 5], [[1, 3], [2, 1]]], ['generated control 2', [44, 52, 60], [[15, 4]]],
  ['generated control 3', [56, 68, 10], [[1, 2], [2, 4]]]],
 [['two rates', [44, 60, 90], [[11, 6], [12, 2]]], ['odd difference', [48, 53, 60], 'error: odd difference'],
  ['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['regression: odd difference test', [51, 59, 40], [[10, 4]]],
  ['repair check: odd difference test', [51, 51, 5], []], ['generated control 1', [44, 46, 40], [[40, 1]]],
  ['generated control 2', [40, 60, 40], [[4, 10]]], ['generated control 3', [48, 60, 40], [[6, 2], [7, 4]]]],
 [['odd difference', [48, 53, 60], 'error: odd difference'],
  ['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['regression: odd difference test', [51, 71, 40], [[4, 10]]],
  ['repair check: odd difference test', [48, 55, 40], 'error: odd difference'],
  ['generated control 1', [60, 76, 5], 'error: not enough rows'],
  ['generated control 2', [40, 45, 72], 'error: odd difference'], ['generated control 3', [40, 40, 5], []]],
 [['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['even schedule', [48, 64, 80], [[10, 8]]],
  ['regression: odd difference test', [45, 52, 72], 'error: odd difference'],
  ['repair check: odd difference test', [40, 47, 100], 'error: odd difference'],
  ['generated control 1', [56, 72, 100], [[12, 4], [13, 4]]],
  ['generated control 2', [44, 60, 10], [[1, 6], [2, 2]]], ['generated control 3', [60, 80, 60], [[6, 10]]]],
 [['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
  ['regression: odd difference test', [51, 53, 40], [[40, 1]]],
  ['repair check: odd difference test', [60, 67, 90], 'error: odd difference'],
  ['generated control 1', [44, 60, 60], [[7, 4], [8, 4]]], ['generated control 2', [50, 52, 10], [[10, 1]]],
  ['generated control 3', [48, 60, 10], [[1, 2], [2, 4]]]]]
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
even schedule[[10, 8]][[10, 8]]Passed
two rates[[11, 6], [12, 2]][[11, 6], [12, 2]]Passed
odd difference[[30, 2]]error: odd differenceFailed
regression: odd difference testerror: odd differenceerror: odd differencePassed
repair check: odd difference test[[3, 2], [4, 1]]error: odd differenceFailed
generated control 1[[1, 3], [2, 1]][[1, 3], [2, 1]]Passed
generated control 2[[15, 4]][[15, 4]]Passed
generated control 3[[1, 2], [2, 4]][[1, 2], [2, 4]]Passed

SHA-256 / 4532dd6984681381964f15b6f378bbaab7df3d83046ba14576d8f1ee5b72f754

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(cuff_sts, upper_sts, rows):
    diff = upper_sts - cuff_sts
    if diff < 0:
        return 'error: cuff wider than upper arm'
    if diff % 2:
        return 'error: odd difference'
    pairs = diff // 2
    if pairs == 0:
        return []
    a = rows // pairs
    if a == 0:
        return 'error: not enough rows'
    y = rows - a * pairs
    x = pairs - y
    plan = []
    if x:
        plan.append([a, x])
    if y:
        plan.append([a + 1, y])
    return plan
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
  ['odd difference', [48, 53, 60], 'error: odd difference'],
  ['regression: odd difference test', [51, 58, 40], 'error: odd difference'],
  ['repair check: odd difference test', [40, 47, 10], 'error: odd difference'],
  ['generated control 1', [60, 68, 5], [[1, 3], [2, 1]]], ['generated control 2', [44, 52, 60], [[15, 4]]],
  ['generated control 3', [56, 68, 10], [[1, 2], [2, 4]]]],
 [['two rates', [44, 60, 90], [[11, 6], [12, 2]]], ['odd difference', [48, 53, 60], 'error: odd difference'],
  ['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['regression: odd difference test', [51, 59, 40], [[10, 4]]],
  ['repair check: odd difference test', [51, 51, 5], []], ['generated control 1', [44, 46, 40], [[40, 1]]],
  ['generated control 2', [40, 60, 40], [[4, 10]]], ['generated control 3', [48, 60, 40], [[6, 2], [7, 4]]]],
 [['odd difference', [48, 53, 60], 'error: odd difference'],
  ['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['regression: odd difference test', [51, 71, 40], [[4, 10]]],
  ['repair check: odd difference test', [48, 55, 40], 'error: odd difference'],
  ['generated control 1', [60, 76, 5], 'error: not enough rows'],
  ['generated control 2', [40, 45, 72], 'error: odd difference'], ['generated control 3', [40, 40, 5], []]],
 [['too few rows', [40, 70, 10], 'error: not enough rows'],
  ['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['even schedule', [48, 64, 80], [[10, 8]]],
  ['regression: odd difference test', [45, 52, 72], 'error: odd difference'],
  ['repair check: odd difference test', [40, 47, 100], 'error: odd difference'],
  ['generated control 1', [56, 72, 100], [[12, 4], [13, 4]]],
  ['generated control 2', [44, 60, 10], [[1, 6], [2, 2]]], ['generated control 3', [60, 80, 60], [[6, 10]]]],
 [['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
  ['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
  ['regression: odd difference test', [51, 53, 40], [[40, 1]]],
  ['repair check: odd difference test', [60, 67, 90], 'error: odd difference'],
  ['generated control 1', [44, 60, 60], [[7, 4], [8, 4]]], ['generated control 2', [50, 52, 10], [[10, 1]]],
  ['generated control 3', [48, 60, 10], [[1, 2], [2, 4]]]]]
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
even schedule[[10, 8]][[10, 8]]Passed
two rates[[11, 6], [12, 2]][[11, 6], [12, 2]]Passed
odd differenceerror: odd differenceerror: odd differencePassed
regression: odd difference testerror: odd differenceerror: odd differencePassed
repair check: odd difference testerror: odd differenceerror: odd differencePassed
generated control 1[[1, 3], [2, 1]][[1, 3], [2, 1]]Passed
generated control 2[[15, 4]][[15, 4]]Passed
generated control 3[[1, 2], [2, 4]][[1, 2], [2, 4]]Passed

SHA-256 / d35d1c04557fc1d20a368284c6f0da03c6ca6bcccef42eed7b254d95dd984756

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

Case digest / 577084361f55c2218dad4a27c611b48523aee005e6056c74672b54a19e5bda0f