FA-44656 / Data systems / Open access
Distinct scans only values present before the batch · case 01
Distinct scans only values present before the batch.
ROOT CAUSE
incremental-distinct: Distinct scans only values present before the batch.
VERIFIED REPAIR
Preserve the stated physical representation and operation order: Maintain bag counts from consolidated signed changes and emit only membership crossings. Old and delta entries are [value,count]; counts after each batch are nonnegative. Output sorted [value,+1/-1] for zero-to-positive or positive-to-zero transitions.
Unsuccessful approach: Restricting to changed old keys still misses newly introduced values.
Case contract
Maintain bag counts from consolidated signed changes and emit only membership crossings. Old and delta entries are [value,count]; counts after each batch are nonnegative. Output sorted [value,+1/-1] for zero-to-positive or positive-to-zero transitions.
Why this case matters
A bounded deterministic data engine model makes representation and changelog faults reproducible.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
old,changes=d
before=dict(old)
after=before.copy()
for value,weight in changes:
after[value]=after.get(value,0)+weight
out=[]
for value in sorted(before):
was=before.get(value,0)>0
now=after.get(value,0)>0
if was!=now: out.append([value,1 if now else -1])
return out
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('new singleton', solve([[], [[1, 1]]]), [[1, 1]])
check('duplicate increment', solve([[[1, 1]], [[1, 1]]]), [])
check('partial removal', solve([[[1, 3]], [[1, -1]]]), [])
check('last removal', solve([[[1, 1]], [[1, -1]]]), [[1, -1]])
check('cancel batch', solve([[], [[1, 1], [1, -1]]]), [])
check('new multiplicity', solve([[], [[1, 2]]]), [[1, 1]])
check('mixed transitions', solve([[[1, 1]], [[1, -1], [2, 2]]]), [[1, -1], [2, 1]])
check('empty batch', solve([[[1, 2]], []]), [])
elif N == 2:
check('new singleton', solve([[], [[2, 1]]]), [[2, 1]])
check('duplicate increment', solve([[[2, 1]], [[2, 1]]]), [])
check('partial removal', solve([[[2, 3]], [[2, -1]]]), [])
check('last removal', solve([[[2, 1]], [[2, -1]]]), [[2, -1]])
check('cancel batch', solve([[], [[2, 1], [2, -1]]]), [])
check('new multiplicity', solve([[], [[2, 2]]]), [[2, 1]])
check('mixed transitions', solve([[[2, 1]], [[2, -1], [3, 2]]]), [[2, -1], [3, 1]])
check('empty batch', solve([[[2, 2]], []]), [])
elif N == 3:
check('new singleton', solve([[], [[3, 1]]]), [[3, 1]])
check('duplicate increment', solve([[[3, 1]], [[3, 1]]]), [])
check('partial removal', solve([[[3, 3]], [[3, -1]]]), [])
check('last removal', solve([[[3, 1]], [[3, -1]]]), [[3, -1]])
check('cancel batch', solve([[], [[3, 1], [3, -1]]]), [])
check('new multiplicity', solve([[], [[3, 2]]]), [[3, 1]])
check('mixed transitions', solve([[[3, 1]], [[3, -1], [4, 2]]]), [[3, -1], [4, 1]])
check('empty batch', solve([[[3, 2]], []]), [])
elif N == 4:
check('new singleton', solve([[], [[4, 1]]]), [[4, 1]])
check('duplicate increment', solve([[[4, 1]], [[4, 1]]]), [])
check('partial removal', solve([[[4, 3]], [[4, -1]]]), [])
check('last removal', solve([[[4, 1]], [[4, -1]]]), [[4, -1]])
check('cancel batch', solve([[], [[4, 1], [4, -1]]]), [])
check('new multiplicity', solve([[], [[4, 2]]]), [[4, 1]])
check('mixed transitions', solve([[[4, 1]], [[4, -1], [5, 2]]]), [[4, -1], [5, 1]])
check('empty batch', solve([[[4, 2]], []]), [])
elif N == 5:
check('new singleton', solve([[], [[5, 1]]]), [[5, 1]])
check('duplicate increment', solve([[[5, 1]], [[5, 1]]]), [])
check('partial removal', solve([[[5, 3]], [[5, -1]]]), [])
check('last removal', solve([[[5, 1]], [[5, -1]]]), [[5, -1]])
check('cancel batch', solve([[], [[5, 1], [5, -1]]]), [])
check('new multiplicity', solve([[], [[5, 2]]]), [[5, 1]])
check('mixed transitions', solve([[[5, 1]], [[5, -1], [6, 2]]]), [[5, -1], [6, 1]])
check('empty batch', solve([[[5, 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 |
|---|---|---|---|
| new singleton | [] | [[1, 1]] | Failed |
| duplicate increment | [] | [] | Passed |
| partial removal | [] | [] | Passed |
| last removal | [[1, -1]] | [[1, -1]] | Passed |
| cancel batch | [] | [] | Passed |
| new multiplicity | [] | [[1, 1]] | Failed |
| mixed transitions | [[1, -1]] | [[1, -1], [2, 1]] | Failed |
| empty batch | [] | [] | Passed |
SHA-256 / 49219312f1bd69cecf1f7edb0653f5d5d39b30f4c2ba8fbfef713c836d1890c4
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
old,changes=d
before=dict(old)
after=before.copy()
for value,weight in changes:
after[value]=after.get(value,0)+weight
out=[]
for value in sorted(set(v for v,w in changes) & set(before)):
was=before.get(value,0)>0
now=after.get(value,0)>0
if was!=now: out.append([value,1 if now else -1])
return out
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('new singleton', solve([[], [[1, 1]]]), [[1, 1]])
check('duplicate increment', solve([[[1, 1]], [[1, 1]]]), [])
check('partial removal', solve([[[1, 3]], [[1, -1]]]), [])
check('last removal', solve([[[1, 1]], [[1, -1]]]), [[1, -1]])
check('cancel batch', solve([[], [[1, 1], [1, -1]]]), [])
check('new multiplicity', solve([[], [[1, 2]]]), [[1, 1]])
check('mixed transitions', solve([[[1, 1]], [[1, -1], [2, 2]]]), [[1, -1], [2, 1]])
check('empty batch', solve([[[1, 2]], []]), [])
elif N == 2:
check('new singleton', solve([[], [[2, 1]]]), [[2, 1]])
check('duplicate increment', solve([[[2, 1]], [[2, 1]]]), [])
check('partial removal', solve([[[2, 3]], [[2, -1]]]), [])
check('last removal', solve([[[2, 1]], [[2, -1]]]), [[2, -1]])
check('cancel batch', solve([[], [[2, 1], [2, -1]]]), [])
check('new multiplicity', solve([[], [[2, 2]]]), [[2, 1]])
check('mixed transitions', solve([[[2, 1]], [[2, -1], [3, 2]]]), [[2, -1], [3, 1]])
check('empty batch', solve([[[2, 2]], []]), [])
elif N == 3:
check('new singleton', solve([[], [[3, 1]]]), [[3, 1]])
check('duplicate increment', solve([[[3, 1]], [[3, 1]]]), [])
check('partial removal', solve([[[3, 3]], [[3, -1]]]), [])
check('last removal', solve([[[3, 1]], [[3, -1]]]), [[3, -1]])
check('cancel batch', solve([[], [[3, 1], [3, -1]]]), [])
check('new multiplicity', solve([[], [[3, 2]]]), [[3, 1]])
check('mixed transitions', solve([[[3, 1]], [[3, -1], [4, 2]]]), [[3, -1], [4, 1]])
check('empty batch', solve([[[3, 2]], []]), [])
elif N == 4:
check('new singleton', solve([[], [[4, 1]]]), [[4, 1]])
check('duplicate increment', solve([[[4, 1]], [[4, 1]]]), [])
check('partial removal', solve([[[4, 3]], [[4, -1]]]), [])
check('last removal', solve([[[4, 1]], [[4, -1]]]), [[4, -1]])
check('cancel batch', solve([[], [[4, 1], [4, -1]]]), [])
check('new multiplicity', solve([[], [[4, 2]]]), [[4, 1]])
check('mixed transitions', solve([[[4, 1]], [[4, -1], [5, 2]]]), [[4, -1], [5, 1]])
check('empty batch', solve([[[4, 2]], []]), [])
elif N == 5:
check('new singleton', solve([[], [[5, 1]]]), [[5, 1]])
check('duplicate increment', solve([[[5, 1]], [[5, 1]]]), [])
check('partial removal', solve([[[5, 3]], [[5, -1]]]), [])
check('last removal', solve([[[5, 1]], [[5, -1]]]), [[5, -1]])
check('cancel batch', solve([[], [[5, 1], [5, -1]]]), [])
check('new multiplicity', solve([[], [[5, 2]]]), [[5, 1]])
check('mixed transitions', solve([[[5, 1]], [[5, -1], [6, 2]]]), [[5, -1], [6, 1]])
check('empty batch', solve([[[5, 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 |
|---|---|---|---|
| new singleton | [] | [[1, 1]] | Failed |
| duplicate increment | [] | [] | Passed |
| partial removal | [] | [] | Passed |
| last removal | [[1, -1]] | [[1, -1]] | Passed |
| cancel batch | [] | [] | Passed |
| new multiplicity | [] | [[1, 1]] | Failed |
| mixed transitions | [[1, -1]] | [[1, -1], [2, 1]] | Failed |
| empty batch | [] | [] | Passed |
SHA-256 / b2d6598ceca4ee81f069200d8b47cc6ee6d758b27ccbfac767ab09c9ce8b3258
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
try:
old,changes=d
before=dict(old)
after=before.copy()
for value,weight in changes:
after[value]=after.get(value,0)+weight
out=[]
for value in sorted(set(before)|set(after)):
was=before.get(value,0)>0
now=after.get(value,0)>0
if was!=now: out.append([value,1 if now else -1])
return out
except (IndexError, KeyError, ValueError, StopIteration) as exc:
return {"representation_error": type(exc).__name__}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('new singleton', solve([[], [[1, 1]]]), [[1, 1]])
check('duplicate increment', solve([[[1, 1]], [[1, 1]]]), [])
check('partial removal', solve([[[1, 3]], [[1, -1]]]), [])
check('last removal', solve([[[1, 1]], [[1, -1]]]), [[1, -1]])
check('cancel batch', solve([[], [[1, 1], [1, -1]]]), [])
check('new multiplicity', solve([[], [[1, 2]]]), [[1, 1]])
check('mixed transitions', solve([[[1, 1]], [[1, -1], [2, 2]]]), [[1, -1], [2, 1]])
check('empty batch', solve([[[1, 2]], []]), [])
elif N == 2:
check('new singleton', solve([[], [[2, 1]]]), [[2, 1]])
check('duplicate increment', solve([[[2, 1]], [[2, 1]]]), [])
check('partial removal', solve([[[2, 3]], [[2, -1]]]), [])
check('last removal', solve([[[2, 1]], [[2, -1]]]), [[2, -1]])
check('cancel batch', solve([[], [[2, 1], [2, -1]]]), [])
check('new multiplicity', solve([[], [[2, 2]]]), [[2, 1]])
check('mixed transitions', solve([[[2, 1]], [[2, -1], [3, 2]]]), [[2, -1], [3, 1]])
check('empty batch', solve([[[2, 2]], []]), [])
elif N == 3:
check('new singleton', solve([[], [[3, 1]]]), [[3, 1]])
check('duplicate increment', solve([[[3, 1]], [[3, 1]]]), [])
check('partial removal', solve([[[3, 3]], [[3, -1]]]), [])
check('last removal', solve([[[3, 1]], [[3, -1]]]), [[3, -1]])
check('cancel batch', solve([[], [[3, 1], [3, -1]]]), [])
check('new multiplicity', solve([[], [[3, 2]]]), [[3, 1]])
check('mixed transitions', solve([[[3, 1]], [[3, -1], [4, 2]]]), [[3, -1], [4, 1]])
check('empty batch', solve([[[3, 2]], []]), [])
elif N == 4:
check('new singleton', solve([[], [[4, 1]]]), [[4, 1]])
check('duplicate increment', solve([[[4, 1]], [[4, 1]]]), [])
check('partial removal', solve([[[4, 3]], [[4, -1]]]), [])
check('last removal', solve([[[4, 1]], [[4, -1]]]), [[4, -1]])
check('cancel batch', solve([[], [[4, 1], [4, -1]]]), [])
check('new multiplicity', solve([[], [[4, 2]]]), [[4, 1]])
check('mixed transitions', solve([[[4, 1]], [[4, -1], [5, 2]]]), [[4, -1], [5, 1]])
check('empty batch', solve([[[4, 2]], []]), [])
elif N == 5:
check('new singleton', solve([[], [[5, 1]]]), [[5, 1]])
check('duplicate increment', solve([[[5, 1]], [[5, 1]]]), [])
check('partial removal', solve([[[5, 3]], [[5, -1]]]), [])
check('last removal', solve([[[5, 1]], [[5, -1]]]), [[5, -1]])
check('cancel batch', solve([[], [[5, 1], [5, -1]]]), [])
check('new multiplicity', solve([[], [[5, 2]]]), [[5, 1]])
check('mixed transitions', solve([[[5, 1]], [[5, -1], [6, 2]]]), [[5, -1], [6, 1]])
check('empty batch', solve([[[5, 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 |
|---|---|---|---|
| new singleton | [[1, 1]] | [[1, 1]] | Passed |
| duplicate increment | [] | [] | Passed |
| partial removal | [] | [] | Passed |
| last removal | [[1, -1]] | [[1, -1]] | Passed |
| cancel batch | [] | [] | Passed |
| new multiplicity | [[1, 1]] | [[1, 1]] | Passed |
| mixed transitions | [[1, -1], [2, 1]] | [[1, -1], [2, 1]] | Passed |
| empty batch | [] | [] | Passed |
SHA-256 / 8dfafd8d30ad5a8d2e4eadd8d5f324ff65afd5bc7bf0e05f3a60d4f14b3a0495
Verification & scope
Offline stipulated semantics over valid small inputs; no performance, concurrency, or production-engine conformance claim. 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:44:14.424684+00:00.
Case digest / e844cea44cb062f8e61b5e0adbe3d04faae0bc459a3e836c79483f5e4635e094