Created
July 13, 2026 21:57
-
-
Save jasonLaster/7d55d79c4f214ac94d9d033c62af4a22 to your computer and use it in GitHub Desktop.
Mechanical refactor transform: mirror SFT tool-use test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """Reproduce the SFT tool-use test layout move.""" | |
| import sys | |
| from pathlib import Path | |
| sys.path.append(".claude/skills/mechanical-refactor-verify") | |
| from mechanical_refactor_verify_utils import git_add_and_commit, verify_mechanical_refactor | |
| BASE_COMMIT = "23eb002571d220f3d06150d2fcdc4a727c4383a3" | |
| TARGET_COMMIT = "dc758ecf2" | |
| def _replace(path: Path, old: str, new: str) -> None: | |
| content = path.read_text() | |
| updated = content.replace(old, new) | |
| if updated == content: | |
| raise RuntimeError(f"replacement not found in {path}: {old!r}") | |
| path.write_text(updated) | |
| def transform(dir_root: Path) -> None: | |
| """Move the SFT tool-use test and update its documentation links.""" | |
| source = dir_root / "autonomy/tests/test_sft_tooluse.py" | |
| target = dir_root / "autonomy/tests/data/sft/tooluse/test_build_sft_tooluse.py" | |
| target.parent.mkdir(parents=True, exist_ok=True) | |
| source.rename(target) | |
| readme = dir_root / "autonomy/README_CLAUDE.md" | |
| _replace( | |
| readme, | |
| "tests/test_sft_tooluse.py", | |
| "tests/data/sft/tooluse/test_build_sft_tooluse.py", | |
| ) | |
| _replace(readme, "[test_sft_tooluse.py]", "[test_build_sft_tooluse.py]") | |
| git_add_and_commit("[tests, data] refactor: mirror SFT tool-use test", cwd=str(dir_root)) | |
| if __name__ == "__main__": | |
| verify_mechanical_refactor( | |
| base_commit=BASE_COMMIT, | |
| target_commit=TARGET_COMMIT, | |
| transform=transform, | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment