FA-45191 / Data systems / Open access
Batch packing retains byte occupancy after flushing rows · case 01
Batch packing retains byte occupancy after flushing rows.
ROOT CAUSE
row-batch-packing: Batch packing retains byte occupancy after flushing rows.
THE FAILURE
row-batch-packing: Batch packing retains byte occupancy after flushing rows.
Unsuccessful approach: Charging the pending row before appending it double counts its bytes.
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=[]
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]] | 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 / 1f4269d88b5f9c6000689f680bc87a87183aa8de09f1304c04296b19aa2f47cd
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=size
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]] | 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 / e469dc095b5df019bf980b2ff622c5b237310e2f02314831471ce0cd25991125
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
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 / ffa9e3d91a6793599174719a17ec0adcd1ab066b8ac9df25b5b81abca159becb