FA-79496 / Barcode symbology encoding / Open access
Add-on gap is added on top of the main right quiet zone · case 01
Symbols with add-ons are wider than the allowed label area.
ROOT CAUSE
The main symbol right quiet zone is kept and the gap is added after it.
VERIFIED REPAIR
The 7-module gap replaces the main right quiet zone.
Unsuccessful approach: Using the 12-module maximum gap overstates the width by five modules.
Case contract
Input {sym, modules, x_um, addon?}. Quiet zones in X: ean13 11 left / 7 right, upca 9/9, ean8 7/7, code128, code39 and itf14 10/10. Allowed X-dimensions in micrometres: EAN/UPC 264..660 inclusive, code128/code39 >= 190, itf14 >= 495. An EAN-2 (20 modules) or EAN-5 (47 modules) add-on is only allowed on EAN/UPC; it replaces the right quiet zone by a 7-module gap, the add-on and a 5-module trailing quiet zone. Return [total_um, left_quiet_um] or unknown/x-out-of-range/bad-addon.
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
N = 1
observations = []
def solve(spec):
qz = {'ean13': (11, 7), 'upca': (9, 9), 'ean8': (7, 7), 'code128': (10, 10), 'code39': (10, 10), 'itf14': (10, 10)}
xr = {'ean13': (264, 660), 'upca': (264, 660), 'ean8': (264, 660), 'code128': (190, None), 'code39': (190, None), 'itf14': (495, None)}
sym = spec['sym']
if sym not in qz:
return 'unknown'
lo, hi = xr[sym]
x = spec['x_um']
if x < lo or (hi is not None and x > hi):
return 'x-out-of-range'
left, right = qz[sym]
addon = spec.get('addon', 0)
if addon:
if sym not in ('ean13', 'upca', 'ean8') or addon not in (2, 5):
return 'bad-addon'
right = right + 7 + (20 if addon == 2 else 47) + 5
total = left + spec['modules'] + right
return [total * x, left * x]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[{'sym': 'ean13', 'modules': 101, 'x_um': 495, 'addon': 5}, [84645, 5445]], [{'sym': 'upca', 'modules': 95, 'x_um': 300, 'addon': 5}, [48900, 2700]], [{'sym': 'code39', 'modules': 200, 'x_um': 661}, [145420, 6610]], [{'sym': 'ean13', 'modules': 67, 'x_um': 330}, [28050, 3630]], [{'sym': 'qr', 'modules': 200, 'x_um': 250, 'addon': 2}, 'unknown'], [{'sym': 'ean8', 'modules': 101, 'x_um': 1100, 'addon': 5}, 'x-out-of-range'], [{'sym': 'code128', 'modules': 200, 'x_um': 1000, 'addon': 5}, 'bad-addon'], [{'sym': 'ean8', 'modules': 95, 'x_um': 264, 'addon': 2}, [35376, 1848]]], [[{'sym': 'ean8', 'modules': 95, 'x_um': 264, 'addon': 5}, [42504, 1848]], [{'sym': 'upca', 'modules': 101, 'x_um': 660, 'addon': 2}, [93720, 5940]], [{'sym': 'itf14', 'modules': 67, 'x_um': 1000}, [87000, 10000]], [{'sym': 'itf14', 'modules': 67, 'x_um': 250}, 'x-out-of-range'], [{'sym': 'code128', 'modules': 200, 'x_um': 660}, [145200, 6600]], [{'sym': 'ean13', 'modules': 95, 'x_um': 661}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 95, 'x_um': 190}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 101, 'x_um': 400, 'addon': 2}, [57600, 4400]]], [[{'sym': 'ean8', 'modules': 95, 'x_um': 300, 'addon': 2}, [40200, 2100]], [{'sym': 'ean13', 'modules': 101, 'x_um': 264, 'addon': 5}, [45144, 2904]], [{'sym': 'ean13', 'modules': 200, 'x_um': 190}, 'x-out-of-range'], [{'sym': 'code39', 'modules': 101, 'x_um': 400}, [48400, 4000]], [{'sym': 'itf14', 'modules': 95, 'x_um': 263, 'addon': 5}, 'x-out-of-range'], [{'sym': 'code39', 'modules': 101, 'x_um': 190, 'addon': 3}, 'bad-addon'], [{'sym': 'itf14', 'modules': 200, 'x_um': 263}, 'x-out-of-range'], [{'sym': 'ean8', 'modules': 67, 'x_um': 264, 'addon': 5}, [35112, 1848]]], [[{'sym': 'ean13', 'modules': 95, 'x_um': 264, 'addon': 2}, [36432, 2904]], [{'sym': 'upca', 'modules': 142, 'x_um': 264, 'addon': 5}, [55440, 2376]], [{'sym': 'code39', 'modules': 67, 'x_um': 330, 'addon': 2}, 'bad-addon'], [{'sym': 'ean13', 'modules': 101, 'x_um': 1100}, 'x-out-of-range'], [{'sym': 'itf14', 'modules': 95, 'x_um': 264, 'addon': 2}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 67, 'x_um': 661}, 'x-out-of-range'], [{'sym': 'itf14', 'modules': 67, 'x_um': 1100, 'addon': 3}, 'bad-addon'], [{'sym': 'ean13', 'modules': 67, 'x_um': 330, 'addon': 5}, [45210, 3630]]], [[{'sym': 'ean13', 'modules': 142, 'x_um': 264, 'addon': 5}, [55968, 2904]], [{'sym': 'ean13', 'modules': 142, 'x_um': 264, 'addon': 2}, [48840, 2904]], [{'sym': 'ean13', 'modules': 67, 'x_um': 330}, [28050, 3630]], [{'sym': 'ean13', 'modules': 101, 'x_um': 264}, [31416, 2904]], [{'sym': 'code128', 'modules': 101, 'x_um': 400}, [48400, 4000]], [{'sym': 'ean13', 'modules': 101, 'x_um': 660}, [78540, 7260]], [{'sym': 'upca', 'modules': 101, 'x_um': 1100}, 'x-out-of-range'], [{'sym': 'ean8', 'modules': 95, 'x_um': 330, 'addon': 2}, [44220, 2310]]]]
labels = ["regression: gap replacing the main right quiet zone", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: gap replacing the main right quiet zone 0 | [88110, 5445] | [84645, 5445] | Failed |
| repair trap 1 | [51600, 2700] | [48900, 2700] | Failed |
| combined fault 2 | [145420, 6610] | [145420, 6610] | Passed |
| control 3 | [28050, 3630] | [28050, 3630] | Passed |
| control 4 | unknown | unknown | Passed |
| boundary 5 | x-out-of-range | x-out-of-range | Passed |
| boundary 6 | bad-addon | bad-addon | Passed |
| control 7 | [37224, 1848] | [35376, 1848] | Failed |
SHA-256 / 2e7bcff652181f3379f04532b1981a87453cdc3c482c9b419b4c177f66998cda
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(spec):
qz = {'ean13': (11, 7), 'upca': (9, 9), 'ean8': (7, 7), 'code128': (10, 10), 'code39': (10, 10), 'itf14': (10, 10)}
xr = {'ean13': (264, 660), 'upca': (264, 660), 'ean8': (264, 660), 'code128': (190, None), 'code39': (190, None), 'itf14': (495, None)}
sym = spec['sym']
if sym not in qz:
return 'unknown'
lo, hi = xr[sym]
x = spec['x_um']
if x < lo or (hi is not None and x > hi):
return 'x-out-of-range'
left, right = qz[sym]
addon = spec.get('addon', 0)
if addon:
if sym not in ('ean13', 'upca', 'ean8') or addon not in (2, 5):
return 'bad-addon'
right = 12 + (20 if addon == 2 else 47) + 5
total = left + spec['modules'] + right
return [total * x, left * x]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[{'sym': 'ean13', 'modules': 101, 'x_um': 495, 'addon': 5}, [84645, 5445]], [{'sym': 'upca', 'modules': 95, 'x_um': 300, 'addon': 5}, [48900, 2700]], [{'sym': 'code39', 'modules': 200, 'x_um': 661}, [145420, 6610]], [{'sym': 'ean13', 'modules': 67, 'x_um': 330}, [28050, 3630]], [{'sym': 'qr', 'modules': 200, 'x_um': 250, 'addon': 2}, 'unknown'], [{'sym': 'ean8', 'modules': 101, 'x_um': 1100, 'addon': 5}, 'x-out-of-range'], [{'sym': 'code128', 'modules': 200, 'x_um': 1000, 'addon': 5}, 'bad-addon'], [{'sym': 'ean8', 'modules': 95, 'x_um': 264, 'addon': 2}, [35376, 1848]]], [[{'sym': 'ean8', 'modules': 95, 'x_um': 264, 'addon': 5}, [42504, 1848]], [{'sym': 'upca', 'modules': 101, 'x_um': 660, 'addon': 2}, [93720, 5940]], [{'sym': 'itf14', 'modules': 67, 'x_um': 1000}, [87000, 10000]], [{'sym': 'itf14', 'modules': 67, 'x_um': 250}, 'x-out-of-range'], [{'sym': 'code128', 'modules': 200, 'x_um': 660}, [145200, 6600]], [{'sym': 'ean13', 'modules': 95, 'x_um': 661}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 95, 'x_um': 190}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 101, 'x_um': 400, 'addon': 2}, [57600, 4400]]], [[{'sym': 'ean8', 'modules': 95, 'x_um': 300, 'addon': 2}, [40200, 2100]], [{'sym': 'ean13', 'modules': 101, 'x_um': 264, 'addon': 5}, [45144, 2904]], [{'sym': 'ean13', 'modules': 200, 'x_um': 190}, 'x-out-of-range'], [{'sym': 'code39', 'modules': 101, 'x_um': 400}, [48400, 4000]], [{'sym': 'itf14', 'modules': 95, 'x_um': 263, 'addon': 5}, 'x-out-of-range'], [{'sym': 'code39', 'modules': 101, 'x_um': 190, 'addon': 3}, 'bad-addon'], [{'sym': 'itf14', 'modules': 200, 'x_um': 263}, 'x-out-of-range'], [{'sym': 'ean8', 'modules': 67, 'x_um': 264, 'addon': 5}, [35112, 1848]]], [[{'sym': 'ean13', 'modules': 95, 'x_um': 264, 'addon': 2}, [36432, 2904]], [{'sym': 'upca', 'modules': 142, 'x_um': 264, 'addon': 5}, [55440, 2376]], [{'sym': 'code39', 'modules': 67, 'x_um': 330, 'addon': 2}, 'bad-addon'], [{'sym': 'ean13', 'modules': 101, 'x_um': 1100}, 'x-out-of-range'], [{'sym': 'itf14', 'modules': 95, 'x_um': 264, 'addon': 2}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 67, 'x_um': 661}, 'x-out-of-range'], [{'sym': 'itf14', 'modules': 67, 'x_um': 1100, 'addon': 3}, 'bad-addon'], [{'sym': 'ean13', 'modules': 67, 'x_um': 330, 'addon': 5}, [45210, 3630]]], [[{'sym': 'ean13', 'modules': 142, 'x_um': 264, 'addon': 5}, [55968, 2904]], [{'sym': 'ean13', 'modules': 142, 'x_um': 264, 'addon': 2}, [48840, 2904]], [{'sym': 'ean13', 'modules': 67, 'x_um': 330}, [28050, 3630]], [{'sym': 'ean13', 'modules': 101, 'x_um': 264}, [31416, 2904]], [{'sym': 'code128', 'modules': 101, 'x_um': 400}, [48400, 4000]], [{'sym': 'ean13', 'modules': 101, 'x_um': 660}, [78540, 7260]], [{'sym': 'upca', 'modules': 101, 'x_um': 1100}, 'x-out-of-range'], [{'sym': 'ean8', 'modules': 95, 'x_um': 330, 'addon': 2}, [44220, 2310]]]]
labels = ["regression: gap replacing the main right quiet zone", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: gap replacing the main right quiet zone 0 | [87120, 5445] | [84645, 5445] | Failed |
| repair trap 1 | [50400, 2700] | [48900, 2700] | Failed |
| combined fault 2 | [145420, 6610] | [145420, 6610] | Passed |
| control 3 | [28050, 3630] | [28050, 3630] | Passed |
| control 4 | unknown | unknown | Passed |
| boundary 5 | x-out-of-range | x-out-of-range | Passed |
| boundary 6 | bad-addon | bad-addon | Passed |
| control 7 | [36696, 1848] | [35376, 1848] | Failed |
SHA-256 / 2c8ef272fdeed75bd4e492f97da9beedfcf8a2b7aad43cac75af9cb46dc8137d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(spec):
qz = {'ean13': (11, 7), 'upca': (9, 9), 'ean8': (7, 7), 'code128': (10, 10), 'code39': (10, 10), 'itf14': (10, 10)}
xr = {'ean13': (264, 660), 'upca': (264, 660), 'ean8': (264, 660), 'code128': (190, None), 'code39': (190, None), 'itf14': (495, None)}
sym = spec['sym']
if sym not in qz:
return 'unknown'
lo, hi = xr[sym]
x = spec['x_um']
if x < lo or (hi is not None and x > hi):
return 'x-out-of-range'
left, right = qz[sym]
addon = spec.get('addon', 0)
if addon:
if sym not in ('ean13', 'upca', 'ean8') or addon not in (2, 5):
return 'bad-addon'
right = 7 + (20 if addon == 2 else 47) + 5
total = left + spec['modules'] + right
return [total * x, left * x]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[{'sym': 'ean13', 'modules': 101, 'x_um': 495, 'addon': 5}, [84645, 5445]], [{'sym': 'upca', 'modules': 95, 'x_um': 300, 'addon': 5}, [48900, 2700]], [{'sym': 'code39', 'modules': 200, 'x_um': 661}, [145420, 6610]], [{'sym': 'ean13', 'modules': 67, 'x_um': 330}, [28050, 3630]], [{'sym': 'qr', 'modules': 200, 'x_um': 250, 'addon': 2}, 'unknown'], [{'sym': 'ean8', 'modules': 101, 'x_um': 1100, 'addon': 5}, 'x-out-of-range'], [{'sym': 'code128', 'modules': 200, 'x_um': 1000, 'addon': 5}, 'bad-addon'], [{'sym': 'ean8', 'modules': 95, 'x_um': 264, 'addon': 2}, [35376, 1848]]], [[{'sym': 'ean8', 'modules': 95, 'x_um': 264, 'addon': 5}, [42504, 1848]], [{'sym': 'upca', 'modules': 101, 'x_um': 660, 'addon': 2}, [93720, 5940]], [{'sym': 'itf14', 'modules': 67, 'x_um': 1000}, [87000, 10000]], [{'sym': 'itf14', 'modules': 67, 'x_um': 250}, 'x-out-of-range'], [{'sym': 'code128', 'modules': 200, 'x_um': 660}, [145200, 6600]], [{'sym': 'ean13', 'modules': 95, 'x_um': 661}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 95, 'x_um': 190}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 101, 'x_um': 400, 'addon': 2}, [57600, 4400]]], [[{'sym': 'ean8', 'modules': 95, 'x_um': 300, 'addon': 2}, [40200, 2100]], [{'sym': 'ean13', 'modules': 101, 'x_um': 264, 'addon': 5}, [45144, 2904]], [{'sym': 'ean13', 'modules': 200, 'x_um': 190}, 'x-out-of-range'], [{'sym': 'code39', 'modules': 101, 'x_um': 400}, [48400, 4000]], [{'sym': 'itf14', 'modules': 95, 'x_um': 263, 'addon': 5}, 'x-out-of-range'], [{'sym': 'code39', 'modules': 101, 'x_um': 190, 'addon': 3}, 'bad-addon'], [{'sym': 'itf14', 'modules': 200, 'x_um': 263}, 'x-out-of-range'], [{'sym': 'ean8', 'modules': 67, 'x_um': 264, 'addon': 5}, [35112, 1848]]], [[{'sym': 'ean13', 'modules': 95, 'x_um': 264, 'addon': 2}, [36432, 2904]], [{'sym': 'upca', 'modules': 142, 'x_um': 264, 'addon': 5}, [55440, 2376]], [{'sym': 'code39', 'modules': 67, 'x_um': 330, 'addon': 2}, 'bad-addon'], [{'sym': 'ean13', 'modules': 101, 'x_um': 1100}, 'x-out-of-range'], [{'sym': 'itf14', 'modules': 95, 'x_um': 264, 'addon': 2}, 'x-out-of-range'], [{'sym': 'ean13', 'modules': 67, 'x_um': 661}, 'x-out-of-range'], [{'sym': 'itf14', 'modules': 67, 'x_um': 1100, 'addon': 3}, 'bad-addon'], [{'sym': 'ean13', 'modules': 67, 'x_um': 330, 'addon': 5}, [45210, 3630]]], [[{'sym': 'ean13', 'modules': 142, 'x_um': 264, 'addon': 5}, [55968, 2904]], [{'sym': 'ean13', 'modules': 142, 'x_um': 264, 'addon': 2}, [48840, 2904]], [{'sym': 'ean13', 'modules': 67, 'x_um': 330}, [28050, 3630]], [{'sym': 'ean13', 'modules': 101, 'x_um': 264}, [31416, 2904]], [{'sym': 'code128', 'modules': 101, 'x_um': 400}, [48400, 4000]], [{'sym': 'ean13', 'modules': 101, 'x_um': 660}, [78540, 7260]], [{'sym': 'upca', 'modules': 101, 'x_um': 1100}, 'x-out-of-range'], [{'sym': 'ean8', 'modules': 95, 'x_um': 330, 'addon': 2}, [44220, 2310]]]]
labels = ["regression: gap replacing the main right quiet zone", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: gap replacing the main right quiet zone 0 | [84645, 5445] | [84645, 5445] | Passed |
| repair trap 1 | [48900, 2700] | [48900, 2700] | Passed |
| combined fault 2 | [145420, 6610] | [145420, 6610] | Passed |
| control 3 | [28050, 3630] | [28050, 3630] | Passed |
| control 4 | unknown | unknown | Passed |
| boundary 5 | x-out-of-range | x-out-of-range | Passed |
| boundary 6 | bad-addon | bad-addon | Passed |
| control 7 | [35376, 1848] | [35376, 1848] | Passed |
SHA-256 / bc75a3449a428af9c1bb6de89d6b839a2d7fdad45618b6b04761afb7f1186c86
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:45.072187+00:00.
Case digest / 0d365ffdf20a857f1b95e725bccd208cf39c68dd19cee3bca4b36affb011cc70