FAILURE MAP
← Case archive

FA-7126 / Network routing / Open access

Weighted route selection uses cumulative half open buckets · case 01

Weighted route selection uses cumulative half open buckets.

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

ROOT CAUSE

The faulty implementation uses `next((i for i in range(len(weights)) if draw <= sum(weights[:i+1])),None)` for the weighted-route-selection-uses-cumulative-half-open-buckets decision.

VERIFIED REPAIR

Apply the explicit weighted-route-selection-uses-cumulative-half-open-buckets contract, including the tested boundary and negative cases.

Unsuccessful approach: The attempted repair uses `next((i for i,w in enumerate(weights) if draw < w),None)` and still violates a separate fixture.

Case contract

Bounded offline decision model: weighted route selection uses cumulative half open buckets. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

Why this case matters

This deterministic network routing model isolates the weighted-route-selection-uses-cumulative-half-open-buckets policy at a network component boundary.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(weights, draw):
    return next((i for i in range(len(weights)) if draw <= sum(weights[:i+1])),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([2, 3], 2), 1)", "check('fixture 2', solve([2, 3], 4), 1)", "check('fixture 3', solve([0, 2], 0), 1)", "check('fixture 4', solve([], 0), None)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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
fixture 211Passed
fixture 301Failed
fixture 4NoneNonePassed
fixture 101Failed

SHA-256 / 8b62b7d2916e3117277810ca68a5e7b67e694f08996887cea6e7bd7921465fc5

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(weights, draw):
    return next((i for i,w in enumerate(weights) if draw < w),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([2, 3], 2), 1)", "check('fixture 2', solve([2, 3], 4), 1)", "check('fixture 3', solve([0, 2], 0), 1)", "check('fixture 4', solve([], 0), None)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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
fixture 2None1Failed
fixture 311Passed
fixture 4NoneNonePassed
fixture 111Passed

SHA-256 / 9578ce16c0a0382c6ab642c73c98056b6fa14f50998a26e202388310ec8547aa

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(weights, draw):
    return next((i for i in range(len(weights)) if draw < sum(weights[:i+1])),None)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve([2, 3], 2), 1)", "check('fixture 2', solve([2, 3], 4), 1)", "check('fixture 3', solve([0, 2], 0), 1)", "check('fixture 4', solve([], 0), None)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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
fixture 211Passed
fixture 311Passed
fixture 4NoneNonePassed
fixture 111Passed

SHA-256 / 3a079f8f3bd07c46a0a76246751ffbb34b71af0c8aaa9d466e611f67674e6dd8

Verification & scope

Bounded deterministic policy model over validated inputs; not a complete protocol stack or an interoperability claim. The five variants rotate the same explicit fixture set. 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:38:08.543656+00:00.

Case digest / df339bd628da82e1e9fdc0634510cdeaecaf432b5d3138c2bc9c6429095aad5e