FAILURE MAP
← Case archive

FA-79746 / Barcode symbology encoding / Open access

Quiet zone offset is counted in pixels · case 01

At pitches above one pixel per module the quiet zone is too small and the symbol starts too close to the label edge.

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

ROOT CAUSE

The quiet zone count is added as pixels instead of modules.

VERIFIED REPAIR

Offset by quiet modules at the module pitch before rounding.

Unsuccessful approach: Rounding the quiet offset separately breaks the single rounding step for each edge.

Case contract

Render a module string ("1" bar, "0" space) at xn/xd device pixels per module after `quiet` leading quiet-zone modules. Module boundary k lies at round-half-up((quiet + k) * X), computed from the exact fraction so errors do not accumulate. Adjacent bar modules merge into one bar [start, end); bar width reduction shaves `bwr` pixels from the right edge of each bar, but a bar is never narrower than 1 pixel.

Why this case matters

Retail, logistics, pharmacy and document workflows depend on encoders that produce exactly the module pattern, code-set switches, separators and quiet zones scanners expect; one misplaced module or separator makes a label unreadable or, worse, scan as different data.

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(mods, xn, xd, bwr, quiet):
    X = Fraction(xn, xd)
    def edge(i):
        return math.floor(i * X + Fraction(1, 2)) + quiet
    bars = []
    i = 0
    n = len(mods)
    while i < n:
        if mods[i] == '1':
            j = i
            while j < n and mods[j] == '1':
                j += 1
            s, e = edge(i), edge(j) - bwr
            if e - s < 1:
                e = s + 1
            bars.append([s, e])
            i = j
        else:
            i += 1
    return bars
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('0001111', 2, 1, 0, 1), [[8, 16]]], [('000011011110', 4, 3, 1, 1), [[7, 8], [11, 15]]], [('11011', 5, 2, 2, 1), [[3, 6], [10, 13]]], [('010111110', 11, 5, 2, 0), [[2, 3], [7, 16]]], [('00001010', 1, 1, 0, 1), [[5, 6], [7, 8]]], [('101100101', 11, 5, 0, 0), [[0, 2], [4, 9], [13, 15], [18, 20]]], [('00101', 3, 1, 0, 0), [[6, 9], [12, 15]]], [('011', 5, 2, 1, 10), [[28, 32]]]], [[('0011000', 3, 1, 2, 3), [[15, 19]]], [('110', 11, 5, 0, 3), [[7, 11]]], [('11010001011', 11, 5, 1, 1), [[2, 6], [9, 10], [18, 19], [22, 25]]], [('0010101000110', 7, 3, 0, 0), [[5, 7], [9, 12], [14, 16], [23, 28]]], [('1100001111', 9, 4, 0, 0), [[0, 5], [14, 23]]], [('000010010001', 9, 4, 1, 0), [[9, 10], [16, 17], [25, 26]]], [('1000110000', 2, 1, 1, 0), [[0, 1], [8, 11]]], [('00101', 3, 1, 1, 3), [[15, 17], [21, 23]]]], [[('00010110011', 7, 3, 2, 3), [[14, 15], [19, 21], [28, 31]]], [('01001111110', 5, 2, 1, 3), [[10, 12], [18, 32]]], [('111000011001', 11, 5, 0, 1), [[2, 9], [18, 22], [26, 29]]], [('100110010100', 1, 1, 0, 1), [[1, 2], [4, 6], [8, 9], [10, 11]]], [('011100100', 1, 1, 2, 10), [[11, 12], [16, 17]]], [('01011', 3, 1, 0, 0), [[3, 6], [9, 15]]], [('100000010', 9, 4, 1, 0), [[0, 1], [16, 17]]], [('11000100111001', 5, 2, 1, 10), [[25, 29], [38, 39], [45, 52], [58, 59]]]], [[('00101011101', 7, 3, 1, 10), [[28, 29], [33, 34], [37, 43], [47, 48]]], [('1000010110000', 7, 3, 0, 1), [[2, 5], [14, 16], [19, 23]]], [('010110111001', 11, 5, 1, 1), [[4, 6], [9, 12], [15, 21], [26, 28]]], [('11001111', 2, 1, 2, 0), [[0, 2], [8, 14]]], [('1', 5, 2, 1, 0), [[0, 2]]], [('010011110', 7, 3, 2, 0), [[2, 3], [9, 17]]], [('0', 7, 3, 0, 0), []], [('0000001100111', 2, 1, 2, 3), [[18, 20], [26, 30]]]], [[('10111101000110', 7, 3, 0, 3), [[7, 9], [12, 21], [23, 26], [33, 37]]], [('00101011000', 9, 4, 0, 1), [[7, 9], [11, 14], [16, 20]]], [('0100100100', 4, 3, 0, 10), [[15, 16], [19, 20], [23, 24]]], [('0001011111001', 1, 1, 0, 1), [[4, 5], [6, 11], [13, 14]]], [('100011111110', 11, 5, 0, 0), [[0, 2], [9, 24]]], [('000011', 9, 4, 0, 0), [[9, 14]]], [('1110011100111', 1, 1, 2, 10), [[10, 11], [15, 16], [20, 21]]], [('0010110011101', 3, 1, 1, 1), [[9, 11], [15, 20], [27, 35], [39, 41]]]]]
labels = ["regression: quiet zone units", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), 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
regression: quiet zone units 0[[7, 15]][[8, 16]]Failed
repair trap 1[[6, 8], [10, 15]][[7, 8], [11, 15]]Failed
combined fault 2[[1, 4], [9, 12]][[3, 6], [10, 13]]Failed
control 3[[2, 3], [7, 16]][[2, 3], [7, 16]]Passed
control 4[[5, 6], [7, 8]][[5, 6], [7, 8]]Passed
boundary 5[[0, 2], [4, 9], [13, 15], [18, 20]][[0, 2], [4, 9], [13, 15], [18, 20]]Passed
boundary 6[[6, 9], [12, 15]][[6, 9], [12, 15]]Passed
control 7[[13, 17]][[28, 32]]Failed

SHA-256 / 51a14ca792f695346f87e2da4b5ed17e405adfd5aeced625438e15d2df523afa

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(mods, xn, xd, bwr, quiet):
    X = Fraction(xn, xd)
    def edge(i):
        return math.floor(i * X + Fraction(1, 2)) + math.floor(quiet * X)
    bars = []
    i = 0
    n = len(mods)
    while i < n:
        if mods[i] == '1':
            j = i
            while j < n and mods[j] == '1':
                j += 1
            s, e = edge(i), edge(j) - bwr
            if e - s < 1:
                e = s + 1
            bars.append([s, e])
            i = j
        else:
            i += 1
    return bars
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('0001111', 2, 1, 0, 1), [[8, 16]]], [('000011011110', 4, 3, 1, 1), [[7, 8], [11, 15]]], [('11011', 5, 2, 2, 1), [[3, 6], [10, 13]]], [('010111110', 11, 5, 2, 0), [[2, 3], [7, 16]]], [('00001010', 1, 1, 0, 1), [[5, 6], [7, 8]]], [('101100101', 11, 5, 0, 0), [[0, 2], [4, 9], [13, 15], [18, 20]]], [('00101', 3, 1, 0, 0), [[6, 9], [12, 15]]], [('011', 5, 2, 1, 10), [[28, 32]]]], [[('0011000', 3, 1, 2, 3), [[15, 19]]], [('110', 11, 5, 0, 3), [[7, 11]]], [('11010001011', 11, 5, 1, 1), [[2, 6], [9, 10], [18, 19], [22, 25]]], [('0010101000110', 7, 3, 0, 0), [[5, 7], [9, 12], [14, 16], [23, 28]]], [('1100001111', 9, 4, 0, 0), [[0, 5], [14, 23]]], [('000010010001', 9, 4, 1, 0), [[9, 10], [16, 17], [25, 26]]], [('1000110000', 2, 1, 1, 0), [[0, 1], [8, 11]]], [('00101', 3, 1, 1, 3), [[15, 17], [21, 23]]]], [[('00010110011', 7, 3, 2, 3), [[14, 15], [19, 21], [28, 31]]], [('01001111110', 5, 2, 1, 3), [[10, 12], [18, 32]]], [('111000011001', 11, 5, 0, 1), [[2, 9], [18, 22], [26, 29]]], [('100110010100', 1, 1, 0, 1), [[1, 2], [4, 6], [8, 9], [10, 11]]], [('011100100', 1, 1, 2, 10), [[11, 12], [16, 17]]], [('01011', 3, 1, 0, 0), [[3, 6], [9, 15]]], [('100000010', 9, 4, 1, 0), [[0, 1], [16, 17]]], [('11000100111001', 5, 2, 1, 10), [[25, 29], [38, 39], [45, 52], [58, 59]]]], [[('00101011101', 7, 3, 1, 10), [[28, 29], [33, 34], [37, 43], [47, 48]]], [('1000010110000', 7, 3, 0, 1), [[2, 5], [14, 16], [19, 23]]], [('010110111001', 11, 5, 1, 1), [[4, 6], [9, 12], [15, 21], [26, 28]]], [('11001111', 2, 1, 2, 0), [[0, 2], [8, 14]]], [('1', 5, 2, 1, 0), [[0, 2]]], [('010011110', 7, 3, 2, 0), [[2, 3], [9, 17]]], [('0', 7, 3, 0, 0), []], [('0000001100111', 2, 1, 2, 3), [[18, 20], [26, 30]]]], [[('10111101000110', 7, 3, 0, 3), [[7, 9], [12, 21], [23, 26], [33, 37]]], [('00101011000', 9, 4, 0, 1), [[7, 9], [11, 14], [16, 20]]], [('0100100100', 4, 3, 0, 10), [[15, 16], [19, 20], [23, 24]]], [('0001011111001', 1, 1, 0, 1), [[4, 5], [6, 11], [13, 14]]], [('100011111110', 11, 5, 0, 0), [[0, 2], [9, 24]]], [('000011', 9, 4, 0, 0), [[9, 14]]], [('1110011100111', 1, 1, 2, 10), [[10, 11], [15, 16], [20, 21]]], [('0010110011101', 3, 1, 1, 1), [[9, 11], [15, 20], [27, 35], [39, 41]]]]]
labels = ["regression: quiet zone units", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), 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
regression: quiet zone units 0[[8, 16]][[8, 16]]Passed
repair trap 1[[6, 8], [10, 15]][[7, 8], [11, 15]]Failed
combined fault 2[[2, 5], [10, 13]][[3, 6], [10, 13]]Failed
control 3[[2, 3], [7, 16]][[2, 3], [7, 16]]Passed
control 4[[5, 6], [7, 8]][[5, 6], [7, 8]]Passed
boundary 5[[0, 2], [4, 9], [13, 15], [18, 20]][[0, 2], [4, 9], [13, 15], [18, 20]]Passed
boundary 6[[6, 9], [12, 15]][[6, 9], [12, 15]]Passed
control 7[[28, 32]][[28, 32]]Passed

SHA-256 / fc6388747337aac7df9883410e6b947ab1da9fa61aae770552019a013b7d7c70

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(mods, xn, xd, bwr, quiet):
    X = Fraction(xn, xd)
    def edge(i):
        return math.floor((quiet + i) * X + Fraction(1, 2))
    bars = []
    i = 0
    n = len(mods)
    while i < n:
        if mods[i] == '1':
            j = i
            while j < n and mods[j] == '1':
                j += 1
            s, e = edge(i), edge(j) - bwr
            if e - s < 1:
                e = s + 1
            bars.append([s, e])
            i = j
        else:
            i += 1
    return bars
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('0001111', 2, 1, 0, 1), [[8, 16]]], [('000011011110', 4, 3, 1, 1), [[7, 8], [11, 15]]], [('11011', 5, 2, 2, 1), [[3, 6], [10, 13]]], [('010111110', 11, 5, 2, 0), [[2, 3], [7, 16]]], [('00001010', 1, 1, 0, 1), [[5, 6], [7, 8]]], [('101100101', 11, 5, 0, 0), [[0, 2], [4, 9], [13, 15], [18, 20]]], [('00101', 3, 1, 0, 0), [[6, 9], [12, 15]]], [('011', 5, 2, 1, 10), [[28, 32]]]], [[('0011000', 3, 1, 2, 3), [[15, 19]]], [('110', 11, 5, 0, 3), [[7, 11]]], [('11010001011', 11, 5, 1, 1), [[2, 6], [9, 10], [18, 19], [22, 25]]], [('0010101000110', 7, 3, 0, 0), [[5, 7], [9, 12], [14, 16], [23, 28]]], [('1100001111', 9, 4, 0, 0), [[0, 5], [14, 23]]], [('000010010001', 9, 4, 1, 0), [[9, 10], [16, 17], [25, 26]]], [('1000110000', 2, 1, 1, 0), [[0, 1], [8, 11]]], [('00101', 3, 1, 1, 3), [[15, 17], [21, 23]]]], [[('00010110011', 7, 3, 2, 3), [[14, 15], [19, 21], [28, 31]]], [('01001111110', 5, 2, 1, 3), [[10, 12], [18, 32]]], [('111000011001', 11, 5, 0, 1), [[2, 9], [18, 22], [26, 29]]], [('100110010100', 1, 1, 0, 1), [[1, 2], [4, 6], [8, 9], [10, 11]]], [('011100100', 1, 1, 2, 10), [[11, 12], [16, 17]]], [('01011', 3, 1, 0, 0), [[3, 6], [9, 15]]], [('100000010', 9, 4, 1, 0), [[0, 1], [16, 17]]], [('11000100111001', 5, 2, 1, 10), [[25, 29], [38, 39], [45, 52], [58, 59]]]], [[('00101011101', 7, 3, 1, 10), [[28, 29], [33, 34], [37, 43], [47, 48]]], [('1000010110000', 7, 3, 0, 1), [[2, 5], [14, 16], [19, 23]]], [('010110111001', 11, 5, 1, 1), [[4, 6], [9, 12], [15, 21], [26, 28]]], [('11001111', 2, 1, 2, 0), [[0, 2], [8, 14]]], [('1', 5, 2, 1, 0), [[0, 2]]], [('010011110', 7, 3, 2, 0), [[2, 3], [9, 17]]], [('0', 7, 3, 0, 0), []], [('0000001100111', 2, 1, 2, 3), [[18, 20], [26, 30]]]], [[('10111101000110', 7, 3, 0, 3), [[7, 9], [12, 21], [23, 26], [33, 37]]], [('00101011000', 9, 4, 0, 1), [[7, 9], [11, 14], [16, 20]]], [('0100100100', 4, 3, 0, 10), [[15, 16], [19, 20], [23, 24]]], [('0001011111001', 1, 1, 0, 1), [[4, 5], [6, 11], [13, 14]]], [('100011111110', 11, 5, 0, 0), [[0, 2], [9, 24]]], [('000011', 9, 4, 0, 0), [[9, 14]]], [('1110011100111', 1, 1, 2, 10), [[10, 11], [15, 16], [20, 21]]], [('0010110011101', 3, 1, 1, 1), [[9, 11], [15, 20], [27, 35], [39, 41]]]]]
labels = ["regression: quiet zone units", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), 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
regression: quiet zone units 0[[8, 16]][[8, 16]]Passed
repair trap 1[[7, 8], [11, 15]][[7, 8], [11, 15]]Passed
combined fault 2[[3, 6], [10, 13]][[3, 6], [10, 13]]Passed
control 3[[2, 3], [7, 16]][[2, 3], [7, 16]]Passed
control 4[[5, 6], [7, 8]][[5, 6], [7, 8]]Passed
boundary 5[[0, 2], [4, 9], [13, 15], [18, 20]][[0, 2], [4, 9], [13, 15], [18, 20]]Passed
boundary 6[[6, 9], [12, 15]][[6, 9], [12, 15]]Passed
control 7[[28, 32]][[28, 32]]Passed

SHA-256 / b60fd8a0c3e87df5e0f0fe551a68090de7ef19361806e30703394bfe80f1588c

Verification & scope

A deterministic bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. 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:49:47.533309+00:00.

Case digest / a70d1a413736564bd3d4d5216399b86d78d784dd1e5d8c8e24a06a73da9407e6