FAILURE MAP
← Case archive

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

Buttonhole row planner: row gauge conversion · case 01

Buttonhole rows land ten times too high.

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

ROOT CAUSE

The per-10 cm row gauge is used per centimetre.

THE FAILURE

The per-10 cm row gauge is used per centimetre.

Unsuccessful approach: Inverting the gauge gives centimetres per row.

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))
    if n == 1:
        pos = [hi]
    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: row gauge conversion', [60, 7, 1, 1, '28'], [4, 31, 58, 85, 112, 139, 166]],
  ['repair check: row gauge conversion', [55.5, 7, 3, 4, '30'], [13, 37, 62, 86, 110, 134, 159]],
  ['generated control 1', [55.5, 0, 3, 4, '32'], 'error: count'],
  ['generated control 2', [60, 0, 1, 2, '30'], 'error: count'],
  ['generated control 3', [60, 7, 3, 4, '32'], [14, 42, 70, 99, 127, 155, 183]]],
 [['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: row gauge conversion', [60, 6, 2, 2.5, '36.5'], [10, 51, 91, 132, 172, 213]],
  ['repair check: row gauge conversion', [55.5, 6, 2, 2.5, '32'], [9, 42, 74, 107, 140, 172]],
  ['generated control 1', [40, 6, 3, 2, '30'], [7, 28, 49, 70, 91, 112]],
  ['generated control 2', [40, 6, 3, 4, '28'], [12, 31, 49, 68, 86, 105]],
  ['generated control 3', [60, 4, 1.5, 1, '30'], [4, 62, 119, 177]]],
 [['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: row gauge conversion', [60, 1, 1.5, 2, '32'], [188]],
  ['repair check: row gauge conversion', [55.5, 5, 2, 4, '28'], [12, 47, 82, 116, 151]],
  ['generated control 1', [62, 0, 3, 1, '32'], 'error: count'],
  ['generated control 2', [62, 1, 3, 2, '28'], [166]],
  ['generated control 3', [50, 6, 3, 4, '30'], [13, 39, 65, 90, 116, 142]]],
 [['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: row gauge conversion', [50, 1, 1.5, 4, '28'], [137]],
  ['repair check: row gauge conversion', [50, 4, 3, 1, '30'], [4, 50, 96, 142]],
  ['generated control 1', [62, 1, 2, 2, '32'], [193]],
  ['generated control 2', [62, 6, 2, 1, '32'], [4, 42, 80, 117, 155, 193]],
  ['generated control 3', [55.5, 5, 1.5, 2, '36.5'], [8, 56, 103, 151, 198]]],
 [['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: row gauge conversion', [40, 7, 1.5, 2.5, '36.5'], [10, 32, 54, 76, 98, 120, 142]],
  ['repair check: row gauge conversion', [50, 7, 1.5, 2.5, '36.5'], [10, 38, 66, 94, 122, 150, 178]],
  ['generated control 1', [62, 1, 2, 2, '28'], [169]],
  ['generated control 2', [62, 7, 1, 1, '30'], [4, 34, 64, 94, 124, 154, 184]],
  ['generated control 3', [60, 2, 1, 1, '30'], [4, 178]]]]
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[61, 410, 759, 1107, 1456][7, 42, 77, 112, 147]Failed
single button[1065][107]Failed
no buttonserror: counterror: countPassed
regression: row gauge conversion[29, 300, 570, 841, 1112, 1382, 1653][4, 31, 58, 85, 112, 139, 166]Failed
repair check: row gauge conversion[121, 364, 606, 849, 1091, 1334, 1576][13, 37, 62, 86, 110, 134, 159]Failed
generated control 1error: counterror: countPassed
generated control 2error: counterror: countPassed
generated control 3[129, 412, 694, 977, 1260, 1542, 1825][14, 42, 70, 99, 127, 155, 183]Failed

SHA-256 / 901b5a351f6741f78c444d8f66feb8a60357f1c8ec75b5c376efbe114b32c668

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 = 10 / Fraction(str(rows_per_10cm))
    if n == 1:
        pos = [hi]
    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: row gauge conversion', [60, 7, 1, 1, '28'], [4, 31, 58, 85, 112, 139, 166]],
  ['repair check: row gauge conversion', [55.5, 7, 3, 4, '30'], [13, 37, 62, 86, 110, 134, 159]],
  ['generated control 1', [55.5, 0, 3, 4, '32'], 'error: count'],
  ['generated control 2', [60, 0, 1, 2, '30'], 'error: count'],
  ['generated control 3', [60, 7, 3, 4, '32'], [14, 42, 70, 99, 127, 155, 183]]],
 [['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: row gauge conversion', [60, 6, 2, 2.5, '36.5'], [10, 51, 91, 132, 172, 213]],
  ['repair check: row gauge conversion', [55.5, 6, 2, 2.5, '32'], [9, 42, 74, 107, 140, 172]],
  ['generated control 1', [40, 6, 3, 2, '30'], [7, 28, 49, 70, 91, 112]],
  ['generated control 2', [40, 6, 3, 4, '28'], [12, 31, 49, 68, 86, 105]],
  ['generated control 3', [60, 4, 1.5, 1, '30'], [4, 62, 119, 177]]],
 [['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: row gauge conversion', [60, 1, 1.5, 2, '32'], [188]],
  ['repair check: row gauge conversion', [55.5, 5, 2, 4, '28'], [12, 47, 82, 116, 151]],
  ['generated control 1', [62, 0, 3, 1, '32'], 'error: count'],
  ['generated control 2', [62, 1, 3, 2, '28'], [166]],
  ['generated control 3', [50, 6, 3, 4, '30'], [13, 39, 65, 90, 116, 142]]],
 [['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: row gauge conversion', [50, 1, 1.5, 4, '28'], [137]],
  ['repair check: row gauge conversion', [50, 4, 3, 1, '30'], [4, 50, 96, 142]],
  ['generated control 1', [62, 1, 2, 2, '32'], [193]],
  ['generated control 2', [62, 6, 2, 1, '32'], [4, 42, 80, 117, 155, 193]],
  ['generated control 3', [55.5, 5, 1.5, 2, '36.5'], [8, 56, 103, 151, 198]]],
 [['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: row gauge conversion', [40, 7, 1.5, 2.5, '36.5'], [10, 32, 54, 76, 98, 120, 142]],
  ['repair check: row gauge conversion', [50, 7, 1.5, 2.5, '36.5'], [10, 38, 66, 94, 122, 150, 178]],
  ['generated control 1', [62, 1, 2, 2, '28'], [169]],
  ['generated control 2', [62, 7, 1, 1, '30'], [4, 34, 64, 94, 124, 154, 184]],
  ['generated control 3', [60, 2, 1, 1, '30'], [4, 178]]]]
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[2, 6, 9, 13, 17][7, 42, 77, 112, 147]Failed
single button[15][107]Failed
no buttonserror: counterror: countPassed
regression: row gauge conversion[1, 5, 8, 12, 15, 19, 22][4, 31, 58, 85, 112, 139, 166]Failed
repair check: row gauge conversion[2, 5, 8, 10, 13, 16, 19][13, 37, 62, 86, 110, 134, 159]Failed
generated control 1error: counterror: countPassed
generated control 2error: counterror: countPassed
generated control 3[2, 5, 8, 11, 13, 16, 19][14, 42, 70, 99, 127, 155, 183]Failed

SHA-256 / 7945cb9b878a923bdd9fef84e336ff1fc1e11afac583bb0b5d35e5f5b4ebf97a

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

Case digest / 87284e4ae4a4032696b0644c14b1892cd6713a7f1c24135c3830e2ef48de6ffb