FA-97761 / Knitting and sewing pattern grading / Open access
Held-together yarn weight estimator: display rounding · case 01
A combined 9.899 wpi displays as 9.8 instead of 9.9.
ROOT CAUSE
The displayed wpi truncates instead of rounding half-up to 0.1.
THE FAILURE
The displayed wpi truncates instead of rounding half-up to 0.1.
Unsuccessful approach: Rounding to a whole wpi loses the decimal and shifts band edges.
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 = 1 / math.sqrt(sum(1 / (w * w) for w in wpis))
eff = math.floor(eff * 10) / 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: display rounding', [[20, 24, 8]], [7.1, 'super bulky']],
['repair check: display rounding', [[30, 11, 11]], [7.5, 'super bulky']],
['generated control 1', [[16, 9, 16]], [7.0, 'super bulky']],
['generated control 2', [[24]], [24.0, 'fingering']], ['generated control 3', [[20, 9]], [8.2, 'bulky']]],
[['two dk strands', [[14, 14]], [9.9, 'bulky']], ['empty', [[]], 'error: no strands'],
['band edge', [[18]], [18.0, 'fingering']], ['regression: display rounding', [[30, 14]], [12.7, 'worsted']],
['repair check: display rounding', [[9, 24]], [8.4, 'bulky']],
['generated control 1', [[35]], [35.0, 'lace']], ['generated control 2', [[24, 12, 12]], [8.0, 'bulky']],
['generated control 3', [[16]], [16.0, 'dk']]],
[['empty', [[]], 'error: no strands'], ['band edge', [[18]], [18.0, 'fingering']],
['single fingering', [[20]], [20.0, 'fingering']],
['regression: display rounding', [[20, 12]], [10.3, 'bulky']],
['repair check: display rounding', [[16, 8, 8]], [5.3, 'super bulky']],
['generated control 1', [[16]], [16.0, 'dk']], ['generated control 2', [[9]], [9.0, 'bulky']],
['generated control 3', [[9, 11]], [7.0, 'super bulky']]],
[['band edge', [[18]], [18.0, 'fingering']], ['single fingering', [[20]], [20.0, 'fingering']],
['two dk strands', [[14, 14]], [9.9, 'bulky']],
['regression: display rounding', [[16, 35, 14]], [10.1, 'bulky']],
['repair check: display rounding', [[16, 9, 18]], [7.2, 'super bulky']],
['generated control 1', [[]], 'error: no strands'], ['generated control 2', [[35, 14]], [13.0, 'worsted']],
['generated control 3', [[30, 14]], [12.7, 'worsted']]],
[['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
['empty', [[]], 'error: no strands'], ['regression: display rounding', [[11, 16]], [9.1, 'bulky']],
['repair check: display rounding', [[14, 18, 30]], [10.4, 'bulky']],
['generated control 1', [[11]], [11.0, 'worsted']],
['generated control 2', [[14, 8, 11]], [5.9, 'super bulky']],
['generated control 3', [[30, 11]], [10.3, 'bulky']]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| single fingering | [20.0, 'fingering'] | [20.0, 'fingering'] | Passed |
| two dk strands | [9.8, 'bulky'] | [9.9, 'bulky'] | Failed |
| empty | error: no strands | error: no strands | Passed |
| regression: display rounding | [7.0, 'super bulky'] | [7.1, 'super bulky'] | Failed |
| repair check: display rounding | [7.5, 'super bulky'] | [7.5, 'super bulky'] | Passed |
| generated control 1 | [7.0, 'super bulky'] | [7.0, 'super bulky'] | Passed |
| generated control 2 | [24.0, 'fingering'] | [24.0, 'fingering'] | Passed |
| generated control 3 | [8.2, 'bulky'] | [8.2, 'bulky'] | Passed |
SHA-256 / ee5d979fc0eacc559f175286f2c6d2b06bc17146ff552ba9c3fc8f8597080b25
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 / math.sqrt(sum(1 / (w * w) for w in wpis))
eff = round(eff)
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: display rounding', [[20, 24, 8]], [7.1, 'super bulky']],
['repair check: display rounding', [[30, 11, 11]], [7.5, 'super bulky']],
['generated control 1', [[16, 9, 16]], [7.0, 'super bulky']],
['generated control 2', [[24]], [24.0, 'fingering']], ['generated control 3', [[20, 9]], [8.2, 'bulky']]],
[['two dk strands', [[14, 14]], [9.9, 'bulky']], ['empty', [[]], 'error: no strands'],
['band edge', [[18]], [18.0, 'fingering']], ['regression: display rounding', [[30, 14]], [12.7, 'worsted']],
['repair check: display rounding', [[9, 24]], [8.4, 'bulky']],
['generated control 1', [[35]], [35.0, 'lace']], ['generated control 2', [[24, 12, 12]], [8.0, 'bulky']],
['generated control 3', [[16]], [16.0, 'dk']]],
[['empty', [[]], 'error: no strands'], ['band edge', [[18]], [18.0, 'fingering']],
['single fingering', [[20]], [20.0, 'fingering']],
['regression: display rounding', [[20, 12]], [10.3, 'bulky']],
['repair check: display rounding', [[16, 8, 8]], [5.3, 'super bulky']],
['generated control 1', [[16]], [16.0, 'dk']], ['generated control 2', [[9]], [9.0, 'bulky']],
['generated control 3', [[9, 11]], [7.0, 'super bulky']]],
[['band edge', [[18]], [18.0, 'fingering']], ['single fingering', [[20]], [20.0, 'fingering']],
['two dk strands', [[14, 14]], [9.9, 'bulky']],
['regression: display rounding', [[16, 35, 14]], [10.1, 'bulky']],
['repair check: display rounding', [[16, 9, 18]], [7.2, 'super bulky']],
['generated control 1', [[]], 'error: no strands'], ['generated control 2', [[35, 14]], [13.0, 'worsted']],
['generated control 3', [[30, 14]], [12.7, 'worsted']]],
[['single fingering', [[20]], [20.0, 'fingering']], ['two dk strands', [[14, 14]], [9.9, 'bulky']],
['empty', [[]], 'error: no strands'], ['regression: display rounding', [[11, 16]], [9.1, 'bulky']],
['repair check: display rounding', [[14, 18, 30]], [10.4, 'bulky']],
['generated control 1', [[11]], [11.0, 'worsted']],
['generated control 2', [[14, 8, 11]], [5.9, 'super bulky']],
['generated control 3', [[30, 11]], [10.3, 'bulky']]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| single fingering | [20, 'fingering'] | [20.0, 'fingering'] | Passed |
| two dk strands | [10, 'bulky'] | [9.9, 'bulky'] | Failed |
| empty | error: no strands | error: no strands | Passed |
| regression: display rounding | [7, 'super bulky'] | [7.1, 'super bulky'] | Failed |
| repair check: display rounding | [8, 'bulky'] | [7.5, 'super bulky'] | Failed |
| generated control 1 | [7, 'super bulky'] | [7.0, 'super bulky'] | Passed |
| generated control 2 | [24, 'fingering'] | [24.0, 'fingering'] | Passed |
| generated control 3 | [8, 'bulky'] | [8.2, 'bulky'] | Failed |
SHA-256 / a9a5d4559bcbcdbbd4b9ed9088d17c93741f085b7ecdcf25c9981d6d5164c43f
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.326097+00:00.
Case digest / 562577939e551c784e43ee1146a08cacabb755d500058ebb4baadc584fd31c0a