FAILURE MAP
← Case archive

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

Sleeve cap ease checker: adjust target · case 01

Adjustments drive the cap to the maximum allowed ease.

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

ROOT CAUSE

The adjustment targets the upper bound instead of the midpoint.

VERIFIED REPAIR

Target the midpoint of the allowed range.

Unsuccessful approach: Targeting the lower bound leaves caps at the edge.

Case contract

Ease = cap - (front + back armhole). Allowed ease: woven 2.5-4.5, knit 0-1.5, leather 0-0.5 (inclusive; fabric trimmed, lower-case; other -> "error: fabric"). Verdict "too little", "too much" or "ok". Adjustment per side = (midpoint - ease)/2. Return [ease, verdict, adjust] with floats rounded to 2 decimals.

Why this case matters

Set-in sleeves need a fabric-dependent amount of cap ease to ease into the armhole.

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(cap, front, back, fabric):
    R = {'woven': (Fraction(5, 2), Fraction(9, 2)), 'knit': (Fraction(0), Fraction(3, 2)), 'leather': (Fraction(0), Fraction(1, 2))}
    f = fabric.strip().lower()
    if f not in R:
        return 'error: fabric'
    lo, hi = R[f]
    ease = Fraction(cap) - (Fraction(front) + Fraction(back))
    if ease < lo:
        verdict = 'too little'
    elif ease > hi:
        verdict = 'too much'
    else:
        verdict = 'ok'
    adjust = (hi - ease) / 2
    return [round(float(ease), 2), verdict, round(float(adjust), 2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['regression: adjust target', ['46', '24', '23', 'woven'], [-1.0, 'too little', 2.25]],
  ['repair check: adjust target', ['49', '22', '22', 'leather'], [5.0, 'too much', -2.38]],
  ['generated control 1', ['46', '24', '24.5', 'woven'], [-2.5, 'too little', 3.0]],
  ['generated control 2', ['49', '23.5', '24.5', 'Knit '], [1.0, 'ok', -0.12]],
  ['generated control 3', ['46', '24', '24.5', 'leather'], [-2.5, 'too little', 1.38]]],
 [['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['regression: adjust target', ['49', '24', '22', 'knit'], [3.0, 'too much', -1.12]],
  ['repair check: adjust target', ['52', '22', '24.5', 'woven'], [5.5, 'too much', -1.0]],
  ['generated control 1', ['52', '23.5', '22', 'Knit '], [6.5, 'too much', -2.88]],
  ['generated control 2', ['52', '23.5', '24.5', 'woven'], [4.0, 'ok', -0.25]],
  ['generated control 3', ['52', '22', '24.5', 'felt'], 'error: fabric']],
 [['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['regression: adjust target', ['49', '22', '22', 'Knit '], [5.0, 'too much', -2.12]],
  ['repair check: adjust target', ['48', '24', '24.5', 'Knit '], [-0.5, 'too little', 0.62]],
  ['generated control 1', ['52', '22', '23', 'woven'], [7.0, 'too much', -1.75]],
  ['generated control 2', ['50.5', '23.5', '23', 'woven'], [4.0, 'ok', -0.25]],
  ['generated control 3', ['46', '23.5', '24.5', 'knit'], [-2.0, 'too little', 1.38]]],
 [['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['regression: adjust target', ['46', '23.5', '23', 'woven'], [-0.5, 'too little', 2.0]],
  ['repair check: adjust target', ['48', '24', '24.5', 'leather'], [-0.5, 'too little', 0.38]],
  ['generated control 1', ['52', '22', '22', 'felt'], 'error: fabric'],
  ['generated control 2', ['46', '23.5', '24.5', 'felt'], 'error: fabric'],
  ['generated control 3', ['46', '24', '22', 'woven'], [0.0, 'too little', 1.75]]],
 [['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['regression: adjust target', ['52', '23.5', '22', 'woven'], [6.5, 'too much', -1.5]],
  ['repair check: adjust target', ['48', '23.5', '23', 'woven'], [1.5, 'too little', 1.0]],
  ['generated control 1', ['48', '23.5', '24.5', 'leather'], [0.0, 'ok', 0.12]],
  ['generated control 2', ['52', '22', '23', 'leather'], [7.0, 'too much', -3.38]],
  ['generated control 3', ['49', '22', '22', 'felt'], 'error: fabric']]]
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
woven ok[3.0, 'ok', 0.75][3.0, 'ok', 0.25]Failed
knit too much[3.5, 'too much', -1.0][3.5, 'too much', -1.38]Failed
leather at lower bound[0.0, 'ok', 0.25][0.0, 'ok', 0.12]Failed
regression: adjust target[-1.0, 'too little', 2.75][-1.0, 'too little', 2.25]Failed
repair check: adjust target[5.0, 'too much', -2.25][5.0, 'too much', -2.38]Failed
generated control 1[-2.5, 'too little', 3.5][-2.5, 'too little', 3.0]Failed
generated control 2[1.0, 'ok', 0.25][1.0, 'ok', -0.12]Failed
generated control 3[-2.5, 'too little', 1.5][-2.5, 'too little', 1.38]Failed

SHA-256 / 05230667f4ce92beb29a4122406a7b42a71483718f5247f053a0b7e92cfc451f

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(cap, front, back, fabric):
    R = {'woven': (Fraction(5, 2), Fraction(9, 2)), 'knit': (Fraction(0), Fraction(3, 2)), 'leather': (Fraction(0), Fraction(1, 2))}
    f = fabric.strip().lower()
    if f not in R:
        return 'error: fabric'
    lo, hi = R[f]
    ease = Fraction(cap) - (Fraction(front) + Fraction(back))
    if ease < lo:
        verdict = 'too little'
    elif ease > hi:
        verdict = 'too much'
    else:
        verdict = 'ok'
    adjust = (lo - ease) / 2
    return [round(float(ease), 2), verdict, round(float(adjust), 2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['regression: adjust target', ['46', '24', '23', 'woven'], [-1.0, 'too little', 2.25]],
  ['repair check: adjust target', ['49', '22', '22', 'leather'], [5.0, 'too much', -2.38]],
  ['generated control 1', ['46', '24', '24.5', 'woven'], [-2.5, 'too little', 3.0]],
  ['generated control 2', ['49', '23.5', '24.5', 'Knit '], [1.0, 'ok', -0.12]],
  ['generated control 3', ['46', '24', '24.5', 'leather'], [-2.5, 'too little', 1.38]]],
 [['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['regression: adjust target', ['49', '24', '22', 'knit'], [3.0, 'too much', -1.12]],
  ['repair check: adjust target', ['52', '22', '24.5', 'woven'], [5.5, 'too much', -1.0]],
  ['generated control 1', ['52', '23.5', '22', 'Knit '], [6.5, 'too much', -2.88]],
  ['generated control 2', ['52', '23.5', '24.5', 'woven'], [4.0, 'ok', -0.25]],
  ['generated control 3', ['52', '22', '24.5', 'felt'], 'error: fabric']],
 [['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['regression: adjust target', ['49', '22', '22', 'Knit '], [5.0, 'too much', -2.12]],
  ['repair check: adjust target', ['48', '24', '24.5', 'Knit '], [-0.5, 'too little', 0.62]],
  ['generated control 1', ['52', '22', '23', 'woven'], [7.0, 'too much', -1.75]],
  ['generated control 2', ['50.5', '23.5', '23', 'woven'], [4.0, 'ok', -0.25]],
  ['generated control 3', ['46', '23.5', '24.5', 'knit'], [-2.0, 'too little', 1.38]]],
 [['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['regression: adjust target', ['46', '23.5', '23', 'woven'], [-0.5, 'too little', 2.0]],
  ['repair check: adjust target', ['48', '24', '24.5', 'leather'], [-0.5, 'too little', 0.38]],
  ['generated control 1', ['52', '22', '22', 'felt'], 'error: fabric'],
  ['generated control 2', ['46', '23.5', '24.5', 'felt'], 'error: fabric'],
  ['generated control 3', ['46', '24', '22', 'woven'], [0.0, 'too little', 1.75]]],
 [['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['regression: adjust target', ['52', '23.5', '22', 'woven'], [6.5, 'too much', -1.5]],
  ['repair check: adjust target', ['48', '23.5', '23', 'woven'], [1.5, 'too little', 1.0]],
  ['generated control 1', ['48', '23.5', '24.5', 'leather'], [0.0, 'ok', 0.12]],
  ['generated control 2', ['52', '22', '23', 'leather'], [7.0, 'too much', -3.38]],
  ['generated control 3', ['49', '22', '22', 'felt'], 'error: fabric']]]
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
woven ok[3.0, 'ok', -0.25][3.0, 'ok', 0.25]Failed
knit too much[3.5, 'too much', -1.75][3.5, 'too much', -1.38]Failed
leather at lower bound[0.0, 'ok', 0.0][0.0, 'ok', 0.12]Failed
regression: adjust target[-1.0, 'too little', 1.75][-1.0, 'too little', 2.25]Failed
repair check: adjust target[5.0, 'too much', -2.5][5.0, 'too much', -2.38]Failed
generated control 1[-2.5, 'too little', 2.5][-2.5, 'too little', 3.0]Failed
generated control 2[1.0, 'ok', -0.5][1.0, 'ok', -0.12]Failed
generated control 3[-2.5, 'too little', 1.25][-2.5, 'too little', 1.38]Failed

SHA-256 / e60df001eefbd31d1fc339349b0ed8b09772257856300e4a2b440f683d79b3c4

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(cap, front, back, fabric):
    R = {'woven': (Fraction(5, 2), Fraction(9, 2)), 'knit': (Fraction(0), Fraction(3, 2)), 'leather': (Fraction(0), Fraction(1, 2))}
    f = fabric.strip().lower()
    if f not in R:
        return 'error: fabric'
    lo, hi = R[f]
    ease = Fraction(cap) - (Fraction(front) + Fraction(back))
    if ease < lo:
        verdict = 'too little'
    elif ease > hi:
        verdict = 'too much'
    else:
        verdict = 'ok'
    adjust = ((lo + hi) / 2 - ease) / 2
    return [round(float(ease), 2), verdict, round(float(adjust), 2)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['regression: adjust target', ['46', '24', '23', 'woven'], [-1.0, 'too little', 2.25]],
  ['repair check: adjust target', ['49', '22', '22', 'leather'], [5.0, 'too much', -2.38]],
  ['generated control 1', ['46', '24', '24.5', 'woven'], [-2.5, 'too little', 3.0]],
  ['generated control 2', ['49', '23.5', '24.5', 'Knit '], [1.0, 'ok', -0.12]],
  ['generated control 3', ['46', '24', '24.5', 'leather'], [-2.5, 'too little', 1.38]]],
 [['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['regression: adjust target', ['49', '24', '22', 'knit'], [3.0, 'too much', -1.12]],
  ['repair check: adjust target', ['52', '22', '24.5', 'woven'], [5.5, 'too much', -1.0]],
  ['generated control 1', ['52', '23.5', '22', 'Knit '], [6.5, 'too much', -2.88]],
  ['generated control 2', ['52', '23.5', '24.5', 'woven'], [4.0, 'ok', -0.25]],
  ['generated control 3', ['52', '22', '24.5', 'felt'], 'error: fabric']],
 [['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['regression: adjust target', ['49', '22', '22', 'Knit '], [5.0, 'too much', -2.12]],
  ['repair check: adjust target', ['48', '24', '24.5', 'Knit '], [-0.5, 'too little', 0.62]],
  ['generated control 1', ['52', '22', '23', 'woven'], [7.0, 'too much', -1.75]],
  ['generated control 2', ['50.5', '23.5', '23', 'woven'], [4.0, 'ok', -0.25]],
  ['generated control 3', ['46', '23.5', '24.5', 'knit'], [-2.0, 'too little', 1.38]]],
 [['woven lower edge', ['50.5', '24', '24', 'woven'], [2.5, 'ok', 0.5]],
  ['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['regression: adjust target', ['46', '23.5', '23', 'woven'], [-0.5, 'too little', 2.0]],
  ['repair check: adjust target', ['48', '24', '24.5', 'leather'], [-0.5, 'too little', 0.38]],
  ['generated control 1', ['52', '22', '22', 'felt'], 'error: fabric'],
  ['generated control 2', ['46', '23.5', '24.5', 'felt'], 'error: fabric'],
  ['generated control 3', ['46', '24', '22', 'woven'], [0.0, 'too little', 1.75]]],
 [['woven ok', ['50', '23', '24', 'woven'], [3.0, 'ok', 0.25]],
  ['knit too much', ['52', '24', '24.5', 'knit'], [3.5, 'too much', -1.38]],
  ['leather at lower bound', ['46', '23', '23', 'leather'], [0.0, 'ok', 0.12]],
  ['regression: adjust target', ['52', '23.5', '22', 'woven'], [6.5, 'too much', -1.5]],
  ['repair check: adjust target', ['48', '23.5', '23', 'woven'], [1.5, 'too little', 1.0]],
  ['generated control 1', ['48', '23.5', '24.5', 'leather'], [0.0, 'ok', 0.12]],
  ['generated control 2', ['52', '22', '23', 'leather'], [7.0, 'too much', -3.38]],
  ['generated control 3', ['49', '22', '22', 'felt'], 'error: fabric']]]
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
woven ok[3.0, 'ok', 0.25][3.0, 'ok', 0.25]Passed
knit too much[3.5, 'too much', -1.38][3.5, 'too much', -1.38]Passed
leather at lower bound[0.0, 'ok', 0.12][0.0, 'ok', 0.12]Passed
regression: adjust target[-1.0, 'too little', 2.25][-1.0, 'too little', 2.25]Passed
repair check: adjust target[5.0, 'too much', -2.38][5.0, 'too much', -2.38]Passed
generated control 1[-2.5, 'too little', 3.0][-2.5, 'too little', 3.0]Passed
generated control 2[1.0, 'ok', -0.12][1.0, 'ok', -0.12]Passed
generated control 3[-2.5, 'too little', 1.38][-2.5, 'too little', 1.38]Passed

SHA-256 / 2af9c62e806ce0a21b07224aec74385f12d5b3330323822cbc5e1703a9b997b6

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

Case digest / 4a2d03c43115c0abe0337312c37320424cf61122649c848ddc44528b5210324b