Last active
July 14, 2026 02:27
-
-
Save jasonLaster/5d1d979859d46b8e9fd9b68b5b6db372 to your computer and use it in GitHub Desktop.
Mechanical refactor transform: mirror launcher and CI tests
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 launcher and CI test layout moves.""" | |
| 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 = "4445cae37fe6a52dda3fa1db136b65a9dd3bcfe1" | |
| 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 cluster-infra tests and preserve repo-root discovery.""" | |
| moves = { | |
| "autonomy/tests/test_launcher.py": "autonomy/tests/launcher/test_launcher.py", | |
| "autonomy/tests/test_autonomy_image_tests_workflow.py": ( | |
| "autonomy/tests/scripts/ci/test_autonomy_image_tests_workflow.py" | |
| ), | |
| } | |
| for source_name, target_name in moves.items(): | |
| source = dir_root / source_name | |
| target = dir_root / target_name | |
| target.parent.mkdir(parents=True, exist_ok=True) | |
| source.rename(target) | |
| _replace( | |
| dir_root / "autonomy/tests/scripts/ci/test_autonomy_image_tests_workflow.py", | |
| "REPO_ROOT = Path(__file__).resolve().parents[2]", | |
| "REPO_ROOT = Path(__file__).resolve().parents[4]", | |
| ) | |
| _replace( | |
| dir_root / "autonomy/README_CLAUDE.md", | |
| "│ ├── test_launcher.py #", | |
| "│ ├── launcher/test_launcher.py #", | |
| ) | |
| _replace( | |
| dir_root / "autonomy/README_CLAUDE.md", | |
| "[test_launcher.py](tests/test_launcher.py)", | |
| "[test_launcher.py](tests/launcher/test_launcher.py)", | |
| ) | |
| _replace( | |
| dir_root / ".claude/skills/gpu-ci/SKILL.md", | |
| "autonomy/tests/test_autonomy_image_tests_workflow.py", | |
| "autonomy/tests/scripts/ci/test_autonomy_image_tests_workflow.py", | |
| ) | |
| git_add_and_commit("[tests, ci] refactor: mirror launcher and workflow tests", 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