FAILURE MAP
← Case archive

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

Post-wash swatch gauge: post-wash width · case 01

A superwash sweater grows 10% after the first wash.

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

ROOT CAUSE

Stitch gauge uses the pre-wash swatch width.

THE FAILURE

Stitch gauge uses the pre-wash swatch width.

Unsuccessful approach: Averaging pre and post widths still bakes in half of the growth.

Case contract

A swatch of sts x rows measured before and after washing. Use post-wash dimensions: cast on = half-up target_w*sts/w_post; rows = target_h*rows/h_post rounded to the nearest even number (ties up); width change % = (w_post/w_pre - 1)*100 half-up to 0.1. Return [cast_on, rows, width_change].

Why this case matters

Knitters block swatches because many fibres grow or shrink after washing.

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(sts, rows, w_pre, w_post, h_pre, h_post, target_w, target_h):
    wpo = Fraction(w_post)
    hpo = Fraction(h_post)
    cast = math.floor(target_w * sts / Fraction(w_pre) + Fraction(1, 2))
    rr = target_h * rows / hpo
    row_count = 2 * math.floor(rr / 2 + Fraction(1, 2))
    change = (wpo / Fraction(w_pre) - 1) * 100
    return [cast, row_count, math.floor(change * 10 + Fraction(1, 2)) / 10]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['regression: post-wash width', [20, 40, '10.5', '11', '10', '9.5', 50, 45], [91, 190, 4.8]],
  ['repair check: post-wash width', [22, 28, '10.5', '9.5', '10.2', '10', 50, 30], [116, 84, -9.5]],
  ['generated control 1', [22, 28, '10', '10.8', '10.2', '10.4', 50, 60], [102, 162, 8.0]],
  ['generated control 2', [24, 30, '10', '11', '10.2', '10.4', 40, 30], [87, 86, 10.0]],
  ['generated control 3', [22, 30, '10', '9.5', '10.2', '10', 40, 45], [93, 136, -5.0]]],
 [['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['regression: post-wash width', [20, 32, '10', '9.5', '10.2', '9', 50, 45], [105, 160, -5.0]],
  ['repair check: post-wash width', [24, 32, '10.5', '10.8', '10.2', '10', 40, 60], [89, 192, 2.9]],
  ['generated control 1', [30, 32, '10.5', '10.5', '10', '9', 55, 60], [157, 214, 0.0]],
  ['generated control 2', [30, 28, '10.5', '10.5', '10', '9.5', 50, 45], [143, 132, 0.0]],
  ['generated control 3', [20, 32, '10', '10', '10.2', '10', 55, 60], [110, 192, 0.0]]],
 [['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['regression: post-wash width', [22, 32, '10', '11', '10.2', '10', 50, 30], [100, 96, 10.0]],
  ['repair check: post-wash width', [24, 30, '10', '10.8', '10', '10', 40, 30], [89, 90, 8.0]],
  ['generated control 1', [24, 32, '10.5', '10.5', '10', '9.5', 55, 60], [126, 202, 0.0]],
  ['generated control 2', [20, 32, '10.5', '9.5', '10', '10', 55, 45], [116, 144, -9.5]],
  ['generated control 3', [20, 32, '10', '9.5', '10', '10', 55, 30], [116, 96, -5.0]]],
 [['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['regression: post-wash width', [24, 28, '10', '9.5', '10.2', '10', 40, 60], [101, 168, -5.0]],
  ['repair check: post-wash width', [30, 30, '10.5', '9.5', '10', '10', 40, 60], [126, 180, -9.5]],
  ['generated control 1', [24, 30, '10', '10.5', '10.2', '10.4', 40, 45], [91, 130, 5.0]],
  ['generated control 2', [30, 32, '10.5', '11', '10.2', '10', 50, 60], [136, 192, 4.8]],
  ['generated control 3', [22, 28, '10.5', '11', '10.2', '9', 55, 60], [110, 186, 4.8]]],
 [['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['regression: post-wash width', [22, 40, '10.5', '11', '10', '9', 55, 30], [110, 134, 4.8]],
  ['repair check: post-wash width', [20, 28, '10', '9.5', '10', '10', 55, 45], [116, 126, -5.0]],
  ['generated control 1', [20, 30, '10.5', '11', '10', '10', 40, 30], [73, 90, 4.8]],
  ['generated control 2', [24, 40, '10.5', '10', '10', '9', 40, 30], [96, 134, -4.8]],
  ['generated control 3', [24, 40, '10.5', '11', '10.2', '10.4', 55, 60], [120, 230, 4.8]]]]
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
no change[100, 126, 0.0][100, 126, 0.0]Passed
growth[110, 174, 10.0][100, 174, 10.0]Failed
shrink[91, 106, -9.5][101, 106, -9.5]Failed
regression: post-wash width[95, 190, 4.8][91, 190, 4.8]Failed
repair check: post-wash width[105, 84, -9.5][116, 84, -9.5]Failed
generated control 1[110, 162, 8.0][102, 162, 8.0]Failed
generated control 2[96, 86, 10.0][87, 86, 10.0]Failed
generated control 3[88, 136, -5.0][93, 136, -5.0]Failed

SHA-256 / 0e8955426d01fd4d14292358fe1d0d96d1e1ce761afb820f0b2f961b55973add

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(sts, rows, w_pre, w_post, h_pre, h_post, target_w, target_h):
    wpo = Fraction(w_post)
    hpo = Fraction(h_post)
    cast = math.floor(target_w * sts / ((wpo + Fraction(w_pre)) / 2) + Fraction(1, 2))
    rr = target_h * rows / hpo
    row_count = 2 * math.floor(rr / 2 + Fraction(1, 2))
    change = (wpo / Fraction(w_pre) - 1) * 100
    return [cast, row_count, math.floor(change * 10 + Fraction(1, 2)) / 10]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['regression: post-wash width', [20, 40, '10.5', '11', '10', '9.5', 50, 45], [91, 190, 4.8]],
  ['repair check: post-wash width', [22, 28, '10.5', '9.5', '10.2', '10', 50, 30], [116, 84, -9.5]],
  ['generated control 1', [22, 28, '10', '10.8', '10.2', '10.4', 50, 60], [102, 162, 8.0]],
  ['generated control 2', [24, 30, '10', '11', '10.2', '10.4', 40, 30], [87, 86, 10.0]],
  ['generated control 3', [22, 30, '10', '9.5', '10.2', '10', 40, 45], [93, 136, -5.0]]],
 [['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['regression: post-wash width', [20, 32, '10', '9.5', '10.2', '9', 50, 45], [105, 160, -5.0]],
  ['repair check: post-wash width', [24, 32, '10.5', '10.8', '10.2', '10', 40, 60], [89, 192, 2.9]],
  ['generated control 1', [30, 32, '10.5', '10.5', '10', '9', 55, 60], [157, 214, 0.0]],
  ['generated control 2', [30, 28, '10.5', '10.5', '10', '9.5', 50, 45], [143, 132, 0.0]],
  ['generated control 3', [20, 32, '10', '10', '10.2', '10', 55, 60], [110, 192, 0.0]]],
 [['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['regression: post-wash width', [22, 32, '10', '11', '10.2', '10', 50, 30], [100, 96, 10.0]],
  ['repair check: post-wash width', [24, 30, '10', '10.8', '10', '10', 40, 30], [89, 90, 8.0]],
  ['generated control 1', [24, 32, '10.5', '10.5', '10', '9.5', 55, 60], [126, 202, 0.0]],
  ['generated control 2', [20, 32, '10.5', '9.5', '10', '10', 55, 45], [116, 144, -9.5]],
  ['generated control 3', [20, 32, '10', '9.5', '10', '10', 55, 30], [116, 96, -5.0]]],
 [['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['regression: post-wash width', [24, 28, '10', '9.5', '10.2', '10', 40, 60], [101, 168, -5.0]],
  ['repair check: post-wash width', [30, 30, '10.5', '9.5', '10', '10', 40, 60], [126, 180, -9.5]],
  ['generated control 1', [24, 30, '10', '10.5', '10.2', '10.4', 40, 45], [91, 130, 5.0]],
  ['generated control 2', [30, 32, '10.5', '11', '10.2', '10', 50, 60], [136, 192, 4.8]],
  ['generated control 3', [22, 28, '10.5', '11', '10.2', '9', 55, 60], [110, 186, 4.8]]],
 [['growth', [22, 30, '10', '11', '10', '10.4', 50, 60], [100, 174, 10.0]],
  ['shrink', [24, 32, '10.5', '9.5', '10.2', '9', 40, 30], [101, 106, -9.5]],
  ['no change', [20, 28, '10', '10', '10', '10', 50, 45], [100, 126, 0.0]],
  ['regression: post-wash width', [22, 40, '10.5', '11', '10', '9', 55, 30], [110, 134, 4.8]],
  ['repair check: post-wash width', [20, 28, '10', '9.5', '10', '10', 55, 45], [116, 126, -5.0]],
  ['generated control 1', [20, 30, '10.5', '11', '10', '10', 40, 30], [73, 90, 4.8]],
  ['generated control 2', [24, 40, '10.5', '10', '10', '9', 40, 30], [96, 134, -4.8]],
  ['generated control 3', [24, 40, '10.5', '11', '10.2', '10.4', 55, 60], [120, 230, 4.8]]]]
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
no change[100, 126, 0.0][100, 126, 0.0]Passed
growth[105, 174, 10.0][100, 174, 10.0]Failed
shrink[96, 106, -9.5][101, 106, -9.5]Failed
regression: post-wash width[93, 190, 4.8][91, 190, 4.8]Failed
repair check: post-wash width[110, 84, -9.5][116, 84, -9.5]Failed
generated control 1[106, 162, 8.0][102, 162, 8.0]Failed
generated control 2[91, 86, 10.0][87, 86, 10.0]Failed
generated control 3[90, 136, -5.0][93, 136, -5.0]Failed

SHA-256 / 97eeefdedfc1301ab96eddaabf85091e52578a2c7b1c93cac75fc47b04711e67

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

Case digest / ee244e4f2e5273197dad386c1acc5acdcb4ce642c5565fbdb26a6abbf7348b54