Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Last active July 14, 2026 02:08
Show Gist options
  • Select an option

  • Save jasonLaster/f1cf49d494b505d4acc54200e8605cb7 to your computer and use it in GitHub Desktop.

Select an option

Save jasonLaster/f1cf49d494b505d4acc54200e8605cb7 to your computer and use it in GitHub Desktop.
Mechanical refactor transform: mirror async rollout tests
#!/usr/bin/env python3
"""Reproducible transform for mirroring async rollout tests.
Run from the repo root: python3 /tmp/transform_async_rollout_test_layout.py
"""
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 = "adc49fe983044a476d5b67151abd9aff5876c9ef"
TEST_NAMES = (
"test_distributed_rollout.py",
"test_fully_async_rollout.py",
"test_generate_interface.py",
"test_strands_distributed_rollout.py",
)
def transform(dir_root: Path) -> None:
"""Move async rollout tests into the mirrored rollout directory."""
target_dir = dir_root / "autonomy/tests/rollouts"
for test_name in TEST_NAMES:
source = dir_root / "autonomy/tests" / test_name
source.rename(target_dir / test_name)
readme = dir_root / "autonomy/README_CLAUDE.md"
content = readme.read_text()
content = content.replace(
"│ ├── test_generate_interface.py",
"│ ├── rollouts/test_generate_interface.py",
)
content = content.replace(
"│ ├── test_distributed_rollout.py",
"│ ├── rollouts/test_distributed_rollout.py",
)
for test_name in (
"test_distributed_rollout.py",
"test_fully_async_rollout.py",
"test_generate_interface.py",
):
content = content.replace(
f"tests/{test_name}",
f"tests/rollouts/{test_name}",
)
readme.write_text(content)
git_add_and_commit("mechanical: mirror async rollout 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