FA-45206 / Data systems / Open access
Batch packing creates an empty terminal batch · case 01
Batch packing creates an empty terminal batch.
ROOT CAUSE
row-batch-packing: Batch packing creates an empty terminal batch.
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: Appending only when empty also discards real tails.
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+=size
if size>budget:
batches.append(current); current=[]; used=0
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 | [[]] | [] | Failed |
| zero-sized rows | [[1, 2]] | [[1, 2]] | Passed |
SHA-256 / 2bf0fbaf1c1e8082bd5f666bdcb9f78ba52fe443c7917443605ac5b779b70307
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 not 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| exact fit | [] | [[1, 2]] | Failed |
| byte budget | [[1]] | [[1], [2, 3]] | Failed |
| reset after flush | [[1], [2, 3]] | [[1], [2, 3], [4]] | Failed |
| oversize and zero | [[1]] | [[1], [2]] | Failed |
| full followed by zero | [] | [[1, 2]] | Failed |
| single partial | [] | [[1]] | Failed |
| no rows | [[]] | [] | Failed |
| zero-sized rows | [] | [[1, 2]] | Failed |
SHA-256 / 49297c85517987f64251ef04d3f8f4f2c1868e99609d93aa0fb417613a440fad
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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.851434+00:00.
Case digest / 49820d4ba01247e89707ef68cf95e8c07a628ce3b7646ce4c3ef6d660bdef398