FAILURE MAP
← Case archive

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

Buttonhole row planner: single button placement · case 01

A one-button cropped cardigan puts its button at the hem.

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

ROOT CAUSE

A lone buttonhole is placed at the bottom offset.

THE FAILURE

A lone buttonhole is placed at the bottom offset.

Unsuccessful approach: Centring it contradicts the neck-closure contract.

Case contract

Buttonholes run from bottom_offset to band_len - top_offset (cm), evenly spaced; a single buttonhole goes at the top position. Convert each position to a 1-based row: half-up of position*rows_per_10cm/10, plus 1. n < 1 -> "error: count"; top position below bottom -> "error: offsets".

Why this case matters

Cardigan button bands place buttonholes evenly between neck and hem offsets.

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(band_len, n, top_offset, bottom_offset, rows_per_10cm):
    if n < 1:
        return 'error: count'
    lo = Fraction(str(bottom_offset))
    hi = Fraction(str(band_len)) - Fraction(str(top_offset))
    if hi < lo:
        return 'error: offsets'
    g = Fraction(str(rows_per_10cm)) / 10
    if n == 1:
        pos = [lo]
    else:
        gap = (hi - lo) / (n - 1)
        pos = [lo + i * gap for i in range(n)]
    return [math.floor(p * g + Fraction(1, 2)) + 1 for p in pos]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['single button', [40, 1, 2, 2, '28'], [107]], ['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['regression: single button placement', [50, 1, 3, 1, '30'], [142]],
  ['repair check: single button placement', [50, 1, 1.5, 4, '32'], [156]],
  ['generated control 1', [50, 6, 1, 2, '36.5'], [8, 43, 77, 111, 146, 180]],
  ['generated control 2', [62, 0, 2, 2, '36.5'], 'error: count'],
  ['generated control 3', [62, 5, 2, 2.5, '32'], [9, 55, 101, 147, 193]]],
 [['single button', [40, 1, 2, 2, '28'], [107]], ['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['regression: single button placement', [60, 1, 3, 1, '30'], [172]],
  ['repair check: single button placement', [40, 1, 1, 1, '32'], [126]],
  ['generated control 1', [60, 2, 1.5, 2, '32'], [7, 188]],
  ['generated control 2', [50, 7, 2, 2, '36.5'], [8, 36, 64, 92, 120, 148, 176]],
  ['generated control 3', [40, 4, 1, 1, '30'], [4, 42, 80, 118]]],
 [['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['single button', [40, 1, 2, 2, '28'], [107]],
  ['regression: single button placement', [60, 1, 2, 2, '36.5'], [213]],
  ['repair check: single button placement', [50, 1, 3, 2, '32'], [151]],
  ['generated control 1', [62, 2, 3, 2.5, '32'], [9, 190]],
  ['generated control 2', [55.5, 6, 2, 2.5, '30'], [9, 39, 70, 100, 131, 162]],
  ['generated control 3', [60, 0, 1, 1, '28'], 'error: count']],
 [['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['single button', [40, 1, 2, 2, '28'], [107]], ['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['regression: single button placement', [62, 1, 3, 2.5, '28'], [166]],
  ['repair check: single button placement', [62, 1, 3, 2, '30'], [178]],
  ['generated control 1', [40, 6, 1, 1, '32'], [4, 29, 53, 77, 101, 126]],
  ['generated control 2', [60, 2, 3, 2.5, '32'], [9, 183]],
  ['generated control 3', [55.5, 2, 1, 1, '28'], [4, 154]]],
 [['single button', [40, 1, 2, 2, '28'], [107]], ['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['regression: single button placement', [50, 1, 2, 1, '32'], [155]],
  ['repair check: single button placement', [62, 1, 1.5, 1, '28'], [170]],
  ['generated control 1', [50, 4, 3, 1, '30'], [4, 50, 96, 142]],
  ['generated control 2', [60, 6, 2, 2, '36.5'], [8, 49, 90, 131, 172, 213]],
  ['generated control 3', [55.5, 6, 1, 4, '32'], [14, 46, 78, 111, 143, 175]]]]
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
five buttons[7, 42, 77, 112, 147][7, 42, 77, 112, 147]Passed
single button[7][107]Failed
no buttonserror: counterror: countPassed
regression: single button placement[4][142]Failed
repair check: single button placement[14][156]Failed
generated control 1[8, 43, 77, 111, 146, 180][8, 43, 77, 111, 146, 180]Passed
generated control 2error: counterror: countPassed
generated control 3[9, 55, 101, 147, 193][9, 55, 101, 147, 193]Passed

SHA-256 / 25c1fce5f61bc4b6c70e88805fdcbf27ade9c280d43d37d08d366a2fdd4dedd1

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(band_len, n, top_offset, bottom_offset, rows_per_10cm):
    if n < 1:
        return 'error: count'
    lo = Fraction(str(bottom_offset))
    hi = Fraction(str(band_len)) - Fraction(str(top_offset))
    if hi < lo:
        return 'error: offsets'
    g = Fraction(str(rows_per_10cm)) / 10
    if n == 1:
        pos = [(lo + hi) / 2]
    else:
        gap = (hi - lo) / (n - 1)
        pos = [lo + i * gap for i in range(n)]
    return [math.floor(p * g + Fraction(1, 2)) + 1 for p in pos]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['single button', [40, 1, 2, 2, '28'], [107]], ['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['regression: single button placement', [50, 1, 3, 1, '30'], [142]],
  ['repair check: single button placement', [50, 1, 1.5, 4, '32'], [156]],
  ['generated control 1', [50, 6, 1, 2, '36.5'], [8, 43, 77, 111, 146, 180]],
  ['generated control 2', [62, 0, 2, 2, '36.5'], 'error: count'],
  ['generated control 3', [62, 5, 2, 2.5, '32'], [9, 55, 101, 147, 193]]],
 [['single button', [40, 1, 2, 2, '28'], [107]], ['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['regression: single button placement', [60, 1, 3, 1, '30'], [172]],
  ['repair check: single button placement', [40, 1, 1, 1, '32'], [126]],
  ['generated control 1', [60, 2, 1.5, 2, '32'], [7, 188]],
  ['generated control 2', [50, 7, 2, 2, '36.5'], [8, 36, 64, 92, 120, 148, 176]],
  ['generated control 3', [40, 4, 1, 1, '30'], [4, 42, 80, 118]]],
 [['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['single button', [40, 1, 2, 2, '28'], [107]],
  ['regression: single button placement', [60, 1, 2, 2, '36.5'], [213]],
  ['repair check: single button placement', [50, 1, 3, 2, '32'], [151]],
  ['generated control 1', [62, 2, 3, 2.5, '32'], [9, 190]],
  ['generated control 2', [55.5, 6, 2, 2.5, '30'], [9, 39, 70, 100, 131, 162]],
  ['generated control 3', [60, 0, 1, 1, '28'], 'error: count']],
 [['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['single button', [40, 1, 2, 2, '28'], [107]], ['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['regression: single button placement', [62, 1, 3, 2.5, '28'], [166]],
  ['repair check: single button placement', [62, 1, 3, 2, '30'], [178]],
  ['generated control 1', [40, 6, 1, 1, '32'], [4, 29, 53, 77, 101, 126]],
  ['generated control 2', [60, 2, 3, 2.5, '32'], [9, 183]],
  ['generated control 3', [55.5, 2, 1, 1, '28'], [4, 154]]],
 [['single button', [40, 1, 2, 2, '28'], [107]], ['no buttons', [40, 0, 2, 2, '28'], 'error: count'],
  ['five buttons', [50, 5, 1.5, 2, '30'], [7, 42, 77, 112, 147]],
  ['regression: single button placement', [50, 1, 2, 1, '32'], [155]],
  ['repair check: single button placement', [62, 1, 1.5, 1, '28'], [170]],
  ['generated control 1', [50, 4, 3, 1, '30'], [4, 50, 96, 142]],
  ['generated control 2', [60, 6, 2, 2, '36.5'], [8, 49, 90, 131, 172, 213]],
  ['generated control 3', [55.5, 6, 1, 4, '32'], [14, 46, 78, 111, 143, 175]]]]
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
five buttons[7, 42, 77, 112, 147][7, 42, 77, 112, 147]Passed
single button[57][107]Failed
no buttonserror: counterror: countPassed
regression: single button placement[73][142]Failed
repair check: single button placement[85][156]Failed
generated control 1[8, 43, 77, 111, 146, 180][8, 43, 77, 111, 146, 180]Passed
generated control 2error: counterror: countPassed
generated control 3[9, 55, 101, 147, 193][9, 55, 101, 147, 193]Passed

SHA-256 / cafe3216d2d6fb6a60742780ee1341eca887d2dd8d5397f814b7d38b0b17d467

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

Case digest / c838488b4dcdb45f6c827a8027b980a5b674387068ca7a170d49b22d4373d296