FA-6181 / Statistics / Open access
Median even middle average · case 01
Only the upper central observation is selected for even samples.
ROOT CAUSE
Only the upper central observation is selected for even samples.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(statistics.median([Fraction(v) for v in values])) if values else None
Unsuccessful approach: The midrange substitutes extremes for middle order statistics.
Case contract
Integer finite observations and equal lengths for paired samples. Counts and weights are nonnegative. Rational results use reduced Fraction strings. Empty or undefined statistics return None where shown. Median even middle average. Exact operational definition: str(statistics.median([Fraction(v) for v in values])) if values else None
Why this case matters
Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Statistical estimators results depend on the stated convention.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(values):
return str(sorted(values)[len(values)//2]) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 8, 9],)', solve(*([1, 2, 8, 9],)), '5')
check('fixture 2: ([1, 2, 100],)', solve(*([1, 2, 100],)), '2')
check('fixture 3: ([4],)', solve(*([4],)), '4')
check('fixture 4: ([],)', solve(*([],)), None)
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 |
|---|---|---|---|
| fixture 1: ([1, 2, 8, 9],) | 8 | 5 | Failed |
| fixture 2: ([1, 2, 100],) | 2 | 2 | Passed |
| fixture 3: ([4],) | 4 | 4 | Passed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / ed2d7861e9c2518a251c8509716ece49b079cd3b6d641456fd0f9f3a8a143b78
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(values):
return str(Fraction(min(values)+max(values),2)) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 8, 9],)', solve(*([1, 2, 8, 9],)), '5')
check('fixture 2: ([1, 2, 100],)', solve(*([1, 2, 100],)), '2')
check('fixture 3: ([4],)', solve(*([4],)), '4')
check('fixture 4: ([],)', solve(*([],)), None)
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 |
|---|---|---|---|
| fixture 1: ([1, 2, 8, 9],) | 5 | 5 | Passed |
| fixture 2: ([1, 2, 100],) | 101/2 | 2 | Failed |
| fixture 3: ([4],) | 4 | 4 | Passed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / dde3468f11b33cc34fc662ade151c8acff92bf29e17fc6649af62e82fa22c667
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(values):
return str(statistics.median([Fraction(v) for v in values])) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 8, 9],)', solve(*([1, 2, 8, 9],)), '5')
check('fixture 2: ([1, 2, 100],)', solve(*([1, 2, 100],)), '2')
check('fixture 3: ([4],)', solve(*([4],)), '4')
check('fixture 4: ([],)', solve(*([],)), None)
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 |
|---|---|---|---|
| fixture 1: ([1, 2, 8, 9],) | 5 | 5 | Passed |
| fixture 2: ([1, 2, 100],) | 2 | 2 | Passed |
| fixture 3: ([4],) | 4 | 4 | Passed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / 67522f30edb4a153ba89367b52fbb80ef0d1494e35cd6c9329e383fa9b5f12b5
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:37:58.610348+00:00.
Case digest / 9600ec513c8ba1d356c28c9140db71f1d67b3969ee0de08972f29fbd106f84dc