{"abstract":"Equivalent nested objects produce different byte strings depending on insertion order.","category":"Serialization","checks":8,"contract":"Serialize a JSON-compatible object with string keys using Python's JSON representation, recursive key sorting, no optional spaces, literal Unicode, and finite numbers only. Return None for unsupported values. This is a specified deterministic format, not a claim of RFC 8785 conformance.","evaluation_group":"model-4478d211da09e6f6","failed_approach":"Rebuilding a sorted top-level dictionary leaves objects nested in values and arrays in insertion order.","family":"parse-recursive-json-order","id":"FA-221","implementations":{"attempt":{"sha256":"f937caa1decc34e4c07af6f30d0258da0e65043ee5d26d9f40fee60b38e169bf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(value):\n    try:\n        value = dict(sorted(value.items()))\n        return json.dumps(value, ensure_ascii=False, separators=(',', ':'), allow_nan=False)\n    except (TypeError, ValueError):\n        return None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('root ordering', solve({'z': N, 'a': 0}), '{\"a\":0,\"z\":' + str(N) + '}')\ncheck('nested ordering', solve({'outer': {'z': N, 'a': 0}}), '{\"outer\":{\"a\":0,\"z\":' + str(N) + '}}')\ncheck('objects inside arrays', solve({'items': [{'z': i, 'a': 0} for i in range(N)]}), '{\"items\":[' + ','.join('{\"a\":0,\"z\":' + str(i) + '}' for i in range(N)) + ']}')\ncheck('literal Unicode preserved', solve({'é': '界' * N, 'a': 0}), '{\"a\":0,\"é\":\"' + '界' * N + '\"}')\ncheck('no optional whitespace', solve({'x': [1, True, None]}), '{\"x\":[1,true,null]}')\ncheck('empty object', solve({}), '{}')\ncheck('nonfinite number rejected', solve({'x': float('nan')}), None)\ncheck('unsupported bytes rejected', solve({'x': b'abc'}), None)\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":"99f6bc4feb5bc7ed0aa3c5d575a743dbf0165bc5f3b1d2405e18136c6f9bf31c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(value):\n    try:\n        return json.dumps(value, ensure_ascii=False, separators=(',', ':'), allow_nan=False)\n    except (TypeError, ValueError):\n        return None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('root ordering', solve({'z': N, 'a': 0}), '{\"a\":0,\"z\":' + str(N) + '}')\ncheck('nested ordering', solve({'outer': {'z': N, 'a': 0}}), '{\"outer\":{\"a\":0,\"z\":' + str(N) + '}}')\ncheck('objects inside arrays', solve({'items': [{'z': i, 'a': 0} for i in range(N)]}), '{\"items\":[' + ','.join('{\"a\":0,\"z\":' + str(i) + '}' for i in range(N)) + ']}')\ncheck('literal Unicode preserved', solve({'é': '界' * N, 'a': 0}), '{\"a\":0,\"é\":\"' + '界' * N + '\"}')\ncheck('no optional whitespace', solve({'x': [1, True, None]}), '{\"x\":[1,true,null]}')\ncheck('empty object', solve({}), '{}')\ncheck('nonfinite number rejected', solve({'x': float('nan')}), None)\ncheck('unsupported bytes rejected', solve({'x': b'abc'}), None)\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":"f85888cfa7d4256ccea981f83ffc53ad1169e26ee3b5427215d8c55de7b9f433","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(value):\n    try:\n        return json.dumps(value, sort_keys=True, ensure_ascii=False, separators=(',', ':'), allow_nan=False)\n    except (TypeError, ValueError):\n        return None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('root ordering', solve({'z': N, 'a': 0}), '{\"a\":0,\"z\":' + str(N) + '}')\ncheck('nested ordering', solve({'outer': {'z': N, 'a': 0}}), '{\"outer\":{\"a\":0,\"z\":' + str(N) + '}}')\ncheck('objects inside arrays', solve({'items': [{'z': i, 'a': 0} for i in range(N)]}), '{\"items\":[' + ','.join('{\"a\":0,\"z\":' + str(i) + '}' for i in range(N)) + ']}')\ncheck('literal Unicode preserved', solve({'é': '界' * N, 'a': 0}), '{\"a\":0,\"é\":\"' + '界' * N + '\"}')\ncheck('no optional whitespace', solve({'x': [1, True, None]}), '{\"x\":[1,true,null]}')\ncheck('empty object', solve({}), '{}')\ncheck('nonfinite number rejected', solve({'x': float('nan')}), None)\ncheck('unsupported bytes rejected', solve({'x': b'abc'}), None)\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":"parse-recursive-json-order","generated_at":"2026-09-29T14:36:51.498064+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Bytewise snapshots and content digests require deterministic nested serialization. Sorting only the visible outer map leaves hidden order dependence.","repair":"Apply recursive object-key ordering in the serializer with explicit whitespace, Unicode, and finite-number settings.","root_cause":"Only the outer object's keys are ordered before serialization.","sha256":"5391319240792b01c3364ad36a81639d4dd5beb6033cc4c9be96c11bb77649af","title":"Sorting only the root leaves unstable nested JSON output · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":32.1,"exit_code":1,"observations":[{"actual":"{\"a\":0,\"z\":1}","check":"root ordering","expected":"{\"a\":0,\"z\":1}","passed":true},{"actual":"{\"outer\":{\"z\":1,\"a\":0}}","check":"nested ordering","expected":"{\"outer\":{\"a\":0,\"z\":1}}","passed":false},{"actual":"{\"items\":[{\"z\":0,\"a\":0}]}","check":"objects inside arrays","expected":"{\"items\":[{\"a\":0,\"z\":0}]}","passed":false},{"actual":"{\"a\":0,\"é\":\"界\"}","check":"literal Unicode preserved","expected":"{\"a\":0,\"é\":\"界\"}","passed":true},{"actual":"{\"x\":[1,true,null]}","check":"no optional whitespace","expected":"{\"x\":[1,true,null]}","passed":true},{"actual":"{}","check":"empty object","expected":"{}","passed":true},{"actual":null,"check":"nonfinite number rejected","expected":null,"passed":true},{"actual":null,"check":"unsupported bytes rejected","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"root ordering\", \"actual\": \"{\\\"a\\\":0,\\\"z\\\":1}\", \"expected\": \"{\\\"a\\\":0,\\\"z\\\":1}\", \"passed\": true}, {\"check\": \"nested ordering\", \"actual\": \"{\\\"outer\\\":{\\\"z\\\":1,\\\"a\\\":0}}\", \"expected\": \"{\\\"outer\\\":{\\\"a\\\":0,\\\"z\\\":1}}\", \"passed\": false}, {\"check\": \"objects inside arrays\", \"actual\": \"{\\\"items\\\":[{\\\"z\\\":0,\\\"a\\\":0}]}\", \"expected\": \"{\\\"items\\\":[{\\\"a\\\":0,\\\"z\\\":0}]}\", \"passed\": false}, {\"check\": \"literal Unicode preserved\", \"actual\": \"{\\\"a\\\":0,\\\"é\\\":\\\"界\\\"}\", \"expected\": \"{\\\"a\\\":0,\\\"é\\\":\\\"界\\\"}\", \"passed\": true}, {\"check\": \"no optional whitespace\", \"actual\": \"{\\\"x\\\":[1,true,null]}\", \"expected\": \"{\\\"x\\\":[1,true,null]}\", \"passed\": true}, {\"check\": \"empty object\", \"actual\": \"{}\", \"expected\": \"{}\", \"passed\": true}, {\"check\": \"nonfinite number rejected\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"unsupported bytes rejected\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":30.921,"exit_code":1,"observations":[{"actual":"{\"z\":1,\"a\":0}","check":"root ordering","expected":"{\"a\":0,\"z\":1}","passed":false},{"actual":"{\"outer\":{\"z\":1,\"a\":0}}","check":"nested ordering","expected":"{\"outer\":{\"a\":0,\"z\":1}}","passed":false},{"actual":"{\"items\":[{\"z\":0,\"a\":0}]}","check":"objects inside arrays","expected":"{\"items\":[{\"a\":0,\"z\":0}]}","passed":false},{"actual":"{\"é\":\"界\",\"a\":0}","check":"literal Unicode preserved","expected":"{\"a\":0,\"é\":\"界\"}","passed":false},{"actual":"{\"x\":[1,true,null]}","check":"no optional whitespace","expected":"{\"x\":[1,true,null]}","passed":true},{"actual":"{}","check":"empty object","expected":"{}","passed":true},{"actual":null,"check":"nonfinite number rejected","expected":null,"passed":true},{"actual":null,"check":"unsupported bytes rejected","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"root ordering\", \"actual\": \"{\\\"z\\\":1,\\\"a\\\":0}\", \"expected\": \"{\\\"a\\\":0,\\\"z\\\":1}\", \"passed\": false}, {\"check\": \"nested ordering\", \"actual\": \"{\\\"outer\\\":{\\\"z\\\":1,\\\"a\\\":0}}\", \"expected\": \"{\\\"outer\\\":{\\\"a\\\":0,\\\"z\\\":1}}\", \"passed\": false}, {\"check\": \"objects inside arrays\", \"actual\": \"{\\\"items\\\":[{\\\"z\\\":0,\\\"a\\\":0}]}\", \"expected\": \"{\\\"items\\\":[{\\\"a\\\":0,\\\"z\\\":0}]}\", \"passed\": false}, {\"check\": \"literal Unicode preserved\", \"actual\": \"{\\\"é\\\":\\\"界\\\",\\\"a\\\":0}\", \"expected\": \"{\\\"a\\\":0,\\\"é\\\":\\\"界\\\"}\", \"passed\": false}, {\"check\": \"no optional whitespace\", \"actual\": \"{\\\"x\\\":[1,true,null]}\", \"expected\": \"{\\\"x\\\":[1,true,null]}\", \"passed\": true}, {\"check\": \"empty object\", \"actual\": \"{}\", \"expected\": \"{}\", \"passed\": true}, {\"check\": \"nonfinite number rejected\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"unsupported bytes rejected\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":34.688,"exit_code":0,"observations":[{"actual":"{\"a\":0,\"z\":1}","check":"root ordering","expected":"{\"a\":0,\"z\":1}","passed":true},{"actual":"{\"outer\":{\"a\":0,\"z\":1}}","check":"nested ordering","expected":"{\"outer\":{\"a\":0,\"z\":1}}","passed":true},{"actual":"{\"items\":[{\"a\":0,\"z\":0}]}","check":"objects inside arrays","expected":"{\"items\":[{\"a\":0,\"z\":0}]}","passed":true},{"actual":"{\"a\":0,\"é\":\"界\"}","check":"literal Unicode preserved","expected":"{\"a\":0,\"é\":\"界\"}","passed":true},{"actual":"{\"x\":[1,true,null]}","check":"no optional whitespace","expected":"{\"x\":[1,true,null]}","passed":true},{"actual":"{}","check":"empty object","expected":"{}","passed":true},{"actual":null,"check":"nonfinite number rejected","expected":null,"passed":true},{"actual":null,"check":"unsupported bytes rejected","expected":null,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"root ordering\", \"actual\": \"{\\\"a\\\":0,\\\"z\\\":1}\", \"expected\": \"{\\\"a\\\":0,\\\"z\\\":1}\", \"passed\": true}, {\"check\": \"nested ordering\", \"actual\": \"{\\\"outer\\\":{\\\"a\\\":0,\\\"z\\\":1}}\", \"expected\": \"{\\\"outer\\\":{\\\"a\\\":0,\\\"z\\\":1}}\", \"passed\": true}, {\"check\": \"objects inside arrays\", \"actual\": \"{\\\"items\\\":[{\\\"a\\\":0,\\\"z\\\":0}]}\", \"expected\": \"{\\\"items\\\":[{\\\"a\\\":0,\\\"z\\\":0}]}\", \"passed\": true}, {\"check\": \"literal Unicode preserved\", \"actual\": \"{\\\"a\\\":0,\\\"é\\\":\\\"界\\\"}\", \"expected\": \"{\\\"a\\\":0,\\\"é\\\":\\\"界\\\"}\", \"passed\": true}, {\"check\": \"no optional whitespace\", \"actual\": \"{\\\"x\\\":[1,true,null]}\", \"expected\": \"{\\\"x\\\":[1,true,null]}\", \"passed\": true}, {\"check\": \"empty object\", \"actual\": \"{}\", \"expected\": \"{}\", \"passed\": true}, {\"check\": \"nonfinite number rejected\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"unsupported bytes rejected\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}