FAILURE MAP
← Case archive

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

Held-together yarn weight estimator: band threshold · case 01

A yarn at exactly 18 wpi is classed as dk.

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

ROOT CAUSE

Band lower bounds are exclusive.

VERIFIED REPAIR

Use inclusive lower bounds.

Unsuccessful approach: A one-wpi slack pulls 17.x wpi into fingering.

Case contract

Strands held together combine as 1/sqrt(sum(1/wpi^2)), rounded half-up to 0.1. Classify the rounded value: >=30 lace, >=18 fingering, >=14 dk, >=11 worsted, >=8 bulky, else super bulky. Empty -> "error: no strands". Return [wpi, class].

Why this case matters

Knitters hold yarns double to substitute a heavier weight and need the combined wraps per inch.

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(wpis):
    BANDS = [(30, 'lace'), (18, 'fingering'), (14, 'dk'), (11, 'worsted'), (8, 'bulky'), (0, 'super bulky')]
    if not wpis:
        return 'error: no strands'
    eff = 1 / math.sqrt(sum(1 / (w * w) for w in wpis))
    eff = math.floor(eff * 10 + 0.5) / 10
    for lim, name in BANDS:
        if eff > lim:
            return [eff, name]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['empty', [[]], 'error: no strands'], ['regression: band threshold', [[18, 9]], [8.0, 'bulky']],
  ['repair check: band threshold', [[18, 8]], [7.3, 'super bulky']],
  ['generated control 1', [[9]], [9.0, 'bulky']],
  ['generated control 2', [[8, 24, 16]], [6.9, 'super bulky']],
  ['generated control 3', [[18, 16]], [12.0, 'worsted']]],
 [['two dk strands', [[14, 14]], [9.9, 'bulky']], ['empty', [[]], 'error: no strands'],
  ['band edge', [[18]], [18.0, 'fingering']], ['regression: band threshold', [[11]], [11.0, 'worsted']],
  ['repair check: band threshold', [[35, 14, 16]], [10.1, 'bulky']],
  ['generated control 1', [[8, 16, 12]], [6.1, 'super bulky']], ['generated control 2', [[16]], [16.0, 'dk']],
  ['generated control 3', [[11, 16]], [9.1, 'bulky']]],
 [['empty', [[]], 'error: no strands'], ['band edge', [[18]], [18.0, 'fingering']],
  ['single fingering', [[20]], [20.0, 'fingering']], ['regression: band threshold', [[8]], [8.0, 'bulky']],
  ['repair check: band threshold', [[8, 30, 18]], [7.1, 'super bulky']],
  ['generated control 1', [[14, 35, 24]], [11.4, 'worsted']], ['generated control 2', [[16]], [16.0, 'dk']],
  ['generated control 3', [[35]], [35.0, 'lace']]],
 [['band edge', [[18]], [18.0, 'fingering']], ['single fingering', [[20]], [20.0, 'fingering']],
  ['two dk strands', [[14, 14]], [9.9, 'bulky']], ['regression: band threshold', [[8]], [8.0, 'bulky']],
  ['repair check: band threshold', [[24, 8]], [7.6, 'super bulky']],
  ['generated control 1', [[]], 'error: no strands'], ['generated control 2', [[11, 30, 24]], [9.5, 'bulky']],
  ['generated control 3', [[30, 24, 9]], [8.1, 'bulky']]],
 [['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['empty', [[]], 'error: no strands'], ['regression: band threshold', [[11]], [11.0, 'worsted']],
  ['repair check: band threshold', [[30, 11]], [10.3, 'bulky']],
  ['generated control 1', [[16, 30]], [14.1, 'dk']],
  ['generated control 2', [[14, 8, 8]], [5.2, 'super bulky']],
  ['generated control 3', [[20, 9, 12]], [6.8, 'super bulky']]]]
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
single fingering[20.0, 'fingering'][20.0, 'fingering']Passed
two dk strands[9.9, 'bulky'][9.9, 'bulky']Passed
emptyerror: no strandserror: no strandsPassed
regression: band threshold[8.0, 'super bulky'][8.0, 'bulky']Failed
repair check: band threshold[7.3, 'super bulky'][7.3, 'super bulky']Passed
generated control 1[9.0, 'bulky'][9.0, 'bulky']Passed
generated control 2[6.9, 'super bulky'][6.9, 'super bulky']Passed
generated control 3[12.0, 'worsted'][12.0, 'worsted']Passed

SHA-256 / 3b489c9733c5dace476fee2efd4d49e67d8afbfac3218c53d6a73acc4851ceef

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(wpis):
    BANDS = [(30, 'lace'), (18, 'fingering'), (14, 'dk'), (11, 'worsted'), (8, 'bulky'), (0, 'super bulky')]
    if not wpis:
        return 'error: no strands'
    eff = 1 / math.sqrt(sum(1 / (w * w) for w in wpis))
    eff = math.floor(eff * 10 + 0.5) / 10
    for lim, name in BANDS:
        if eff + 1 > lim:
            return [eff, name]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['empty', [[]], 'error: no strands'], ['regression: band threshold', [[18, 9]], [8.0, 'bulky']],
  ['repair check: band threshold', [[18, 8]], [7.3, 'super bulky']],
  ['generated control 1', [[9]], [9.0, 'bulky']],
  ['generated control 2', [[8, 24, 16]], [6.9, 'super bulky']],
  ['generated control 3', [[18, 16]], [12.0, 'worsted']]],
 [['two dk strands', [[14, 14]], [9.9, 'bulky']], ['empty', [[]], 'error: no strands'],
  ['band edge', [[18]], [18.0, 'fingering']], ['regression: band threshold', [[11]], [11.0, 'worsted']],
  ['repair check: band threshold', [[35, 14, 16]], [10.1, 'bulky']],
  ['generated control 1', [[8, 16, 12]], [6.1, 'super bulky']], ['generated control 2', [[16]], [16.0, 'dk']],
  ['generated control 3', [[11, 16]], [9.1, 'bulky']]],
 [['empty', [[]], 'error: no strands'], ['band edge', [[18]], [18.0, 'fingering']],
  ['single fingering', [[20]], [20.0, 'fingering']], ['regression: band threshold', [[8]], [8.0, 'bulky']],
  ['repair check: band threshold', [[8, 30, 18]], [7.1, 'super bulky']],
  ['generated control 1', [[14, 35, 24]], [11.4, 'worsted']], ['generated control 2', [[16]], [16.0, 'dk']],
  ['generated control 3', [[35]], [35.0, 'lace']]],
 [['band edge', [[18]], [18.0, 'fingering']], ['single fingering', [[20]], [20.0, 'fingering']],
  ['two dk strands', [[14, 14]], [9.9, 'bulky']], ['regression: band threshold', [[8]], [8.0, 'bulky']],
  ['repair check: band threshold', [[24, 8]], [7.6, 'super bulky']],
  ['generated control 1', [[]], 'error: no strands'], ['generated control 2', [[11, 30, 24]], [9.5, 'bulky']],
  ['generated control 3', [[30, 24, 9]], [8.1, 'bulky']]],
 [['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['empty', [[]], 'error: no strands'], ['regression: band threshold', [[11]], [11.0, 'worsted']],
  ['repair check: band threshold', [[30, 11]], [10.3, 'bulky']],
  ['generated control 1', [[16, 30]], [14.1, 'dk']],
  ['generated control 2', [[14, 8, 8]], [5.2, 'super bulky']],
  ['generated control 3', [[20, 9, 12]], [6.8, 'super bulky']]]]
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
single fingering[20.0, 'fingering'][20.0, 'fingering']Passed
two dk strands[9.9, 'bulky'][9.9, 'bulky']Passed
emptyerror: no strandserror: no strandsPassed
regression: band threshold[8.0, 'bulky'][8.0, 'bulky']Passed
repair check: band threshold[7.3, 'bulky'][7.3, 'super bulky']Failed
generated control 1[9.0, 'bulky'][9.0, 'bulky']Passed
generated control 2[6.9, 'super bulky'][6.9, 'super bulky']Passed
generated control 3[12.0, 'worsted'][12.0, 'worsted']Passed

SHA-256 / d727f687f07b4d593315909aa9cc2a4fdd0d5f5e5275c87a3a4f59702a05d3c3

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(wpis):
    BANDS = [(30, 'lace'), (18, 'fingering'), (14, 'dk'), (11, 'worsted'), (8, 'bulky'), (0, 'super bulky')]
    if not wpis:
        return 'error: no strands'
    eff = 1 / math.sqrt(sum(1 / (w * w) for w in wpis))
    eff = math.floor(eff * 10 + 0.5) / 10
    for lim, name in BANDS:
        if eff >= lim:
            return [eff, name]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['empty', [[]], 'error: no strands'], ['regression: band threshold', [[18, 9]], [8.0, 'bulky']],
  ['repair check: band threshold', [[18, 8]], [7.3, 'super bulky']],
  ['generated control 1', [[9]], [9.0, 'bulky']],
  ['generated control 2', [[8, 24, 16]], [6.9, 'super bulky']],
  ['generated control 3', [[18, 16]], [12.0, 'worsted']]],
 [['two dk strands', [[14, 14]], [9.9, 'bulky']], ['empty', [[]], 'error: no strands'],
  ['band edge', [[18]], [18.0, 'fingering']], ['regression: band threshold', [[11]], [11.0, 'worsted']],
  ['repair check: band threshold', [[35, 14, 16]], [10.1, 'bulky']],
  ['generated control 1', [[8, 16, 12]], [6.1, 'super bulky']], ['generated control 2', [[16]], [16.0, 'dk']],
  ['generated control 3', [[11, 16]], [9.1, 'bulky']]],
 [['empty', [[]], 'error: no strands'], ['band edge', [[18]], [18.0, 'fingering']],
  ['single fingering', [[20]], [20.0, 'fingering']], ['regression: band threshold', [[8]], [8.0, 'bulky']],
  ['repair check: band threshold', [[8, 30, 18]], [7.1, 'super bulky']],
  ['generated control 1', [[14, 35, 24]], [11.4, 'worsted']], ['generated control 2', [[16]], [16.0, 'dk']],
  ['generated control 3', [[35]], [35.0, 'lace']]],
 [['band edge', [[18]], [18.0, 'fingering']], ['single fingering', [[20]], [20.0, 'fingering']],
  ['two dk strands', [[14, 14]], [9.9, 'bulky']], ['regression: band threshold', [[8]], [8.0, 'bulky']],
  ['repair check: band threshold', [[24, 8]], [7.6, 'super bulky']],
  ['generated control 1', [[]], 'error: no strands'], ['generated control 2', [[11, 30, 24]], [9.5, 'bulky']],
  ['generated control 3', [[30, 24, 9]], [8.1, 'bulky']]],
 [['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['empty', [[]], 'error: no strands'], ['regression: band threshold', [[11]], [11.0, 'worsted']],
  ['repair check: band threshold', [[30, 11]], [10.3, 'bulky']],
  ['generated control 1', [[16, 30]], [14.1, 'dk']],
  ['generated control 2', [[14, 8, 8]], [5.2, 'super bulky']],
  ['generated control 3', [[20, 9, 12]], [6.8, 'super bulky']]]]
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
single fingering[20.0, 'fingering'][20.0, 'fingering']Passed
two dk strands[9.9, 'bulky'][9.9, 'bulky']Passed
emptyerror: no strandserror: no strandsPassed
regression: band threshold[8.0, 'bulky'][8.0, 'bulky']Passed
repair check: band threshold[7.3, 'super bulky'][7.3, 'super bulky']Passed
generated control 1[9.0, 'bulky'][9.0, 'bulky']Passed
generated control 2[6.9, 'super bulky'][6.9, 'super bulky']Passed
generated control 3[12.0, 'worsted'][12.0, 'worsted']Passed

SHA-256 / 69958d45fc1050bd2bbb3ee506899d33e59bfbe2b0f06cf36ef1a62f3992dd51

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

Case digest / b553a18f4da4336de169f8ba15471fb9c98a71ffd0d1526721ba85651cecaeee