{"abstract":"Pivot sorts categories instead of honoring declared columns.","category":"Data systems","checks":7,"contract":"Pivot [row-id,category,value] into [row-id,list-for-category...] using the caller category order. Each cell is an ordered bag list. Unknown categories do not populate cells but retain their row identity; absent cells are empty lists and null values remain elements.","evaluation_group":"s3-data-systems-categorical-pivot-lists","failed_approach":"Reversing categories still changes output column meaning.","family":"s3-data-systems-categorical-pivot-lists-category-order","id":"FA-44881","implementations":{"attempt":{"sha256":"abeaacca4bf6d06e42f203ad78b49402098b9ae3bedf6de9eabd413367a55fb7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        rows,categories=d\n        ids=list(dict.fromkeys(row[0] for row in rows))\n        out=[]\n        for ident in ids:\n            record=[ident]\n            for category in reversed(categories):\n                cell=[value for i,c,value in rows if i==ident and c==category]\n                record.append(cell)\n            out.append(record)\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('column order', solve([[[1, 'a', 1], [1, 'b', 2]], ['b', 'a']]), [[1, [2], [1]]])\n    check('unknown-only row', solve([[[1, 'z', 1]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 1], [2, 'a', 2]], ['a']]), [[1, [1]], [2, [2]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 1], [1, 'a', 1]], ['a']]), [[1, [1, 1]]])\n    check('no categories', solve([[[1, 'a', 1]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 2:\n    check('column order', solve([[[1, 'a', 2], [1, 'b', 3]], ['b', 'a']]), [[1, [3], [2]]])\n    check('unknown-only row', solve([[[1, 'z', 2]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 2], [2, 'a', 3]], ['a']]), [[1, [2]], [2, [3]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 2], [1, 'a', 2]], ['a']]), [[1, [2, 2]]])\n    check('no categories', solve([[[1, 'a', 2]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 3:\n    check('column order', solve([[[1, 'a', 3], [1, 'b', 4]], ['b', 'a']]), [[1, [4], [3]]])\n    check('unknown-only row', solve([[[1, 'z', 3]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 3], [2, 'a', 4]], ['a']]), [[1, [3]], [2, [4]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 3], [1, 'a', 3]], ['a']]), [[1, [3, 3]]])\n    check('no categories', solve([[[1, 'a', 3]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 4:\n    check('column order', solve([[[1, 'a', 4], [1, 'b', 5]], ['b', 'a']]), [[1, [5], [4]]])\n    check('unknown-only row', solve([[[1, 'z', 4]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 4], [2, 'a', 5]], ['a']]), [[1, [4]], [2, [5]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 4], [1, 'a', 4]], ['a']]), [[1, [4, 4]]])\n    check('no categories', solve([[[1, 'a', 4]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 5:\n    check('column order', solve([[[1, 'a', 5], [1, 'b', 6]], ['b', 'a']]), [[1, [6], [5]]])\n    check('unknown-only row', solve([[[1, 'z', 5]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 5], [2, 'a', 6]], ['a']]), [[1, [5]], [2, [6]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 5], [1, 'a', 5]], ['a']]), [[1, [5, 5]]])\n    check('no categories', solve([[[1, 'a', 5]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\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":"4b55ec1ba777a6667546025f2593499256df85eec4e448574fb5088be69c1bf3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        rows,categories=d\n        ids=list(dict.fromkeys(row[0] for row in rows))\n        out=[]\n        for ident in ids:\n            record=[ident]\n            for category in sorted(categories):\n                cell=[value for i,c,value in rows if i==ident and c==category]\n                record.append(cell)\n            out.append(record)\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('column order', solve([[[1, 'a', 1], [1, 'b', 2]], ['b', 'a']]), [[1, [2], [1]]])\n    check('unknown-only row', solve([[[1, 'z', 1]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 1], [2, 'a', 2]], ['a']]), [[1, [1]], [2, [2]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 1], [1, 'a', 1]], ['a']]), [[1, [1, 1]]])\n    check('no categories', solve([[[1, 'a', 1]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 2:\n    check('column order', solve([[[1, 'a', 2], [1, 'b', 3]], ['b', 'a']]), [[1, [3], [2]]])\n    check('unknown-only row', solve([[[1, 'z', 2]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 2], [2, 'a', 3]], ['a']]), [[1, [2]], [2, [3]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 2], [1, 'a', 2]], ['a']]), [[1, [2, 2]]])\n    check('no categories', solve([[[1, 'a', 2]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 3:\n    check('column order', solve([[[1, 'a', 3], [1, 'b', 4]], ['b', 'a']]), [[1, [4], [3]]])\n    check('unknown-only row', solve([[[1, 'z', 3]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 3], [2, 'a', 4]], ['a']]), [[1, [3]], [2, [4]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 3], [1, 'a', 3]], ['a']]), [[1, [3, 3]]])\n    check('no categories', solve([[[1, 'a', 3]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 4:\n    check('column order', solve([[[1, 'a', 4], [1, 'b', 5]], ['b', 'a']]), [[1, [5], [4]]])\n    check('unknown-only row', solve([[[1, 'z', 4]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 4], [2, 'a', 5]], ['a']]), [[1, [4]], [2, [5]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 4], [1, 'a', 4]], ['a']]), [[1, [4, 4]]])\n    check('no categories', solve([[[1, 'a', 4]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 5:\n    check('column order', solve([[[1, 'a', 5], [1, 'b', 6]], ['b', 'a']]), [[1, [6], [5]]])\n    check('unknown-only row', solve([[[1, 'z', 5]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 5], [2, 'a', 6]], ['a']]), [[1, [5]], [2, [6]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 5], [1, 'a', 5]], ['a']]), [[1, [5, 5]]])\n    check('no categories', solve([[[1, 'a', 5]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\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":"2321267ab165b73e3dfda40a3391dbb8b81872432dbbb2c0dec96f9a9147cab9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        rows,categories=d\n        ids=list(dict.fromkeys(row[0] for row in rows))\n        out=[]\n        for ident in ids:\n            record=[ident]\n            for category in categories:\n                cell=[value for i,c,value in rows if i==ident and c==category]\n                record.append(cell)\n            out.append(record)\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('column order', solve([[[1, 'a', 1], [1, 'b', 2]], ['b', 'a']]), [[1, [2], [1]]])\n    check('unknown-only row', solve([[[1, 'z', 1]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 1], [2, 'a', 2]], ['a']]), [[1, [1]], [2, [2]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 1], [1, 'a', 1]], ['a']]), [[1, [1, 1]]])\n    check('no categories', solve([[[1, 'a', 1]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 2:\n    check('column order', solve([[[1, 'a', 2], [1, 'b', 3]], ['b', 'a']]), [[1, [3], [2]]])\n    check('unknown-only row', solve([[[1, 'z', 2]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 2], [2, 'a', 3]], ['a']]), [[1, [2]], [2, [3]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 2], [1, 'a', 2]], ['a']]), [[1, [2, 2]]])\n    check('no categories', solve([[[1, 'a', 2]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 3:\n    check('column order', solve([[[1, 'a', 3], [1, 'b', 4]], ['b', 'a']]), [[1, [4], [3]]])\n    check('unknown-only row', solve([[[1, 'z', 3]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 3], [2, 'a', 4]], ['a']]), [[1, [3]], [2, [4]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 3], [1, 'a', 3]], ['a']]), [[1, [3, 3]]])\n    check('no categories', solve([[[1, 'a', 3]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 4:\n    check('column order', solve([[[1, 'a', 4], [1, 'b', 5]], ['b', 'a']]), [[1, [5], [4]]])\n    check('unknown-only row', solve([[[1, 'z', 4]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 4], [2, 'a', 5]], ['a']]), [[1, [4]], [2, [5]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 4], [1, 'a', 4]], ['a']]), [[1, [4, 4]]])\n    check('no categories', solve([[[1, 'a', 4]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\nelif N == 5:\n    check('column order', solve([[[1, 'a', 5], [1, 'b', 6]], ['b', 'a']]), [[1, [6], [5]]])\n    check('unknown-only row', solve([[[1, 'z', 5]], ['a']]), [[1, []]])\n    check('two row groups', solve([[[1, 'a', 5], [2, 'a', 6]], ['a']]), [[1, [5]], [2, [6]]])\n    check('null fact', solve([[[1, 'a', None]], ['a']]), [[1, [None]]])\n    check('duplicate fact', solve([[[1, 'a', 5], [1, 'a', 5]], ['a']]), [[1, [5, 5]]])\n    check('no categories', solve([[[1, 'a', 5]], []]), [[1]])\n    check('no facts', solve([[], ['a']]), [])\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-categorical-pivot-lists-category-order","generated_at":"2026-09-29T14:44:16.604799+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.","repair":"Preserve the stated physical representation and operation order: Pivot [row-id,category,value] into [row-id,list-for-category...] using the caller category order. Each cell is an ordered bag list. Unknown categories do not populate cells but retain their row identity; absent cells are empty lists and null values remain elements.","root_cause":"categorical-pivot-lists: Pivot sorts categories instead of honoring declared columns.","sha256":"3cffe52de4d32f40632d1c954a928f344d68fe7dc37f3b71eb62de4dec82c6c8","title":"Pivot sorts categories instead of honoring declared columns · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":44.155,"exit_code":1,"observations":[{"actual":[[1,[1],[2]]],"check":"column order","expected":[[1,[2],[1]]],"passed":false},{"actual":[[1,[]]],"check":"unknown-only row","expected":[[1,[]]],"passed":true},{"actual":[[1,[1]],[2,[2]]],"check":"two row groups","expected":[[1,[1]],[2,[2]]],"passed":true},{"actual":[[1,[null]]],"check":"null fact","expected":[[1,[null]]],"passed":true},{"actual":[[1,[1,1]]],"check":"duplicate fact","expected":[[1,[1,1]]],"passed":true},{"actual":[[1]],"check":"no categories","expected":[[1]],"passed":true},{"actual":[],"check":"no facts","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"column order\", \"actual\": [[1, [1], [2]]], \"expected\": [[1, [2], [1]]], \"passed\": false}, {\"check\": \"unknown-only row\", \"actual\": [[1, []]], \"expected\": [[1, []]], \"passed\": true}, {\"check\": \"two row groups\", \"actual\": [[1, [1]], [2, [2]]], \"expected\": [[1, [1]], [2, [2]]], \"passed\": true}, {\"check\": \"null fact\", \"actual\": [[1, [null]]], \"expected\": [[1, [null]]], \"passed\": true}, {\"check\": \"duplicate fact\", \"actual\": [[1, [1, 1]]], \"expected\": [[1, [1, 1]]], \"passed\": true}, {\"check\": \"no categories\", \"actual\": [[1]], \"expected\": [[1]], \"passed\": true}, {\"check\": \"no facts\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.66,"exit_code":1,"observations":[{"actual":[[1,[1],[2]]],"check":"column order","expected":[[1,[2],[1]]],"passed":false},{"actual":[[1,[]]],"check":"unknown-only row","expected":[[1,[]]],"passed":true},{"actual":[[1,[1]],[2,[2]]],"check":"two row groups","expected":[[1,[1]],[2,[2]]],"passed":true},{"actual":[[1,[null]]],"check":"null fact","expected":[[1,[null]]],"passed":true},{"actual":[[1,[1,1]]],"check":"duplicate fact","expected":[[1,[1,1]]],"passed":true},{"actual":[[1]],"check":"no categories","expected":[[1]],"passed":true},{"actual":[],"check":"no facts","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"column order\", \"actual\": [[1, [1], [2]]], \"expected\": [[1, [2], [1]]], \"passed\": false}, {\"check\": \"unknown-only row\", \"actual\": [[1, []]], \"expected\": [[1, []]], \"passed\": true}, {\"check\": \"two row groups\", \"actual\": [[1, [1]], [2, [2]]], \"expected\": [[1, [1]], [2, [2]]], \"passed\": true}, {\"check\": \"null fact\", \"actual\": [[1, [null]]], \"expected\": [[1, [null]]], \"passed\": true}, {\"check\": \"duplicate fact\", \"actual\": [[1, [1, 1]]], \"expected\": [[1, [1, 1]]], \"passed\": true}, {\"check\": \"no categories\", \"actual\": [[1]], \"expected\": [[1]], \"passed\": true}, {\"check\": \"no facts\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.059,"exit_code":0,"observations":[{"actual":[[1,[2],[1]]],"check":"column order","expected":[[1,[2],[1]]],"passed":true},{"actual":[[1,[]]],"check":"unknown-only row","expected":[[1,[]]],"passed":true},{"actual":[[1,[1]],[2,[2]]],"check":"two row groups","expected":[[1,[1]],[2,[2]]],"passed":true},{"actual":[[1,[null]]],"check":"null fact","expected":[[1,[null]]],"passed":true},{"actual":[[1,[1,1]]],"check":"duplicate fact","expected":[[1,[1,1]]],"passed":true},{"actual":[[1]],"check":"no categories","expected":[[1]],"passed":true},{"actual":[],"check":"no facts","expected":[],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"column order\", \"actual\": [[1, [2], [1]]], \"expected\": [[1, [2], [1]]], \"passed\": true}, {\"check\": \"unknown-only row\", \"actual\": [[1, []]], \"expected\": [[1, []]], \"passed\": true}, {\"check\": \"two row groups\", \"actual\": [[1, [1]], [2, [2]]], \"expected\": [[1, [1]], [2, [2]]], \"passed\": true}, {\"check\": \"null fact\", \"actual\": [[1, [null]]], \"expected\": [[1, [null]]], \"passed\": true}, {\"check\": \"duplicate fact\", \"actual\": [[1, [1, 1]]], \"expected\": [[1, [1, 1]]], \"passed\": true}, {\"check\": \"no categories\", \"actual\": [[1]], \"expected\": [[1]], \"passed\": true}, {\"check\": \"no facts\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}