FAILURE MAP
← Case archive

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

Held-together yarn weight estimator: strand combination · case 01

Holding two strands together is classified as the same weight as one.

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

ROOT CAUSE

Wraps per inch are averaged instead of combining strand cross-sections.

THE FAILURE

Wraps per inch are averaged instead of combining strand cross-sections.

Unsuccessful approach: Summing reciprocals combines diameters, not areas, and overstates thickness.

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 = sum(wpis) / len(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: strand combination', [[8, 24]], [7.6, 'super bulky']],
  ['repair check: strand combination', [[24, 35]], [19.8, 'fingering']],
  ['generated control 1', [[30]], [30.0, 'lace']], ['generated control 2', [[30, 14, 12]], [8.7, 'bulky']],
  ['generated control 3', [[8, 9]], [6.0, 'super bulky']]],
 [['two dk strands', [[14, 14]], [9.9, 'bulky']], ['empty', [[]], 'error: no strands'],
  ['band edge', [[18]], [18.0, 'fingering']],
  ['regression: strand combination', [[11, 11]], [7.8, 'super bulky']],
  ['repair check: strand combination', [[14, 12]], [9.1, 'bulky']],
  ['generated control 1', [[12]], [12.0, 'worsted']], ['generated control 2', [[24, 12, 12]], [8.0, 'bulky']],
  ['generated control 3', [[35, 12, 35]], [10.8, 'bulky']]],
 [['empty', [[]], 'error: no strands'], ['band edge', [[18]], [18.0, 'fingering']],
  ['single fingering', [[20]], [20.0, 'fingering']],
  ['regression: strand combination', [[24, 12, 12]], [8.0, 'bulky']],
  ['repair check: strand combination', [[24, 35, 12]], [10.3, 'bulky']],
  ['generated control 1', [[14, 14, 8]], [6.2, 'super bulky']],
  ['generated control 2', [[30]], [30.0, 'lace']], ['generated control 3', [[18, 18]], [12.7, 'worsted']]],
 [['band edge', [[18]], [18.0, 'fingering']], ['single fingering', [[20]], [20.0, 'fingering']],
  ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['regression: strand combination', [[14, 30, 14]], [9.4, 'bulky']],
  ['repair check: strand combination', [[9, 8, 11]], [5.3, 'super bulky']],
  ['generated control 1', [[]], 'error: no strands'], ['generated control 2', [[12]], [12.0, 'worsted']],
  ['generated control 3', [[8, 12]], [6.7, 'super bulky']]],
 [['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['empty', [[]], 'error: no strands'], ['regression: strand combination', [[35, 11]], [10.5, 'bulky']],
  ['repair check: strand combination', [[18, 30, 24]], [13.0, 'worsted']],
  ['generated control 1', [[30]], [30.0, 'lace']], ['generated control 2', [[24, 11, 20]], [8.9, 'bulky']],
  ['generated control 3', [[16]], [16.0, 'dk']]]]
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[14.0, 'dk'][9.9, 'bulky']Failed
emptyerror: no strandserror: no strandsPassed
regression: strand combination[16.0, 'dk'][7.6, 'super bulky']Failed
repair check: strand combination[29.5, 'fingering'][19.8, 'fingering']Failed
generated control 1[30.0, 'lace'][30.0, 'lace']Passed
generated control 2[18.7, 'fingering'][8.7, 'bulky']Failed
generated control 3[8.5, 'bulky'][6.0, 'super bulky']Failed

SHA-256 / 426550d73c95a047175c57c85834dadf6b1555782c086d7db65d635a84dc8f1e

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 / sum(1 / 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: strand combination', [[8, 24]], [7.6, 'super bulky']],
  ['repair check: strand combination', [[24, 35]], [19.8, 'fingering']],
  ['generated control 1', [[30]], [30.0, 'lace']], ['generated control 2', [[30, 14, 12]], [8.7, 'bulky']],
  ['generated control 3', [[8, 9]], [6.0, 'super bulky']]],
 [['two dk strands', [[14, 14]], [9.9, 'bulky']], ['empty', [[]], 'error: no strands'],
  ['band edge', [[18]], [18.0, 'fingering']],
  ['regression: strand combination', [[11, 11]], [7.8, 'super bulky']],
  ['repair check: strand combination', [[14, 12]], [9.1, 'bulky']],
  ['generated control 1', [[12]], [12.0, 'worsted']], ['generated control 2', [[24, 12, 12]], [8.0, 'bulky']],
  ['generated control 3', [[35, 12, 35]], [10.8, 'bulky']]],
 [['empty', [[]], 'error: no strands'], ['band edge', [[18]], [18.0, 'fingering']],
  ['single fingering', [[20]], [20.0, 'fingering']],
  ['regression: strand combination', [[24, 12, 12]], [8.0, 'bulky']],
  ['repair check: strand combination', [[24, 35, 12]], [10.3, 'bulky']],
  ['generated control 1', [[14, 14, 8]], [6.2, 'super bulky']],
  ['generated control 2', [[30]], [30.0, 'lace']], ['generated control 3', [[18, 18]], [12.7, 'worsted']]],
 [['band edge', [[18]], [18.0, 'fingering']], ['single fingering', [[20]], [20.0, 'fingering']],
  ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['regression: strand combination', [[14, 30, 14]], [9.4, 'bulky']],
  ['repair check: strand combination', [[9, 8, 11]], [5.3, 'super bulky']],
  ['generated control 1', [[]], 'error: no strands'], ['generated control 2', [[12]], [12.0, 'worsted']],
  ['generated control 3', [[8, 12]], [6.7, 'super bulky']]],
 [['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
  ['empty', [[]], 'error: no strands'], ['regression: strand combination', [[35, 11]], [10.5, 'bulky']],
  ['repair check: strand combination', [[18, 30, 24]], [13.0, 'worsted']],
  ['generated control 1', [[30]], [30.0, 'lace']], ['generated control 2', [[24, 11, 20]], [8.9, 'bulky']],
  ['generated control 3', [[16]], [16.0, 'dk']]]]
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[7.0, 'super bulky'][9.9, 'bulky']Failed
emptyerror: no strandserror: no strandsPassed
regression: strand combination[6.0, 'super bulky'][7.6, 'super bulky']Failed
repair check: strand combination[14.2, 'dk'][19.8, 'fingering']Failed
generated control 1[30.0, 'lace'][30.0, 'lace']Passed
generated control 2[5.3, 'super bulky'][8.7, 'bulky']Failed
generated control 3[4.2, 'super bulky'][6.0, 'super bulky']Failed

SHA-256 / cd8bd2610b148dd16cff6895e653d71d4dfd4bf68254922e9b1f870415bf8036

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 2f2cc73cf28d0d6dce123f0136b657338f8a6a62771b3bbf7358102172e83646