FAILURE MAP
← Case archive

FA-4671 / Multiset accounting / Open access

Counter update adds not replaces · case 01

The operation returns a result or retained state that violates this contract: Counter update adds supplied counts to existing counts, retaining zero and negative entries.

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

ROOT CAUSE

Dictionary assignment replaces counts instead of accumulating them.

VERIFIED REPAIR

Counter update adds supplied counts to existing counts, retaining zero and negative entries.

Unsuccessful approach: Positive-bag addition drops zero and negative entries required by update semantics.

Case contract

Counter update adds supplied counts to existing counts, retaining zero and negative entries. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

Why this case matters

A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=Counter(x); a=dict(a); a.update(y); return a
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing count accumulates', solve({'a': 2}, {'a': 3}), {'a': 5})
check('zero retained', solve({'a': 2}, {'a': -2}), {'a': 0})
check('negative retained', solve({}, {'a': -1}), {'a': -1})
check('empty', 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
existing count accumulates{'a': 3}{'a': 5}Failed
zero retained{'a': -2}{'a': 0}Failed
negative retained{'a': -1}{'a': -1}Passed
empty{}{}Passed

SHA-256 / a0ad2bfcfad056a0d09faa8dd8d5622de38a481a755d63bd80bdb3d0f579409c

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return dict(Counter(x)+Counter(y))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing count accumulates', solve({'a': 2}, {'a': 3}), {'a': 5})
check('zero retained', solve({'a': 2}, {'a': -2}), {'a': 0})
check('negative retained', solve({}, {'a': -1}), {'a': -1})
check('empty', 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
existing count accumulates{'a': 5}{'a': 5}Passed
zero retained{}{'a': 0}Failed
negative retained{}{'a': -1}Failed
empty{}{}Passed

SHA-256 / 7636eceb4396506465f9f03924abf28769d8afde1f27c6a69597cf4dc5a5a45b

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=Counter(x); a.update(y); return dict(a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing count accumulates', solve({'a': 2}, {'a': 3}), {'a': 5})
check('zero retained', solve({'a': 2}, {'a': -2}), {'a': 0})
check('negative retained', solve({}, {'a': -1}), {'a': -1})
check('empty', 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
existing count accumulates{'a': 5}{'a': 5}Passed
zero retained{'a': 0}{'a': 0}Passed
negative retained{'a': -1}{'a': -1}Passed
empty{}{}Passed

SHA-256 / e7d0190a0d1f1bf90c34c74caa3dcb5605a8128ae05c0ad0f559312bf2ba9fce

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

Case digest / 00e1467cf48361156a07a9a97c39e7a1b4fcc567033f0363b6b0f5e99f90c406