FAILURE MAP
← Case archive

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

Flat crochet circle planner: total stitches · case 01

Yarn estimates from the stitch total are low.

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

ROOT CAUSE

The triangular sum uses rounds squared over two.

VERIFIED REPAIR

Total is base*rounds*(rounds+1)/2.

Unsuccessful approach: (rounds-1) drops the final round.

Case contract

Base stitches per round: sc 6, hdc 8, dc 12 (others -> "error: stitch"). Each round adds one round height to the radius. rounds = ceiling(diameter/(2*height)). Round k has base*k stitches. Return [rounds, stitches in last round, total stitches base*rounds*(rounds+1)/2].

Why this case matters

Amigurumi and rug patterns size flat circles by rounds of evenly spaced increases.

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(stitch, diameter, round_height):
    BASE = {'sc': 6, 'hdc': 8, 'dc': 12}
    if stitch not in BASE:
        return 'error: stitch'
    h = Fraction(round_height)
    rounds = math.ceil(Fraction(diameter) / (2 * h))
    b = BASE[stitch]
    return [rounds, b * rounds, b * rounds * rounds // 2]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['regression: total stitches', ['hdc', 15, '0.5'], [15, 120, 960]],
  ['repair check: total stitches', ['hdc', 15, '1'], [8, 64, 288]],
  ['generated control 1', ['hdc', 10, '2'], [3, 24, 48]],
  ['generated control 2', ['tr', 5, '2'], 'error: stitch'],
  ['generated control 3', ['tr', 10, '1.5'], 'error: stitch']],
 [['dc mat', ['dc', 30, '1.5'], [10, 120, 660]], ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['regression: total stitches', ['sc', 20, '2'], [5, 30, 90]],
  ['repair check: total stitches', ['dc', 20, '2'], [5, 60, 180]],
  ['generated control 1', ['dc', 12, '1.5'], [4, 48, 120]],
  ['generated control 2', ['tr', 5, '2'], 'error: stitch'],
  ['generated control 3', ['tr', 30, '2'], 'error: stitch']],
 [['treble unknown', ['tr', 10, '1'], 'error: stitch'], ['coaster', ['sc', 10, '0.5'], [10, 60, 330]],
  ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['regression: total stitches', ['dc', 15, '1'], [8, 96, 432]],
  ['repair check: total stitches', ['dc', 12, '1'], [6, 72, 252]],
  ['generated control 1', ['sc', 30, '0.5'], [30, 180, 2790]],
  ['generated control 2', ['sc', 20, '1'], [10, 60, 330]],
  ['generated control 3', ['tr', 15, '2'], 'error: stitch']],
 [['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['regression: total stitches', ['hdc', 12, '2'], [3, 24, 48]],
  ['repair check: total stitches', ['dc', 15, '2'], [4, 48, 120]],
  ['generated control 1', ['dc', 10, '1'], [5, 60, 180]],
  ['generated control 2', ['sc', 5, '0.75'], [4, 24, 60]],
  ['generated control 3', ['sc', 30, '1.5'], [10, 60, 330]]],
 [['dc mat', ['dc', 30, '1.5'], [10, 120, 660]], ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['coaster', ['sc', 10, '0.5'], [10, 60, 330]],
  ['regression: total stitches', ['dc', 5, '0.75'], [4, 48, 120]],
  ['repair check: total stitches', ['sc', 20, '0.75'], [14, 84, 630]],
  ['generated control 1', ['tr', 5, '1'], 'error: stitch'],
  ['generated control 2', ['dc', 10, '1'], [5, 60, 180]],
  ['generated control 3', ['sc', 15, '0.5'], [15, 90, 720]]]]
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
coaster[10, 60, 300][10, 60, 330]Failed
dc mat[10, 120, 600][10, 120, 660]Failed
treble unknownerror: stitcherror: stitchPassed
regression: total stitches[15, 120, 900][15, 120, 960]Failed
repair check: total stitches[8, 64, 256][8, 64, 288]Failed
generated control 1[3, 24, 36][3, 24, 48]Failed
generated control 2error: stitcherror: stitchPassed
generated control 3error: stitcherror: stitchPassed

SHA-256 / 2a63d6b350771242d194e0cdc972030c873b53274b09df9e4ec65cecbb325c8d

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(stitch, diameter, round_height):
    BASE = {'sc': 6, 'hdc': 8, 'dc': 12}
    if stitch not in BASE:
        return 'error: stitch'
    h = Fraction(round_height)
    rounds = math.ceil(Fraction(diameter) / (2 * h))
    b = BASE[stitch]
    return [rounds, b * rounds, b * rounds * (rounds - 1) // 2]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['regression: total stitches', ['hdc', 15, '0.5'], [15, 120, 960]],
  ['repair check: total stitches', ['hdc', 15, '1'], [8, 64, 288]],
  ['generated control 1', ['hdc', 10, '2'], [3, 24, 48]],
  ['generated control 2', ['tr', 5, '2'], 'error: stitch'],
  ['generated control 3', ['tr', 10, '1.5'], 'error: stitch']],
 [['dc mat', ['dc', 30, '1.5'], [10, 120, 660]], ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['regression: total stitches', ['sc', 20, '2'], [5, 30, 90]],
  ['repair check: total stitches', ['dc', 20, '2'], [5, 60, 180]],
  ['generated control 1', ['dc', 12, '1.5'], [4, 48, 120]],
  ['generated control 2', ['tr', 5, '2'], 'error: stitch'],
  ['generated control 3', ['tr', 30, '2'], 'error: stitch']],
 [['treble unknown', ['tr', 10, '1'], 'error: stitch'], ['coaster', ['sc', 10, '0.5'], [10, 60, 330]],
  ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['regression: total stitches', ['dc', 15, '1'], [8, 96, 432]],
  ['repair check: total stitches', ['dc', 12, '1'], [6, 72, 252]],
  ['generated control 1', ['sc', 30, '0.5'], [30, 180, 2790]],
  ['generated control 2', ['sc', 20, '1'], [10, 60, 330]],
  ['generated control 3', ['tr', 15, '2'], 'error: stitch']],
 [['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['regression: total stitches', ['hdc', 12, '2'], [3, 24, 48]],
  ['repair check: total stitches', ['dc', 15, '2'], [4, 48, 120]],
  ['generated control 1', ['dc', 10, '1'], [5, 60, 180]],
  ['generated control 2', ['sc', 5, '0.75'], [4, 24, 60]],
  ['generated control 3', ['sc', 30, '1.5'], [10, 60, 330]]],
 [['dc mat', ['dc', 30, '1.5'], [10, 120, 660]], ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['coaster', ['sc', 10, '0.5'], [10, 60, 330]],
  ['regression: total stitches', ['dc', 5, '0.75'], [4, 48, 120]],
  ['repair check: total stitches', ['sc', 20, '0.75'], [14, 84, 630]],
  ['generated control 1', ['tr', 5, '1'], 'error: stitch'],
  ['generated control 2', ['dc', 10, '1'], [5, 60, 180]],
  ['generated control 3', ['sc', 15, '0.5'], [15, 90, 720]]]]
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
coaster[10, 60, 270][10, 60, 330]Failed
dc mat[10, 120, 540][10, 120, 660]Failed
treble unknownerror: stitcherror: stitchPassed
regression: total stitches[15, 120, 840][15, 120, 960]Failed
repair check: total stitches[8, 64, 224][8, 64, 288]Failed
generated control 1[3, 24, 24][3, 24, 48]Failed
generated control 2error: stitcherror: stitchPassed
generated control 3error: stitcherror: stitchPassed

SHA-256 / cc7ae1f21e6fd54169d0e2d7cb64e5e36413b14a8e54af518d3e3d8df5d68fde

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(stitch, diameter, round_height):
    BASE = {'sc': 6, 'hdc': 8, 'dc': 12}
    if stitch not in BASE:
        return 'error: stitch'
    h = Fraction(round_height)
    rounds = math.ceil(Fraction(diameter) / (2 * h))
    b = BASE[stitch]
    return [rounds, b * rounds, b * rounds * (rounds + 1) // 2]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['regression: total stitches', ['hdc', 15, '0.5'], [15, 120, 960]],
  ['repair check: total stitches', ['hdc', 15, '1'], [8, 64, 288]],
  ['generated control 1', ['hdc', 10, '2'], [3, 24, 48]],
  ['generated control 2', ['tr', 5, '2'], 'error: stitch'],
  ['generated control 3', ['tr', 10, '1.5'], 'error: stitch']],
 [['dc mat', ['dc', 30, '1.5'], [10, 120, 660]], ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['regression: total stitches', ['sc', 20, '2'], [5, 30, 90]],
  ['repair check: total stitches', ['dc', 20, '2'], [5, 60, 180]],
  ['generated control 1', ['dc', 12, '1.5'], [4, 48, 120]],
  ['generated control 2', ['tr', 5, '2'], 'error: stitch'],
  ['generated control 3', ['tr', 30, '2'], 'error: stitch']],
 [['treble unknown', ['tr', 10, '1'], 'error: stitch'], ['coaster', ['sc', 10, '0.5'], [10, 60, 330]],
  ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['regression: total stitches', ['dc', 15, '1'], [8, 96, 432]],
  ['repair check: total stitches', ['dc', 12, '1'], [6, 72, 252]],
  ['generated control 1', ['sc', 30, '0.5'], [30, 180, 2790]],
  ['generated control 2', ['sc', 20, '1'], [10, 60, 330]],
  ['generated control 3', ['tr', 15, '2'], 'error: stitch']],
 [['coaster', ['sc', 10, '0.5'], [10, 60, 330]], ['dc mat', ['dc', 30, '1.5'], [10, 120, 660]],
  ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['regression: total stitches', ['hdc', 12, '2'], [3, 24, 48]],
  ['repair check: total stitches', ['dc', 15, '2'], [4, 48, 120]],
  ['generated control 1', ['dc', 10, '1'], [5, 60, 180]],
  ['generated control 2', ['sc', 5, '0.75'], [4, 24, 60]],
  ['generated control 3', ['sc', 30, '1.5'], [10, 60, 330]]],
 [['dc mat', ['dc', 30, '1.5'], [10, 120, 660]], ['treble unknown', ['tr', 10, '1'], 'error: stitch'],
  ['coaster', ['sc', 10, '0.5'], [10, 60, 330]],
  ['regression: total stitches', ['dc', 5, '0.75'], [4, 48, 120]],
  ['repair check: total stitches', ['sc', 20, '0.75'], [14, 84, 630]],
  ['generated control 1', ['tr', 5, '1'], 'error: stitch'],
  ['generated control 2', ['dc', 10, '1'], [5, 60, 180]],
  ['generated control 3', ['sc', 15, '0.5'], [15, 90, 720]]]]
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
coaster[10, 60, 330][10, 60, 330]Passed
dc mat[10, 120, 660][10, 120, 660]Passed
treble unknownerror: stitcherror: stitchPassed
regression: total stitches[15, 120, 960][15, 120, 960]Passed
repair check: total stitches[8, 64, 288][8, 64, 288]Passed
generated control 1[3, 24, 48][3, 24, 48]Passed
generated control 2error: stitcherror: stitchPassed
generated control 3error: stitcherror: stitchPassed

SHA-256 / 207f890a86be5a9d82553ab6b0f9135aacbe55995fd5cea89d84cbb69904230c

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

Case digest / 8cb7cf66c296fc28b99ddf808d8395f6270d12ef13b6a2ab2880e2a42ecc6a3c