FAILURE MAP
← Case archive

FA-45186 / Data systems / Open access

Batch packing accounts one byte per row regardless of row size · case 01

Batch packing accounts one byte per row regardless of row size.

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

ROOT CAUSE

row-batch-packing: Batch packing accounts one byte per row regardless of row size.

VERIFIED REPAIR

Preserve the stated physical representation and operation order: Pack indivisible [id,size] rows into ordered batches under a positive byte budget. A row exceeding budget occupies its own batch. Flush before an overflowing row, permit exact fits, and omit empty batches.

Unsuccessful approach: Replacing cumulative bytes with the last row size undercounts batches.

Case contract

Pack indivisible [id,size] rows into ordered batches under a positive byte budget. A row exceeding budget occupies its own batch. Flush before an overflowing row, permit exact fits, and omit empty batches.

Why this case matters

A bounded deterministic data engine model makes representation and changelog faults reproducible.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        rows,budget=d
        batches=[]; current=[]; used=0
        for ident,size in rows:
            if current and used+size>budget:
                batches.append(current); current=[]; used=0
            current.append(ident); used+=1
            if size>budget:
                batches.append(current); current=[]; used=0
        if current: batches.append(current)
        return batches
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('exact fit', solve([[[1, 1], [2, 1]], 2]), [[1, 2]])
    check('byte budget', solve([[[1, 2], [2, 2], [3, 1]], 3]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 2], [2, 2], [3, 1], [4, 1]], 3]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 4], [2, 0]], 3]), [[1], [2]])
    check('full followed by zero', solve([[[1, 3], [2, 0]], 3]), [[1, 2]])
    check('single partial', solve([[[1, 1]], 3]), [[1]])
    check('no rows', solve([[], 3]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 1]), [[1, 2]])
elif N == 2:
    check('exact fit', solve([[[1, 2], [2, 2]], 4]), [[1, 2]])
    check('byte budget', solve([[[1, 4], [2, 4], [3, 2]], 6]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 4], [2, 4], [3, 2], [4, 2]], 6]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 8], [2, 0]], 6]), [[1], [2]])
    check('full followed by zero', solve([[[1, 6], [2, 0]], 6]), [[1, 2]])
    check('single partial', solve([[[1, 2]], 6]), [[1]])
    check('no rows', solve([[], 6]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 2]), [[1, 2]])
elif N == 3:
    check('exact fit', solve([[[1, 3], [2, 3]], 6]), [[1, 2]])
    check('byte budget', solve([[[1, 6], [2, 6], [3, 3]], 9]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 6], [2, 6], [3, 3], [4, 3]], 9]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 12], [2, 0]], 9]), [[1], [2]])
    check('full followed by zero', solve([[[1, 9], [2, 0]], 9]), [[1, 2]])
    check('single partial', solve([[[1, 3]], 9]), [[1]])
    check('no rows', solve([[], 9]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 3]), [[1, 2]])
elif N == 4:
    check('exact fit', solve([[[1, 4], [2, 4]], 8]), [[1, 2]])
    check('byte budget', solve([[[1, 8], [2, 8], [3, 4]], 12]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 8], [2, 8], [3, 4], [4, 4]], 12]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 16], [2, 0]], 12]), [[1], [2]])
    check('full followed by zero', solve([[[1, 12], [2, 0]], 12]), [[1, 2]])
    check('single partial', solve([[[1, 4]], 12]), [[1]])
    check('no rows', solve([[], 12]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 4]), [[1, 2]])
elif N == 5:
    check('exact fit', solve([[[1, 5], [2, 5]], 10]), [[1, 2]])
    check('byte budget', solve([[[1, 10], [2, 10], [3, 5]], 15]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 10], [2, 10], [3, 5], [4, 5]], 15]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 20], [2, 0]], 15]), [[1], [2]])
    check('full followed by zero', solve([[[1, 15], [2, 0]], 15]), [[1, 2]])
    check('single partial', solve([[[1, 5]], 15]), [[1]])
    check('no rows', solve([[], 15]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 5]), [[1, 2]])
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
exact fit[[1, 2]][[1, 2]]Passed
byte budget[[1, 2, 3]][[1], [2, 3]]Failed
reset after flush[[1, 2, 3], [4]][[1], [2, 3], [4]]Failed
oversize and zero[[1], [2]][[1], [2]]Passed
full followed by zero[[1, 2]][[1, 2]]Passed
single partial[[1]][[1]]Passed
no rows[][]Passed
zero-sized rows[[1, 2]][[1, 2]]Passed

SHA-256 / dd9cea8e6115709dc78b70355aab40ee9af3e9ce4fcb90611850024bcc0b16f8

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        rows,budget=d
        batches=[]; current=[]; used=0
        for ident,size in rows:
            if current and used+size>budget:
                batches.append(current); current=[]; used=0
            current.append(ident); used=size
            if size>budget:
                batches.append(current); current=[]; used=0
        if current: batches.append(current)
        return batches
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('exact fit', solve([[[1, 1], [2, 1]], 2]), [[1, 2]])
    check('byte budget', solve([[[1, 2], [2, 2], [3, 1]], 3]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 2], [2, 2], [3, 1], [4, 1]], 3]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 4], [2, 0]], 3]), [[1], [2]])
    check('full followed by zero', solve([[[1, 3], [2, 0]], 3]), [[1, 2]])
    check('single partial', solve([[[1, 1]], 3]), [[1]])
    check('no rows', solve([[], 3]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 1]), [[1, 2]])
elif N == 2:
    check('exact fit', solve([[[1, 2], [2, 2]], 4]), [[1, 2]])
    check('byte budget', solve([[[1, 4], [2, 4], [3, 2]], 6]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 4], [2, 4], [3, 2], [4, 2]], 6]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 8], [2, 0]], 6]), [[1], [2]])
    check('full followed by zero', solve([[[1, 6], [2, 0]], 6]), [[1, 2]])
    check('single partial', solve([[[1, 2]], 6]), [[1]])
    check('no rows', solve([[], 6]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 2]), [[1, 2]])
elif N == 3:
    check('exact fit', solve([[[1, 3], [2, 3]], 6]), [[1, 2]])
    check('byte budget', solve([[[1, 6], [2, 6], [3, 3]], 9]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 6], [2, 6], [3, 3], [4, 3]], 9]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 12], [2, 0]], 9]), [[1], [2]])
    check('full followed by zero', solve([[[1, 9], [2, 0]], 9]), [[1, 2]])
    check('single partial', solve([[[1, 3]], 9]), [[1]])
    check('no rows', solve([[], 9]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 3]), [[1, 2]])
elif N == 4:
    check('exact fit', solve([[[1, 4], [2, 4]], 8]), [[1, 2]])
    check('byte budget', solve([[[1, 8], [2, 8], [3, 4]], 12]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 8], [2, 8], [3, 4], [4, 4]], 12]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 16], [2, 0]], 12]), [[1], [2]])
    check('full followed by zero', solve([[[1, 12], [2, 0]], 12]), [[1, 2]])
    check('single partial', solve([[[1, 4]], 12]), [[1]])
    check('no rows', solve([[], 12]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 4]), [[1, 2]])
elif N == 5:
    check('exact fit', solve([[[1, 5], [2, 5]], 10]), [[1, 2]])
    check('byte budget', solve([[[1, 10], [2, 10], [3, 5]], 15]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 10], [2, 10], [3, 5], [4, 5]], 15]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 20], [2, 0]], 15]), [[1], [2]])
    check('full followed by zero', solve([[[1, 15], [2, 0]], 15]), [[1, 2]])
    check('single partial', solve([[[1, 5]], 15]), [[1]])
    check('no rows', solve([[], 15]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 5]), [[1, 2]])
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
exact fit[[1, 2]][[1, 2]]Passed
byte budget[[1], [2, 3]][[1], [2, 3]]Passed
reset after flush[[1], [2, 3, 4]][[1], [2, 3], [4]]Failed
oversize and zero[[1], [2]][[1], [2]]Passed
full followed by zero[[1, 2]][[1, 2]]Passed
single partial[[1]][[1]]Passed
no rows[][]Passed
zero-sized rows[[1, 2]][[1, 2]]Passed

SHA-256 / 5af481ad9d1aadac826d6ec668e3abac8e0fc50949f5a5ceaddc82696c4cb5eb

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    try:
        rows,budget=d
        batches=[]; current=[]; used=0
        for ident,size in rows:
            if current and used+size>budget:
                batches.append(current); current=[]; used=0
            current.append(ident); used+=size
            if size>budget:
                batches.append(current); current=[]; used=0
        if current: batches.append(current)
        return batches
    except (IndexError, KeyError, ValueError, StopIteration) as exc:
        return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('exact fit', solve([[[1, 1], [2, 1]], 2]), [[1, 2]])
    check('byte budget', solve([[[1, 2], [2, 2], [3, 1]], 3]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 2], [2, 2], [3, 1], [4, 1]], 3]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 4], [2, 0]], 3]), [[1], [2]])
    check('full followed by zero', solve([[[1, 3], [2, 0]], 3]), [[1, 2]])
    check('single partial', solve([[[1, 1]], 3]), [[1]])
    check('no rows', solve([[], 3]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 1]), [[1, 2]])
elif N == 2:
    check('exact fit', solve([[[1, 2], [2, 2]], 4]), [[1, 2]])
    check('byte budget', solve([[[1, 4], [2, 4], [3, 2]], 6]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 4], [2, 4], [3, 2], [4, 2]], 6]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 8], [2, 0]], 6]), [[1], [2]])
    check('full followed by zero', solve([[[1, 6], [2, 0]], 6]), [[1, 2]])
    check('single partial', solve([[[1, 2]], 6]), [[1]])
    check('no rows', solve([[], 6]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 2]), [[1, 2]])
elif N == 3:
    check('exact fit', solve([[[1, 3], [2, 3]], 6]), [[1, 2]])
    check('byte budget', solve([[[1, 6], [2, 6], [3, 3]], 9]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 6], [2, 6], [3, 3], [4, 3]], 9]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 12], [2, 0]], 9]), [[1], [2]])
    check('full followed by zero', solve([[[1, 9], [2, 0]], 9]), [[1, 2]])
    check('single partial', solve([[[1, 3]], 9]), [[1]])
    check('no rows', solve([[], 9]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 3]), [[1, 2]])
elif N == 4:
    check('exact fit', solve([[[1, 4], [2, 4]], 8]), [[1, 2]])
    check('byte budget', solve([[[1, 8], [2, 8], [3, 4]], 12]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 8], [2, 8], [3, 4], [4, 4]], 12]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 16], [2, 0]], 12]), [[1], [2]])
    check('full followed by zero', solve([[[1, 12], [2, 0]], 12]), [[1, 2]])
    check('single partial', solve([[[1, 4]], 12]), [[1]])
    check('no rows', solve([[], 12]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 4]), [[1, 2]])
elif N == 5:
    check('exact fit', solve([[[1, 5], [2, 5]], 10]), [[1, 2]])
    check('byte budget', solve([[[1, 10], [2, 10], [3, 5]], 15]), [[1], [2, 3]])
    check('reset after flush', solve([[[1, 10], [2, 10], [3, 5], [4, 5]], 15]), [[1], [2, 3], [4]])
    check('oversize and zero', solve([[[1, 20], [2, 0]], 15]), [[1], [2]])
    check('full followed by zero', solve([[[1, 15], [2, 0]], 15]), [[1, 2]])
    check('single partial', solve([[[1, 5]], 15]), [[1]])
    check('no rows', solve([[], 15]), [])
    check('zero-sized rows', solve([[[1, 0], [2, 0]], 5]), [[1, 2]])
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
exact fit[[1, 2]][[1, 2]]Passed
byte budget[[1], [2, 3]][[1], [2, 3]]Passed
reset after flush[[1], [2, 3], [4]][[1], [2, 3], [4]]Passed
oversize and zero[[1], [2]][[1], [2]]Passed
full followed by zero[[1, 2]][[1, 2]]Passed
single partial[[1]][[1]]Passed
no rows[][]Passed
zero-sized rows[[1, 2]][[1, 2]]Passed

SHA-256 / 38740d6b6bf767ecfbd18edd55ee82214585d49d629c011cedc9fa6e4cb2c171

Verification & scope

Offline stipulated semantics over valid small inputs; no performance, concurrency, or production-engine conformance claim. 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:44:19.657362+00:00.

Case digest / 5bc642d3c5ddaf679d5789e8c8f3650c58563f00c1fb1d52ec9764a4c8a9ca53