Foreman

Case study · Rename across files

Rename fetch_user to load_user

rename fetch_user to load_user everywhere; nothing else changes

Rename across files

fm code 'rename fetch_user to load_user everywhere; nothing else changes' --worker claude

fm code tui at the end of this run: Rename fetch_user to load_user

Plan CLEAN S · Rename fetch_user to load_user

Steps

  1. Rename the definition in api.py (line 1)
  2. Update the import and call in views.py (lines 1 and 5)
  3. Update the call in jobs.py (line 5)
  4. Run the greps and the tests

Checks

  • PASS No reference to fetch_user remains in any .py file! grep -rq fetch_user --include=*.py . (failed before the work)
  • PASS load_user is defined in api.py and used in views.py and jobs.pygrep -q 'def load_user' api.py && grep -q 'import load_user' views.py && grep -q 'api.load_user' jobs.py (failed before the work)
  • PASS Existing tests still passpython -m unittest test_views

Changed

  • api.py +1 −1
  • views.py +2 −2
  • jobs.py +1 −1

Closed T-0001 closed; committed 60d5120 (3 files). Undo: git revert --no-edit 60d5120 (tokens: 99408 in, 462 out)

4 worker turns · 100k tokens · 1m13s · replay it: fm code tui --events demo/examples/rename.jsonl · the case study

The run, event by event

  1. 12s before fails: ! grep -rq fetch_user --include=*.py .
  2. 12s before fails: grep -q 'def load_user' api.py && grep -q 'import load_user' views.py && grep -q 'api.load_user' jobs.py
  3. 12s before passes: python -m unittest test_views
  4. 12s step step 1/4: Rename the definition in api.py (line 1)
  5. 29s changed api.py
  6. 29s step step 2/4: Update the import and call in views.py (lines 1 and 5)
  7. 42s changed api.py, views.py
  8. 42s step step 3/4: Update the call in jobs.py (line 5)
  9. 53s changed api.py, jobs.py, views.py
  10. 53s step step 4/4: Run the greps and the tests
  11. 1m11s changed api.py, jobs.py, views.py
  12. 1m11s check passes: ! grep -rq fetch_user --include=*.py .
  13. 1m12s check passes: grep -q 'def load_user' api.py && grep -q 'import load_user' views.py && grep -q 'api.load_user' jobs.py
  14. 1m12s check passes: python -m unittest test_views
  15. 1m13s closed T-0001 closed; committed 60d5120 (3 files). Undo: git revert --no-edit 60d5120 (tokens: 99408 in, 462 out)

Back to fm code