{"abstract":"Truncation rewinds an open file position.","category":"Filesystem semantics","checks":6,"contract":"Deterministic in-memory filesystem model. Resize text to nonnegative size, filling growth with null characters, and return [new text, unchanged nonnegative offset].","evaluation_group":"model-f75aebda6775b4b4","failed_approach":"Clamping the position to new EOF still changes a valid beyond-EOF offset.","family":"z-filesystems-truncate-offset","id":"FA-11581","implementations":{"attempt":{"sha256":"154b338e6572d53551defab5fa11e949a0f53e65fae398df96bcc8cab5f45de7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, offset, size):\n    return [text[:size]+'\\0'*max(0,size-len(text)),min(offset,size)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('shrink below current offset',solve('abcdef',N+6,2),['ab',N+6])\ncheck('truncate to zero retains position',solve('abc',N,0),['',N])\ncheck('growth retains position',solve('a',1,3),['a\\0\\0',1])\ncheck('same size retains position',solve('abc',2,3),['abc',2])\ncheck('position zero',solve('abc',0,1),['a',0])\ncheck('empty growing file',solve('',N,1),['\\0',N])\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":"e90aaf101be6f410497802bf38597dc703b155b380a23d6b2f22524201c312c2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, offset, size):\n    return [text[:size]+'\\0'*max(0,size-len(text)),0]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('shrink below current offset',solve('abcdef',N+6,2),['ab',N+6])\ncheck('truncate to zero retains position',solve('abc',N,0),['',N])\ncheck('growth retains position',solve('a',1,3),['a\\0\\0',1])\ncheck('same size retains position',solve('abc',2,3),['abc',2])\ncheck('position zero',solve('abc',0,1),['a',0])\ncheck('empty growing file',solve('',N,1),['\\0',N])\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":"d23109b2abc7dfffe357c30cdea3a6239a078d32ed22019e0603a6550ff06fb9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, offset, size):\n    return [text[:size]+'\\0'*max(0,size-len(text)),offset]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('shrink below current offset',solve('abcdef',N+6,2),['ab',N+6])\ncheck('truncate to zero retains position',solve('abc',N,0),['',N])\ncheck('growth retains position',solve('a',1,3),['a\\0\\0',1])\ncheck('same size retains position',solve('abc',2,3),['abc',2])\ncheck('position zero',solve('abc',0,1),['a',0])\ncheck('empty growing file',solve('',N,1),['\\0',N])\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":"z-filesystems-truncate-offset","generated_at":"2026-09-29T14:38:49.217094+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"An offline semantic experiment for file API clients; it models only the stated operations, not a complete operating system.","repair":"Resize contents while retaining the descriptor position even beyond new EOF.","root_cause":"Changing file length is incorrectly coupled to changing the descriptor offset.","sha256":"2401341bb79e1fd9a6e1d722e4ad862825b90d6831966267bc10c7d87ecbf46a","title":"Truncation rewinds an open file position · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.621,"exit_code":1,"observations":[{"actual":["ab",2],"check":"shrink below current offset","expected":["ab",7],"passed":false},{"actual":["",0],"check":"truncate to zero retains position","expected":["",1],"passed":false},{"actual":["a\u0000\u0000",1],"check":"growth retains position","expected":["a\u0000\u0000",1],"passed":true},{"actual":["abc",2],"check":"same size retains position","expected":["abc",2],"passed":true},{"actual":["a",0],"check":"position zero","expected":["a",0],"passed":true},{"actual":["\u0000",1],"check":"empty growing file","expected":["\u0000",1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"shrink below current offset\", \"actual\": [\"ab\", 2], \"expected\": [\"ab\", 7], \"passed\": false}, {\"check\": \"truncate to zero retains position\", \"actual\": [\"\", 0], \"expected\": [\"\", 1], \"passed\": false}, {\"check\": \"growth retains position\", \"actual\": [\"a\\u0000\\u0000\", 1], \"expected\": [\"a\\u0000\\u0000\", 1], \"passed\": true}, {\"check\": \"same size retains position\", \"actual\": [\"abc\", 2], \"expected\": [\"abc\", 2], \"passed\": true}, {\"check\": \"position zero\", \"actual\": [\"a\", 0], \"expected\": [\"a\", 0], \"passed\": true}, {\"check\": \"empty growing file\", \"actual\": [\"\\u0000\", 1], \"expected\": [\"\\u0000\", 1], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":37.841,"exit_code":1,"observations":[{"actual":["ab",0],"check":"shrink below current offset","expected":["ab",7],"passed":false},{"actual":["",0],"check":"truncate to zero retains position","expected":["",1],"passed":false},{"actual":["a\u0000\u0000",0],"check":"growth retains position","expected":["a\u0000\u0000",1],"passed":false},{"actual":["abc",0],"check":"same size retains position","expected":["abc",2],"passed":false},{"actual":["a",0],"check":"position zero","expected":["a",0],"passed":true},{"actual":["\u0000",0],"check":"empty growing file","expected":["\u0000",1],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"shrink below current offset\", \"actual\": [\"ab\", 0], \"expected\": [\"ab\", 7], \"passed\": false}, {\"check\": \"truncate to zero retains position\", \"actual\": [\"\", 0], \"expected\": [\"\", 1], \"passed\": false}, {\"check\": \"growth retains position\", \"actual\": [\"a\\u0000\\u0000\", 0], \"expected\": [\"a\\u0000\\u0000\", 1], \"passed\": false}, {\"check\": \"same size retains position\", \"actual\": [\"abc\", 0], \"expected\": [\"abc\", 2], \"passed\": false}, {\"check\": \"position zero\", \"actual\": [\"a\", 0], \"expected\": [\"a\", 0], \"passed\": true}, {\"check\": \"empty growing file\", \"actual\": [\"\\u0000\", 0], \"expected\": [\"\\u0000\", 1], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.583,"exit_code":0,"observations":[{"actual":["ab",7],"check":"shrink below current offset","expected":["ab",7],"passed":true},{"actual":["",1],"check":"truncate to zero retains position","expected":["",1],"passed":true},{"actual":["a\u0000\u0000",1],"check":"growth retains position","expected":["a\u0000\u0000",1],"passed":true},{"actual":["abc",2],"check":"same size retains position","expected":["abc",2],"passed":true},{"actual":["a",0],"check":"position zero","expected":["a",0],"passed":true},{"actual":["\u0000",1],"check":"empty growing file","expected":["\u0000",1],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"shrink below current offset\", \"actual\": [\"ab\", 7], \"expected\": [\"ab\", 7], \"passed\": true}, {\"check\": \"truncate to zero retains position\", \"actual\": [\"\", 1], \"expected\": [\"\", 1], \"passed\": true}, {\"check\": \"growth retains position\", \"actual\": [\"a\\u0000\\u0000\", 1], \"expected\": [\"a\\u0000\\u0000\", 1], \"passed\": true}, {\"check\": \"same size retains position\", \"actual\": [\"abc\", 2], \"expected\": [\"abc\", 2], \"passed\": true}, {\"check\": \"position zero\", \"actual\": [\"a\", 0], \"expected\": [\"a\", 0], \"passed\": true}, {\"check\": \"empty growing file\", \"actual\": [\"\\u0000\", 1], \"expected\": [\"\\u0000\", 1], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}