{"record":{"id":"7cb493ebcce91206","repo":"abhigyanpatwari/GitNexus","slug":"oracle-sanitization-retained-reflog-metadata","errorCode":null,"errorMessage":"oracle sanitization retained reflog metadata","messagePattern":"oracle sanitization retained reflog metadata","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":458,"sourceCode":"\n    hidden_listing = _git_checked(\n        root,\n        [\"ls-tree\", \"-r\", \"--name-only\", \"HEAD\", \"--\", HIDDEN_HARNESS_PATH.as_posix()],\n        timeout=60,\n    )\n    if hidden_listing or current.exists() or current.is_symlink():\n        raise ValueError(\"oracle sanitization left the benchmark harness visible\")\n    if _git_checked(root, [\"status\", \"--porcelain=v1\", \"--untracked-files=all\"], timeout=60):\n        raise ValueError(\"oracle sanitization did not produce a clean task snapshot\")\n    if _git_checked(root, [\"rev-parse\", \"--verify\", \"HEAD^{commit}\"], timeout=60) != sanitized_head:\n        raise ValueError(\"oracle sanitization did not retain its parentless task snapshot\")\n    parents = _git_checked(root, [\"show\", \"-s\", \"--format=%P\", \"HEAD\"], timeout=60)\n    if parents:\n        raise ValueError(\"oracle sanitization snapshot unexpectedly retained parent history\")\n    if _git_checked(root, [\"remote\"], timeout=60):\n        raise ValueError(\"oracle sanitization retained a repository remote\")\n    if logs.exists() or logs.is_symlink():\n        raise ValueError(\"oracle sanitization retained reflog metadata\")\n    return sanitized_head\n\n\ndef _write_stage_file(stage_root: Path, item: OracleFileSnapshot) -> None:\n    destination = stage_root.joinpath(*PurePosixPath(item.target).parts)\n    destination.parent.mkdir(parents=True, mode=0o700, exist_ok=True)\n    current = stage_root\n    for part in PurePosixPath(item.target).parts[:-1]:\n        current /= part\n        metadata = current.lstat()\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):\n            raise ValueError(f\"oracle stage parent must be a real directory: {item.target}\")\n        current.chmod(0o700)\n    descriptor = os.open(\n        destination,\n        os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, \"O_NOFOLLOW\", 0),\n        0o400,\n    )","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L440-L476","documentation":"Post-condition: after `shutil.rmtree(.git/logs)` and reflog expiry, .git/logs must not exist or be a symlink. If it re-appears, reflog metadata survived and could keep oracle-bearing commits reachable, so the harness aborts.","triggerScenarios":"Triggered when .git/logs is recreated after rmtree — commonly because a subsequent `git update-ref`/commit re-enabled core.logAllRefUpdates and wrote a new log, or rmtree partially failed and a process recreated the directory.","commonSituations":"A git operation between rmtree and the check that turns logging back on (default core.logAllRefUpdates=true on clones); core.logAllRefUpdates=true in the clone config; a concurrent writer.","solutions":["Disable reflog logging in the clone: `git -C <clone> config core.logAllRefUpdates false` (and `core.logAllRefUpdates=never` on newer git) before sanitizing.","Re-run reflog expire and remove logs again: `git -C <clone> reflog expire --expire=now --all && rm -rf <clone>/.git/logs`.","Ensure no git op runs between rmtree and the final check; re-clone if state is unclear."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from pathlib import Path\n\ndef logs_absent(clone: Path) -> bool:\n    logs = clone / \".git\" / \"logs\"\n    return not logs.exists() and not logs.is_symlink()\n","typeGuard":"def is_reflog_retained(exc: BaseException) -> bool:\n    return isinstance(exc, ValueError) and \"retained reflog metadata\" in str(exc)\n","tryCatchPattern":"try:\n    oracle_assets.sanitize_clone_for_hidden_oracles(clone)\nexcept ValueError as exc:\n    quarantine(clone)\n    raise AbortTask(str(exc)) from exc\n","preventionTips":["Set core.logAllRefUpdates=false on benchmark clones before sanitizing.","Do not run additional git commands between sanitize and task start."],"tags":["git","reflog","config","oracle","sanitization","postcondition","invariant"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}