{"abstract":"A class permutation is applied in the wrong direction.","category":"Training label alignment","checks":7,"contract":"Given labels and permutation where permutation[new_index]=old_index, return remapped labels; out-of-range labels are -1.","contract_signature":"labels, permutation","evaluation_group":"training-label-alignment-inverse-class-permutation","failed_approach":"Sorting the permutation values loses the association between old and new class identities.","family":"w3-training-label-alignment-label-permutation-inverse","id":"FA-97991","implementations":{"attempt":{"sha256":"fb0e000b6b9885743508ccd49a5126d10fb8e82afba400c2bf0e4396879afdae","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(labels, permutation):\n    return [sorted(permutation)[y] if 0<=y<len(permutation) else -1 for y in labels]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('noninvolutive map',solve([0,1,2],[1,2,0]),[2,0,1])\ncheck('out of range',solve([3,-1],[1,0]),[-1,-1])\ncheck('empty labels',solve([],[1,0]),[])\ncheck('identity map',solve([0,1],[0,1]),[0,1])\ncheck('single class',solve([0],[0]),[0])\ncheck('mixed valid invalid',solve([2,0,4],[2,0,1]),[0,1,-1])\ncheck('swap map',solve([0,1],[1,0]),[1,0])\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":"8840c4a1abc152815e44fe269f35b04eb4b6238b3d5b15814e910d6958aeebef","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(labels, permutation):\n    return [permutation[y] if 0<=y<len(permutation) else -1 for y in labels]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('noninvolutive map',solve([0,1,2],[1,2,0]),[2,0,1])\ncheck('out of range',solve([3,-1],[1,0]),[-1,-1])\ncheck('empty labels',solve([],[1,0]),[])\ncheck('identity map',solve([0,1],[0,1]),[0,1])\ncheck('single class',solve([0],[0]),[0])\ncheck('mixed valid invalid',solve([2,0,4],[2,0,1]),[0,1,-1])\ncheck('swap map',solve([0,1],[1,0]),[1,0])\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":"Permutation values are unique indices; labels are integer indices. 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":"w3-training-label-alignment-label-permutation-inverse","generated_at":"2026-09-30T16:48:07.975853+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A small deterministic training-data operation makes label ownership and ordering explicit.","root_cause":"A source-to-target class map is mistaken for a target-to-source map.","sha256":"9e939c807295be9ab99a37556c2f0aa61191e0e976a82ffe1fba22f3cf3f2060","title":"A class permutation is applied in the wrong direction · case 01","variant":1,"variant_policy":"The same explicitly authored fixtures repeat across all five numbered records; runtime N is unused. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":27.24,"exit_code":1,"observations":[{"actual":[0,1,2],"check":"noninvolutive map","expected":[2,0,1],"passed":false},{"actual":[-1,-1],"check":"out of range","expected":[-1,-1],"passed":true},{"actual":[],"check":"empty labels","expected":[],"passed":true},{"actual":[0,1],"check":"identity map","expected":[0,1],"passed":true},{"actual":[0],"check":"single class","expected":[0],"passed":true},{"actual":[2,0,-1],"check":"mixed valid invalid","expected":[0,1,-1],"passed":false},{"actual":[0,1],"check":"swap map","expected":[1,0],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"noninvolutive map\", \"actual\": [0, 1, 2], \"expected\": [2, 0, 1], \"passed\": false}, {\"check\": \"out of range\", \"actual\": [-1, -1], \"expected\": [-1, -1], \"passed\": true}, {\"check\": \"empty labels\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"identity map\", \"actual\": [0, 1], \"expected\": [0, 1], \"passed\": true}, {\"check\": \"single class\", \"actual\": [0], \"expected\": [0], \"passed\": true}, {\"check\": \"mixed valid invalid\", \"actual\": [2, 0, -1], \"expected\": [0, 1, -1], \"passed\": false}, {\"check\": \"swap map\", \"actual\": [0, 1], \"expected\": [1, 0], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":24.318,"exit_code":1,"observations":[{"actual":[1,2,0],"check":"noninvolutive map","expected":[2,0,1],"passed":false},{"actual":[-1,-1],"check":"out of range","expected":[-1,-1],"passed":true},{"actual":[],"check":"empty labels","expected":[],"passed":true},{"actual":[0,1],"check":"identity map","expected":[0,1],"passed":true},{"actual":[0],"check":"single class","expected":[0],"passed":true},{"actual":[1,2,-1],"check":"mixed valid invalid","expected":[0,1,-1],"passed":false},{"actual":[1,0],"check":"swap map","expected":[1,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"noninvolutive map\", \"actual\": [1, 2, 0], \"expected\": [2, 0, 1], \"passed\": false}, {\"check\": \"out of range\", \"actual\": [-1, -1], \"expected\": [-1, -1], \"passed\": true}, {\"check\": \"empty labels\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"identity map\", \"actual\": [0, 1], \"expected\": [0, 1], \"passed\": true}, {\"check\": \"single class\", \"actual\": [0], \"expected\": [0], \"passed\": true}, {\"check\": \"mixed valid invalid\", \"actual\": [1, 2, -1], \"expected\": [0, 1, -1], \"passed\": false}, {\"check\": \"swap map\", \"actual\": [1, 0], \"expected\": [1, 0], \"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."}}