FAILURE MAP
← Case archive

FA-241 / Runtime and resources / Open access

A weighted scheduler releases traffic in unfair bursts · case 01

Round-robin ignores weights, while contiguous weighted blocks create avoidable short-prefix imbalance.

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

ROOT CAUSE

The scheduler tracks neither accumulated scheduling debt nor deterministic tie behavior.

VERIFIED REPAIR

Use smooth weighted round-robin: add each weight, serve the largest credit, then subtract total weight from that credit.

Unsuccessful approach: Expanding each weight into a contiguous block matches a long-run ratio but not the required smooth schedule.

Case contract

Weights are nonnegative integers. Starting all credits at zero, perform the stated smooth weighted round-robin update for each requested slot; lowest index wins ties. Zero-weight lanes are ineligible. Return chosen lane indices, or [] if all weights are zero or there are no slots.

Why this case matters

Models dispatch fairness for unequal-capacity workers with an explicit deterministic scheduling policy; it does not model variable job duration or claim universal latency optimality.

1 / The failure

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

N = 1
observations = []
def solve(weights, slots):
    eligible = [i for i, w in enumerate(weights) if w > 0]
    return [eligible[i%len(eligible)] for i in range(slots)] if eligible else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two to one remains smooth', solve([2*N, N], 3*N), [0, 1, 0]*N)
check('one to three remains smooth', solve([N, 3*N], 4*N), [1, 0, 1, 1]*N)
check('zero-weight lane is excluded', solve([N, 0, N], 2*N), [0, 2]*N)
check('equal weights deterministic', solve([N, N, N], 3*N), [0, 1, 2]*N)
check('one worker', solve([N], N), [0]*N)
check('no capacity', solve([0, 0], N), [])
check('no scheduling slots', solve([N, N+1], 0), [])
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
two to one remains smooth[0, 1, 0][0, 1, 0]Passed
one to three remains smooth[0, 1, 0, 1][1, 0, 1, 1]Failed
zero-weight lane is excluded[0, 2][0, 2]Passed
equal weights deterministic[0, 1, 2][0, 1, 2]Passed
one worker[0][0]Passed
no capacity[][]Passed
no scheduling slots[][]Passed

SHA-256 / c9fcf8ac1e8a772e80c361c9a03caf742219fe1ebd8a6bcb7652f933a06bd885

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(weights, slots):
    cycle = [i for i, weight in enumerate(weights) for unused in range(weight)]
    return [cycle[i%len(cycle)] for i in range(slots)] if cycle else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two to one remains smooth', solve([2*N, N], 3*N), [0, 1, 0]*N)
check('one to three remains smooth', solve([N, 3*N], 4*N), [1, 0, 1, 1]*N)
check('zero-weight lane is excluded', solve([N, 0, N], 2*N), [0, 2]*N)
check('equal weights deterministic', solve([N, N, N], 3*N), [0, 1, 2]*N)
check('one worker', solve([N], N), [0]*N)
check('no capacity', solve([0, 0], N), [])
check('no scheduling slots', solve([N, N+1], 0), [])
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
two to one remains smooth[0, 0, 1][0, 1, 0]Failed
one to three remains smooth[0, 1, 1, 1][1, 0, 1, 1]Failed
zero-weight lane is excluded[0, 2][0, 2]Passed
equal weights deterministic[0, 1, 2][0, 1, 2]Passed
one worker[0][0]Passed
no capacity[][]Passed
no scheduling slots[][]Passed

SHA-256 / 1b337fc54a01976a02c43936c478425f131ba9e19167f49b31d311d5368f15dd

3 / The verified repair

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

N = 1
observations = []
def solve(weights, slots):
    total, credits, chosen = sum(weights), [0]*len(weights), []
    eligible = [i for i, weight in enumerate(weights) if weight > 0]
    if not total:
        return []
    for unused in range(slots):
        credits = [credit+weight for credit, weight in zip(credits, weights)]
        winner = max(eligible, key=lambda i: (credits[i], -i))
        credits[winner] -= total
        chosen.append(winner)
    return chosen
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two to one remains smooth', solve([2*N, N], 3*N), [0, 1, 0]*N)
check('one to three remains smooth', solve([N, 3*N], 4*N), [1, 0, 1, 1]*N)
check('zero-weight lane is excluded', solve([N, 0, N], 2*N), [0, 2]*N)
check('equal weights deterministic', solve([N, N, N], 3*N), [0, 1, 2]*N)
check('one worker', solve([N], N), [0]*N)
check('no capacity', solve([0, 0], N), [])
check('no scheduling slots', solve([N, N+1], 0), [])
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
two to one remains smooth[0, 1, 0][0, 1, 0]Passed
one to three remains smooth[1, 0, 1, 1][1, 0, 1, 1]Passed
zero-weight lane is excluded[0, 2][0, 2]Passed
equal weights deterministic[0, 1, 2][0, 1, 2]Passed
one worker[0][0]Passed
no capacity[][]Passed
no scheduling slots[][]Passed

SHA-256 / cf2a0e8e12491ef44dcc0d12f436c872c308f9730c4591517aaa36765a3bacf9

Verification & scope

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:36:51.528382+00:00.

Case digest / b5527c1f61abb7328a87464247ef6155f281513c631287ee9308abe48aa9b581