{"abstract":"A materialized total accumulates superseded row values, while an attempted repair also counts updates as new rows.","category":"Storage and queries","checks":8,"contract":"Given a valid starting [sum,row_count] and an ordered list of [old_value,new_value] changes, return the updated pair. None means the row is absent, not a nullable stored value. Changes are valid and applied exactly once; no deduplication is requested.","evaluation_group":"model-80ed9c2190fd91f3","failed_approach":"Subtracting the old value repairs the sum but incrementing count for every new value still inflates row count on updates.","family":"store-materialized-replacement-delta","id":"FA-166","implementations":{"attempt":{"sha256":"b8b9b2a2cad72534583871f577079766e46277ca6e94eaca2bbf9e7473da3dbc","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(total, count, changes):\n    for old, new in changes:\n        total += (new if new is not None else 0) - (old if old is not None else 0)\n        if new is not None:\n            count += 1\n        elif old is not None:\n            count -= 1\n    return [total, count]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement changes sum but not row count', solve(N, 1, [[N, 3*N]]), [3*N, 1])\ncheck('deleting the last row', solve(N, 1, [[N, None]]), [0, 0])\ncheck('insertion creates a row', solve(0, 0, [[None, N]]), [N, 1])\ncheck('zero is a present row value', solve(0, 1, [[0, N], [N, 0]]), [0, 1])\ncheck('multiple replacements of the same row', solve(N, 1, [[N, N+1], [N+1, -N]]), [-N, 1])\ncheck('insert and delete a zero row', solve(N, 1, [[None, 0], [0, None]]), [N, 1])\ncheck('no changes preserve the original view', solve(2*N, 2, []), [2*N, 2])\ncheck('different row operations compose', solve(3*N, 2, [[N, None], [2*N, 4*N], [None, -N]]), [3*N, 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":"fe67354d892cb33252a0a50aeec5b3b5394152ecedea2295824af15fe97a36cc","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(total, count, changes):\n    for old, new in changes:\n        if new is not None:\n            total += new\n            count += 1\n    return [total, count]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement changes sum but not row count', solve(N, 1, [[N, 3*N]]), [3*N, 1])\ncheck('deleting the last row', solve(N, 1, [[N, None]]), [0, 0])\ncheck('insertion creates a row', solve(0, 0, [[None, N]]), [N, 1])\ncheck('zero is a present row value', solve(0, 1, [[0, N], [N, 0]]), [0, 1])\ncheck('multiple replacements of the same row', solve(N, 1, [[N, N+1], [N+1, -N]]), [-N, 1])\ncheck('insert and delete a zero row', solve(N, 1, [[None, 0], [0, None]]), [N, 1])\ncheck('no changes preserve the original view', solve(2*N, 2, []), [2*N, 2])\ncheck('different row operations compose', solve(3*N, 2, [[N, None], [2*N, 4*N], [None, -N]]), [3*N, 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"},"fixed":{"sha256":"ab647e90d4035d9832f149ad7f853c57358fa930e3f2b35c7c6bdb64631ce7c0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(total, count, changes):\n    for old, new in changes:\n        total += (new if new is not None else 0) - (old if old is not None else 0)\n        count += int(new is not None) - int(old is not None)\n    return [total, count]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement changes sum but not row count', solve(N, 1, [[N, 3*N]]), [3*N, 1])\ncheck('deleting the last row', solve(N, 1, [[N, None]]), [0, 0])\ncheck('insertion creates a row', solve(0, 0, [[None, N]]), [N, 1])\ncheck('zero is a present row value', solve(0, 1, [[0, N], [N, 0]]), [0, 1])\ncheck('multiple replacements of the same row', solve(N, 1, [[N, N+1], [N+1, -N]]), [-N, 1])\ncheck('insert and delete a zero row', solve(N, 1, [[None, 0], [0, None]]), [N, 1])\ncheck('no changes preserve the original view', solve(2*N, 2, []), [2*N, 2])\ncheck('different row operations compose', solve(3*N, 2, [[N, None], [2*N, 4*N], [None, -N]]), [3*N, 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":" 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":"store-materialized-replacement-delta","generated_at":"2026-09-29T14:36:51.007172+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Models incremental maintenance of a materialized aggregate under insert, delete and replacement operations. It separates sum deltas from cardinality deltas and does not model concurrent lost updates or transaction replay.","repair":"Apply new-minus-old to the total and insertion-minus-deletion to row count, using presence tests that retain numeric zero.","root_cause":"A row replacement is treated as an insertion rather than a signed old/new contribution to an existing view.","sha256":"a8afac4131aacffb09c5f9ff2c21be817dfdbc990b0bb2fd4dcf4199f8066b54","title":"Updating a materialized summary adds the replacement without removing the old value · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":32.821,"exit_code":1,"observations":[{"actual":[3,2],"check":"replacement changes sum but not row count","expected":[3,1],"passed":false},{"actual":[0,0],"check":"deleting the last row","expected":[0,0],"passed":true},{"actual":[1,1],"check":"insertion creates a row","expected":[1,1],"passed":true},{"actual":[0,3],"check":"zero is a present row value","expected":[0,1],"passed":false},{"actual":[-1,3],"check":"multiple replacements of the same row","expected":[-1,1],"passed":false},{"actual":[1,1],"check":"insert and delete a zero row","expected":[1,1],"passed":true},{"actual":[2,2],"check":"no changes preserve the original view","expected":[2,2],"passed":true},{"actual":[3,3],"check":"different row operations compose","expected":[3,2],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement changes sum but not row count\", \"actual\": [3, 2], \"expected\": [3, 1], \"passed\": false}, {\"check\": \"deleting the last row\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"insertion creates a row\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"zero is a present row value\", \"actual\": [0, 3], \"expected\": [0, 1], \"passed\": false}, {\"check\": \"multiple replacements of the same row\", \"actual\": [-1, 3], \"expected\": [-1, 1], \"passed\": false}, {\"check\": \"insert and delete a zero row\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"no changes preserve the original view\", \"actual\": [2, 2], \"expected\": [2, 2], \"passed\": true}, {\"check\": \"different row operations compose\", \"actual\": [3, 3], \"expected\": [3, 2], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":35.786,"exit_code":1,"observations":[{"actual":[4,2],"check":"replacement changes sum but not row count","expected":[3,1],"passed":false},{"actual":[1,1],"check":"deleting the last row","expected":[0,0],"passed":false},{"actual":[1,1],"check":"insertion creates a row","expected":[1,1],"passed":true},{"actual":[1,3],"check":"zero is a present row value","expected":[0,1],"passed":false},{"actual":[2,3],"check":"multiple replacements of the same row","expected":[-1,1],"passed":false},{"actual":[1,2],"check":"insert and delete a zero row","expected":[1,1],"passed":false},{"actual":[2,2],"check":"no changes preserve the original view","expected":[2,2],"passed":true},{"actual":[6,4],"check":"different row operations compose","expected":[3,2],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement changes sum but not row count\", \"actual\": [4, 2], \"expected\": [3, 1], \"passed\": false}, {\"check\": \"deleting the last row\", \"actual\": [1, 1], \"expected\": [0, 0], \"passed\": false}, {\"check\": \"insertion creates a row\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"zero is a present row value\", \"actual\": [1, 3], \"expected\": [0, 1], \"passed\": false}, {\"check\": \"multiple replacements of the same row\", \"actual\": [2, 3], \"expected\": [-1, 1], \"passed\": false}, {\"check\": \"insert and delete a zero row\", \"actual\": [1, 2], \"expected\": [1, 1], \"passed\": false}, {\"check\": \"no changes preserve the original view\", \"actual\": [2, 2], \"expected\": [2, 2], \"passed\": true}, {\"check\": \"different row operations compose\", \"actual\": [6, 4], \"expected\": [3, 2], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":29.847,"exit_code":0,"observations":[{"actual":[3,1],"check":"replacement changes sum but not row count","expected":[3,1],"passed":true},{"actual":[0,0],"check":"deleting the last row","expected":[0,0],"passed":true},{"actual":[1,1],"check":"insertion creates a row","expected":[1,1],"passed":true},{"actual":[0,1],"check":"zero is a present row value","expected":[0,1],"passed":true},{"actual":[-1,1],"check":"multiple replacements of the same row","expected":[-1,1],"passed":true},{"actual":[1,1],"check":"insert and delete a zero row","expected":[1,1],"passed":true},{"actual":[2,2],"check":"no changes preserve the original view","expected":[2,2],"passed":true},{"actual":[3,2],"check":"different row operations compose","expected":[3,2],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement changes sum but not row count\", \"actual\": [3, 1], \"expected\": [3, 1], \"passed\": true}, {\"check\": \"deleting the last row\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"insertion creates a row\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"zero is a present row value\", \"actual\": [0, 1], \"expected\": [0, 1], \"passed\": true}, {\"check\": \"multiple replacements of the same row\", \"actual\": [-1, 1], \"expected\": [-1, 1], \"passed\": true}, {\"check\": \"insert and delete a zero row\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"no changes preserve the original view\", \"actual\": [2, 2], \"expected\": [2, 2], \"passed\": true}, {\"check\": \"different row operations compose\", \"actual\": [3, 2], \"expected\": [3, 2], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}