{"abstract":"Distinct requires two live copies before a value becomes present.","category":"Data systems","checks":8,"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.","contract_signature":"d","evaluation_group":"s3-data-systems-incremental-distinct","failed_approach":"Exact singleton presence incorrectly removes values with multiple copies.","family":"s3-data-systems-incremental-distinct-positive-threshold","id":"FA-44651","implementations":{"attempt":{"sha256":"3af7dc61cc19a11911bf17b7116adcf913dc6e492ada5967eb8c77d0babd8d70","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        old,changes=d\n        before=dict(old)\n        after=before.copy()\n        for value,weight in changes:\n            after[value]=after.get(value,0)+weight\n        out=[]\n        for value in sorted(set(before)|set(after)):\n            was=before.get(value,0)>0\n            now=after.get(value,0)==1\n            if was!=now: out.append([value,1 if now else -1])\n        return out\n    except (IndexError, KeyError, ValueError, StopIteration) as exc:\n        return {\"representation_error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nif N == 1:\n    check('new singleton', solve([[], [[1, 1]]]), [[1, 1]])\n    check('duplicate increment', solve([[[1, 1]], [[1, 1]]]), [])\n    check('partial removal', solve([[[1, 3]], [[1, -1]]]), [])\n    check('last removal', solve([[[1, 1]], [[1, -1]]]), [[1, -1]])\n    check('cancel batch', solve([[], [[1, 1], [1, -1]]]), [])\n    check('new multiplicity', solve([[], [[1, 2]]]), [[1, 1]])\n    check('mixed transitions', solve([[[1, 1]], [[1, -1], [2, 2]]]), [[1, -1], [2, 1]])\n    check('empty batch', solve([[[1, 2]], []]), [])\nelif N == 2:\n    check('new singleton', solve([[], [[2, 1]]]), [[2, 1]])\n    check('duplicate increment', solve([[[2, 1]], [[2, 1]]]), [])\n    check('partial removal', solve([[[2, 3]], [[2, -1]]]), [])\n    check('last removal', solve([[[2, 1]], [[2, -1]]]), [[2, -1]])\n    check('cancel batch', solve([[], [[2, 1], [2, -1]]]), [])\n    check('new multiplicity', solve([[], [[2, 2]]]), [[2, 1]])\n    check('mixed transitions', solve([[[2, 1]], [[2, -1], [3, 2]]]), [[2, -1], [3, 1]])\n    check('empty batch', solve([[[2, 2]], []]), [])\nelif N == 3:\n    check('new singleton', solve([[], [[3, 1]]]), [[3, 1]])\n    check('duplicate increment', solve([[[3, 1]], [[3, 1]]]), [])\n    check('partial removal', solve([[[3, 3]], [[3, -1]]]), [])\n    check('last removal', solve([[[3, 1]], [[3, -1]]]), [[3, -1]])\n    check('cancel batch', solve([[], [[3, 1], [3, -1]]]), [])\n    check('new multiplicity', solve([[], [[3, 2]]]), [[3, 1]])\n    check('mixed transitions', solve([[[3, 1]], [[3, -1], [4, 2]]]), [[3, -1], [4, 1]])\n    check('empty batch', solve([[[3, 2]], []]), [])\nelif N == 4:\n    check('new singleton', solve([[], [[4, 1]]]), [[4, 1]])\n    check('duplicate increment', solve([[[4, 1]], [[4, 1]]]), [])\n    check('partial removal', solve([[[4, 3]], [[4, -1]]]), [])\n    check('last removal', solve([[[4, 1]], [[4, -1]]]), [[4, -1]])\n    check('cancel batch', solve([[], [[4, 1], [4, -1]]]), [])\n    check('new multiplicity', solve([[], [[4, 2]]]), [[4, 1]])\n    check('mixed transitions', solve([[[4, 1]], [[4, -1], [5, 2]]]), [[4, -1], [5, 1]])\n    check('empty batch', solve([[[4, 2]], []]), [])\nelif N == 5:\n    check('new singleton', solve([[], [[5, 1]]]), [[5, 1]])\n    check('duplicate increment', solve([[[5, 1]], [[5, 1]]]), [])\n    check('partial removal', solve([[[5, 3]], [[5, -1]]]), [])\n    check('last removal', solve([[[5, 1]], [[5, -1]]]), [[5, -1]])\n    check('cancel batch', solve([[], [[5, 1], [5, -1]]]), [])\n    check('new multiplicity', solve([[], [[5, 2]]]), [[5, 1]])\n    check('mixed transitions', solve([[[5, 1]], [[5, -1], [6, 2]]]), [[5, -1], [6, 1]])\n    check('empty batch', solve([[[5, 2]], []]), [])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"48ae86bfdcd2f301bad6f8ba98a409b826ce8d59dd349eb6d6a8976dd6b920dc","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        old,changes=d\n        before=dict(old)\n        after=before.copy()\n        for value,weight in changes:\n            after[value]=after.get(value,0)+weight\n        out=[]\n        for value in sorted(set(before)|set(after)):\n            was=before.get(value,0)>0\n            now=after.get(value,0)>1\n            if was!=now: out.append([value,1 if now else -1])\n        return out\n    except (IndexError, KeyError, ValueError, StopIteration) as exc:\n        return {\"representation_error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nif N == 1:\n    check('new singleton', solve([[], [[1, 1]]]), [[1, 1]])\n    check('duplicate increment', solve([[[1, 1]], [[1, 1]]]), [])\n    check('partial removal', solve([[[1, 3]], [[1, -1]]]), [])\n    check('last removal', solve([[[1, 1]], [[1, -1]]]), [[1, -1]])\n    check('cancel batch', solve([[], [[1, 1], [1, -1]]]), [])\n    check('new multiplicity', solve([[], [[1, 2]]]), [[1, 1]])\n    check('mixed transitions', solve([[[1, 1]], [[1, -1], [2, 2]]]), [[1, -1], [2, 1]])\n    check('empty batch', solve([[[1, 2]], []]), [])\nelif N == 2:\n    check('new singleton', solve([[], [[2, 1]]]), [[2, 1]])\n    check('duplicate increment', solve([[[2, 1]], [[2, 1]]]), [])\n    check('partial removal', solve([[[2, 3]], [[2, -1]]]), [])\n    check('last removal', solve([[[2, 1]], [[2, -1]]]), [[2, -1]])\n    check('cancel batch', solve([[], [[2, 1], [2, -1]]]), [])\n    check('new multiplicity', solve([[], [[2, 2]]]), [[2, 1]])\n    check('mixed transitions', solve([[[2, 1]], [[2, -1], [3, 2]]]), [[2, -1], [3, 1]])\n    check('empty batch', solve([[[2, 2]], []]), [])\nelif N == 3:\n    check('new singleton', solve([[], [[3, 1]]]), [[3, 1]])\n    check('duplicate increment', solve([[[3, 1]], [[3, 1]]]), [])\n    check('partial removal', solve([[[3, 3]], [[3, -1]]]), [])\n    check('last removal', solve([[[3, 1]], [[3, -1]]]), [[3, -1]])\n    check('cancel batch', solve([[], [[3, 1], [3, -1]]]), [])\n    check('new multiplicity', solve([[], [[3, 2]]]), [[3, 1]])\n    check('mixed transitions', solve([[[3, 1]], [[3, -1], [4, 2]]]), [[3, -1], [4, 1]])\n    check('empty batch', solve([[[3, 2]], []]), [])\nelif N == 4:\n    check('new singleton', solve([[], [[4, 1]]]), [[4, 1]])\n    check('duplicate increment', solve([[[4, 1]], [[4, 1]]]), [])\n    check('partial removal', solve([[[4, 3]], [[4, -1]]]), [])\n    check('last removal', solve([[[4, 1]], [[4, -1]]]), [[4, -1]])\n    check('cancel batch', solve([[], [[4, 1], [4, -1]]]), [])\n    check('new multiplicity', solve([[], [[4, 2]]]), [[4, 1]])\n    check('mixed transitions', solve([[[4, 1]], [[4, -1], [5, 2]]]), [[4, -1], [5, 1]])\n    check('empty batch', solve([[[4, 2]], []]), [])\nelif N == 5:\n    check('new singleton', solve([[], [[5, 1]]]), [[5, 1]])\n    check('duplicate increment', solve([[[5, 1]], [[5, 1]]]), [])\n    check('partial removal', solve([[[5, 3]], [[5, -1]]]), [])\n    check('last removal', solve([[[5, 1]], [[5, -1]]]), [[5, -1]])\n    check('cancel batch', solve([[], [[5, 1], [5, -1]]]), [])\n    check('new multiplicity', solve([[], [[5, 2]]]), [[5, 1]])\n    check('mixed transitions', solve([[[5, 1]], [[5, -1], [6, 2]]]), [[5, -1], [6, 1]])\n    check('empty batch', solve([[[5, 2]], []]), [])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"s3-data-systems-incremental-distinct-positive-threshold","generated_at":"2026-09-29T14:44:14.474115+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A bounded deterministic data engine model makes representation and changelog faults reproducible.","root_cause":"incremental-distinct: Distinct requires two live copies before a value becomes present.","sha256":"1cf6ed8e0ae77a76ee0e9f02a6a933212a014580b16639a6318192eca6c5ca6c","title":"Distinct requires two live copies before a value becomes present · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":39.932,"exit_code":1,"observations":[{"actual":[[1,1]],"check":"new singleton","expected":[[1,1]],"passed":true},{"actual":[[1,-1]],"check":"duplicate increment","expected":[],"passed":false},{"actual":[[1,-1]],"check":"partial removal","expected":[],"passed":false},{"actual":[[1,-1]],"check":"last removal","expected":[[1,-1]],"passed":true},{"actual":[],"check":"cancel batch","expected":[],"passed":true},{"actual":[],"check":"new multiplicity","expected":[[1,1]],"passed":false},{"actual":[[1,-1]],"check":"mixed transitions","expected":[[1,-1],[2,1]],"passed":false},{"actual":[[1,-1]],"check":"empty batch","expected":[],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"new singleton\", \"actual\": [[1, 1]], \"expected\": [[1, 1]], \"passed\": true}, {\"check\": \"duplicate increment\", \"actual\": [[1, -1]], \"expected\": [], \"passed\": false}, {\"check\": \"partial removal\", \"actual\": [[1, -1]], \"expected\": [], \"passed\": false}, {\"check\": \"last removal\", \"actual\": [[1, -1]], \"expected\": [[1, -1]], \"passed\": true}, {\"check\": \"cancel batch\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"new multiplicity\", \"actual\": [], \"expected\": [[1, 1]], \"passed\": false}, {\"check\": \"mixed transitions\", \"actual\": [[1, -1]], \"expected\": [[1, -1], [2, 1]], \"passed\": false}, {\"check\": \"empty batch\", \"actual\": [[1, -1]], \"expected\": [], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.154,"exit_code":1,"observations":[{"actual":[],"check":"new singleton","expected":[[1,1]],"passed":false},{"actual":[],"check":"duplicate increment","expected":[],"passed":true},{"actual":[],"check":"partial removal","expected":[],"passed":true},{"actual":[[1,-1]],"check":"last removal","expected":[[1,-1]],"passed":true},{"actual":[],"check":"cancel batch","expected":[],"passed":true},{"actual":[[1,1]],"check":"new multiplicity","expected":[[1,1]],"passed":true},{"actual":[[1,-1],[2,1]],"check":"mixed transitions","expected":[[1,-1],[2,1]],"passed":true},{"actual":[],"check":"empty batch","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"new singleton\", \"actual\": [], \"expected\": [[1, 1]], \"passed\": false}, {\"check\": \"duplicate increment\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"partial removal\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"last removal\", \"actual\": [[1, -1]], \"expected\": [[1, -1]], \"passed\": true}, {\"check\": \"cancel batch\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"new multiplicity\", \"actual\": [[1, 1]], \"expected\": [[1, 1]], \"passed\": true}, {\"check\": \"mixed transitions\", \"actual\": [[1, -1], [2, 1]], \"expected\": [[1, -1], [2, 1]], \"passed\": true}, {\"check\": \"empty batch\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}