FAILURE MAP
← Case archive

FA-6201 / Statistics / Open access

All modes sorted · case 01

Only one mode is returned when frequencies tie.

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

ROOT CAUSE

Only one mode is returned when frequencies tie.

THE FAILURE

Only one mode is returned when frequencies tie.

Unsuccessful approach: All unique values are returned regardless of frequency.

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. Return every highest-frequency observation value in sorted order, or [] for empty input. Exact operational definition: sorted(v for v in set(values) if values.count(v)==max(map(values.count,values))) if values else []

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 [statistics.mode(values)] if values else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([3, 3, 1, 1, 2],)', solve(*([3, 3, 1, 1, 2],)), [1, 3])
check('fixture 2: ([2, 1, 2],)', solve(*([2, 1, 2],)), [2])
check('fixture 3: ([7],)', solve(*([7],)), [7])
check('fixture 4: ([],)', solve(*([],)), [])
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 1: ([3, 3, 1, 1, 2],)[3][1, 3]Failed
fixture 2: ([2, 1, 2],)[2][2]Passed
fixture 3: ([7],)[7][7]Passed
fixture 4: ([],)[][]Passed

SHA-256 / cfc0a1399616809f2985e1e38c695258477d101f2828a898a6287f50ca99bb10

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 sorted(set(values))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([3, 3, 1, 1, 2],)', solve(*([3, 3, 1, 1, 2],)), [1, 3])
check('fixture 2: ([2, 1, 2],)', solve(*([2, 1, 2],)), [2])
check('fixture 3: ([7],)', solve(*([7],)), [7])
check('fixture 4: ([],)', solve(*([],)), [])
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 1: ([3, 3, 1, 1, 2],)[1, 2, 3][1, 3]Failed
fixture 2: ([2, 1, 2],)[1, 2][2]Failed
fixture 3: ([7],)[7][7]Passed
fixture 4: ([],)[][]Passed

SHA-256 / abddd1d28d08844cdab5b079d17a03712961df02d39972f1996e0bd3384c3475

HELD IN THE MEMBER ARCHIVE

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

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

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

Case digest / 74c485f3f4b3a7e0d030790e2d1aa00d35579ce3cd23192cf0c8e3266c54d62c