{"abstract":"An empty or all-NULL aggregate is rendered as zero, while an attempted repair also erases genuine zero totals.","category":"Storage and queries","checks":7,"contract":"Return [sum,count_of_non_NULL_values,total_row_count]. Sum is None when there are no non-NULL values, otherwise their exact integer sum, including zero. A scalar aggregate always returns this one triple.","contract_signature":"values","evaluation_group":"model-9d9a7b774dc453fb","failed_approach":"NULLIF(total, 0) restores some missing values but also converts legitimate cancellation and zero measurements to NULL.","family":"store-empty-scalar-aggregate","id":"FA-116","implementations":{"attempt":{"sha256":"a5786c7ce95aa8b3f533642468f9c7ae66bd6aaa518de88e59a74479a14fb701","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport sqlite3\nN = 1\nobservations = []\ndef solve(values):\n    db = sqlite3.connect(':memory:')\n    try:\n        db.execute('CREATE TABLE measurements (v INTEGER)')\n        db.executemany('INSERT INTO measurements VALUES (?)', [(v,) for v in values])\n        return list(db.execute('SELECT NULLIF(SUM(v), 0), COUNT(v), COUNT(*) FROM measurements').fetchone())\n    finally:\n        db.close()\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('no input rows', solve([]), [None, 0, 0])\ncheck('all rows unknown', solve([None] * N), [None, 0, N])\ncheck('a real zero is a measurement', solve([0]), [0, 1, 1])\ncheck('positive and negative values cancel', solve([N, -N, None]), [0, 2, 3])\ncheck('known values amid unknowns', solve([N, None, 2*N]), [3*N, 2, 3])\ncheck('negative aggregate is retained', solve([-N, -N-1]), [-2*N-1, 2, 2])\ncheck('repeated zero rows retain counts', solve([0] * (N+1)), [0, N+1, N+1])\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":"42ff3bcc6c891ff1ebbfe9f5c490675c31af01b0fcbb6aaba54c996eff6cb575","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport sqlite3\nN = 1\nobservations = []\ndef solve(values):\n    db = sqlite3.connect(':memory:')\n    try:\n        db.execute('CREATE TABLE measurements (v INTEGER)')\n        db.executemany('INSERT INTO measurements VALUES (?)', [(v,) for v in values])\n        return list(db.execute('SELECT COALESCE(SUM(v), 0), COUNT(v), COUNT(*) FROM measurements').fetchone())\n    finally:\n        db.close()\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('no input rows', solve([]), [None, 0, 0])\ncheck('all rows unknown', solve([None] * N), [None, 0, N])\ncheck('a real zero is a measurement', solve([0]), [0, 1, 1])\ncheck('positive and negative values cancel', solve([N, -N, None]), [0, 2, 3])\ncheck('known values amid unknowns', solve([N, None, 2*N]), [3*N, 2, 3])\ncheck('negative aggregate is retained', solve([-N, -N-1]), [-2*N-1, 2, 2])\ncheck('repeated zero rows retain counts', solve([0] * (N+1)), [0, N+1, N+1])\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-empty-scalar-aggregate","generated_at":"2026-09-29T14:36:50.539440+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Uses SQLite to distinguish empty input, NULL rows and zero-valued observations in scalar query results; the intended task is aggregate result semantics, not estimating a missing-data mean.","root_cause":"A display fallback overwrites the distinction between SQL SUM's NULL result and a numeric additive identity.","sha256":"16a55c662792af90c4fe580dbddcce25f06b60b6c1f16769d218ee95c3c92010","title":"A scalar aggregate confuses no observations with a measured zero · 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":48.396,"exit_code":1,"observations":[{"actual":[null,0,0],"check":"no input rows","expected":[null,0,0],"passed":true},{"actual":[null,0,1],"check":"all rows unknown","expected":[null,0,1],"passed":true},{"actual":[null,1,1],"check":"a real zero is a measurement","expected":[0,1,1],"passed":false},{"actual":[null,2,3],"check":"positive and negative values cancel","expected":[0,2,3],"passed":false},{"actual":[3,2,3],"check":"known values amid unknowns","expected":[3,2,3],"passed":true},{"actual":[-3,2,2],"check":"negative aggregate is retained","expected":[-3,2,2],"passed":true},{"actual":[null,2,2],"check":"repeated zero rows retain counts","expected":[0,2,2],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"no input rows\", \"actual\": [null, 0, 0], \"expected\": [null, 0, 0], \"passed\": true}, {\"check\": \"all rows unknown\", \"actual\": [null, 0, 1], \"expected\": [null, 0, 1], \"passed\": true}, {\"check\": \"a real zero is a measurement\", \"actual\": [null, 1, 1], \"expected\": [0, 1, 1], \"passed\": false}, {\"check\": \"positive and negative values cancel\", \"actual\": [null, 2, 3], \"expected\": [0, 2, 3], \"passed\": false}, {\"check\": \"known values amid unknowns\", \"actual\": [3, 2, 3], \"expected\": [3, 2, 3], \"passed\": true}, {\"check\": \"negative aggregate is retained\", \"actual\": [-3, 2, 2], \"expected\": [-3, 2, 2], \"passed\": true}, {\"check\": \"repeated zero rows retain counts\", \"actual\": [null, 2, 2], \"expected\": [0, 2, 2], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.455,"exit_code":1,"observations":[{"actual":[0,0,0],"check":"no input rows","expected":[null,0,0],"passed":false},{"actual":[0,0,1],"check":"all rows unknown","expected":[null,0,1],"passed":false},{"actual":[0,1,1],"check":"a real zero is a measurement","expected":[0,1,1],"passed":true},{"actual":[0,2,3],"check":"positive and negative values cancel","expected":[0,2,3],"passed":true},{"actual":[3,2,3],"check":"known values amid unknowns","expected":[3,2,3],"passed":true},{"actual":[-3,2,2],"check":"negative aggregate is retained","expected":[-3,2,2],"passed":true},{"actual":[0,2,2],"check":"repeated zero rows retain counts","expected":[0,2,2],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"no input rows\", \"actual\": [0, 0, 0], \"expected\": [null, 0, 0], \"passed\": false}, {\"check\": \"all rows unknown\", \"actual\": [0, 0, 1], \"expected\": [null, 0, 1], \"passed\": false}, {\"check\": \"a real zero is a measurement\", \"actual\": [0, 1, 1], \"expected\": [0, 1, 1], \"passed\": true}, {\"check\": \"positive and negative values cancel\", \"actual\": [0, 2, 3], \"expected\": [0, 2, 3], \"passed\": true}, {\"check\": \"known values amid unknowns\", \"actual\": [3, 2, 3], \"expected\": [3, 2, 3], \"passed\": true}, {\"check\": \"negative aggregate is retained\", \"actual\": [-3, 2, 2], \"expected\": [-3, 2, 2], \"passed\": true}, {\"check\": \"repeated zero rows retain counts\", \"actual\": [0, 2, 2], \"expected\": [0, 2, 2], \"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."}}