FAILURE MAP
← Case archive

FA-98041 / Sequence batch packing / Open access

Greedy packing flushes one token too early · case 01

Greedy packing flushes one token too early.

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

ROOT CAUSE

The capacity comparison treats an exact fit as overflow.

THE FAILURE

The capacity comparison treats an exact fit as overflow.

Unsuccessful approach: Allowing one extra token still accepts genuinely oversized bins.

Case contract

Append sequences in order to the current bin; flush only when adding the next sequence would exceed capacity. Return bins of sequences.

Why this case matters

This deterministic toy packing rule models a common boundary in preparing bounded training sequences.

1 / The failure

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

N = 1
observations = []
def solve(sequences, capacity):
    bins=[]; cur=[]; used=0
    for s in sequences:
        if used+len(s)>=capacity and cur: bins.append(cur); cur=[]; used=0
        cur.append(s); used+=len(s)
    if cur: bins.append(cur)
    return bins
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a=[N]; b=[2]*N
check('exact fill', solve([a,b],N+1), [[a,b]])
check('must flush', solve([a,b],N), [[a],[b]])
check('empty input', solve([],N), [])
check('singleton', solve([a],N), [ [a] ])
check('zero length follows', solve([[],[1]*N],N), [ [[],[1]*N] ])
check('several bins', solve([[1]*N,[2],[3]*N],N), [[[1]*N],[[2]],[[3]*N]])
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 fill[[[1]], [[2]]][[[1], [2]]]Failed
must flush[[[1]], [[2]]][[[1]], [[2]]]Passed
empty input[][]Passed
singleton[[[1]]][[[1]]]Passed
zero length follows[[[]], [[1]]][[[], [1]]]Failed
several bins[[[1]], [[2]], [[3]]][[[1]], [[2]], [[3]]]Passed

SHA-256 / 739c1a62bf0201baff08ec61a7de9f0457b7d0f87416c09bb793e922204242e8

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(sequences, capacity):
    bins=[]; cur=[]; used=0
    for s in sequences:
        if used+len(s)>capacity+1 and cur: bins.append(cur); cur=[]; used=0
        cur.append(s); used+=len(s)
    if cur: bins.append(cur)
    return bins
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a=[N]; b=[2]*N
check('exact fill', solve([a,b],N+1), [[a,b]])
check('must flush', solve([a,b],N), [[a],[b]])
check('empty input', solve([],N), [])
check('singleton', solve([a],N), [ [a] ])
check('zero length follows', solve([[],[1]*N],N), [ [[],[1]*N] ])
check('several bins', solve([[1]*N,[2],[3]*N],N), [[[1]*N],[[2]],[[3]*N]])
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 fill[[[1], [2]]][[[1], [2]]]Passed
must flush[[[1], [2]]][[[1]], [[2]]]Failed
empty input[][]Passed
singleton[[[1]]][[[1]]]Passed
zero length follows[[[], [1]]][[[], [1]]]Passed
several bins[[[1], [2]], [[3]]][[[1]], [[2]], [[3]]]Failed

SHA-256 / a68fe2e58df2504e6e125f2256d85214acff131ae5900076d1c79e36599e956a

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 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

Inputs are short integer-token lists under the stated toy contract; results do not claim compatibility with a specific training framework. 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-30T16:48:08.895984+00:00.

Case digest / ef9892de506e6f60b27b564921f21fd5a01785df90b3f094256f2e75c6d862ef