FA-4666 / Multiset accounting / Open access
Counter addition drops nonpositive sums · case 01
The operation returns a result or retained state that violates this contract: Add two counters and retain only strictly positive resulting counts.
ROOT CAUSE
In-place update retains signed entries that positive-bag addition must discard.
THE FAILURE
In-place update retains signed entries that positive-bag addition must discard.
Unsuccessful approach: A nonnegative filter preserves zero entries that should be removed.
Case contract
Add two counters and retain only strictly positive resulting counts. 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.update(y); return dict(a)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero removed', solve({'a': 1, 'b': 2}, {'a': -1, 'b': -4}), {})
check('positive retained', solve({'a': 2}, {'a': 1, 'b': 1}), {'a': 3, 'b': 1})
check('empty', solve({}, {}), {})
check('negative left removed', solve({'a': -1}, {'b': 2}), {'b': 2})
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 |
|---|---|---|---|
| zero removed | {'a': 0, 'b': -2} | {} | Failed |
| positive retained | {'a': 3, 'b': 1} | {'a': 3, 'b': 1} | Passed |
| empty | {} | {} | Passed |
| negative left removed | {'a': -1, 'b': 2} | {'b': 2} | Failed |
SHA-256 / e27d2d617c7a99df80ca3772019291fab1069c87940ba660c2781b986b547dc6
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):
a=Counter(x); a.update(y); return {k:v for k,v in a.items() if v>=0}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero removed', solve({'a': 1, 'b': 2}, {'a': -1, 'b': -4}), {})
check('positive retained', solve({'a': 2}, {'a': 1, 'b': 1}), {'a': 3, 'b': 1})
check('empty', solve({}, {}), {})
check('negative left removed', solve({'a': -1}, {'b': 2}), {'b': 2})
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 |
|---|---|---|---|
| zero removed | {'a': 0} | {} | Failed |
| positive retained | {'a': 3, 'b': 1} | {'a': 3, 'b': 1} | Passed |
| empty | {} | {} | Passed |
| negative left removed | {'b': 2} | {'b': 2} | Passed |
SHA-256 / 6096d40ab05c8f9b754edeaf8c616698d14d19d6444d8e9259c1bc8df4b810a2
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:41.506665+00:00.
Case digest / 8f593350380b3899a506b4f675fced47ebebd93a5b262697b1344a993e2c9027