Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Code Migration at Scale: AI Agents and RuboCop
Search
George Ma
September 26, 2025
Programming
0
27
Code Migration at Scale: AI Agents and RuboCop
Learn how to automate large-scale code migrations by leveraging AI Agents to write Rubocop Cops
George Ma
September 26, 2025
Tweet
Share
More Decks by George Ma
See All by George Ma
RailsConf 2024: Ruby & Rails Versioning at Scale
georgema
0
90
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
590
Oxlint JS plugins
kazupon
1
970
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
610
CSC307 Lecture 07
javiergs
PRO
1
550
Data-Centric Kaggle
isax1015
2
780
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
130
Claude Codeと2つの巻き戻し戦略 / Two Rewind Strategies with Claude Code
fruitriin
0
130
AgentCoreとHuman in the Loop
har1101
5
240
並行開発のためのコードレビュー
miyukiw
0
260
Best-Practices-for-Cortex-Analyst-and-AI-Agent
ryotaroikeda
1
110
Featured
See All Featured
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
51
Into the Great Unknown - MozCon
thekraken
40
2.3k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Fireside Chat
paigeccino
41
3.8k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
120
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
120
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Amusing Abliteration
ianozsvald
0
100
Transcript
George Ma - Rails World 2025 Code Migration at Scale
AI-Powered Test Driven Development
Observe.log Rails.event.notify 10,000+ callsites ~3000 files
None
3,207 file changes 30,000+ total lines changed
3,207 file changes 30,000+ total lines changed
“Migrate pls”
Agenda - ❗Why agentic tooling alone was suboptimal - 💚
Why a combination of Test Driven Development, RuboCop and agentic tooling succeeded
10,000+ instances/ 3000+ files Migrate all these instances to the
new Rails Structured Logger ❗Why agentic tooling alone was suboptimal
❗Why agentic tooling alone was suboptimal
Hash rockets Mixed (hash rockets + kwargs) ❗Why agentic tooling
alone was suboptimal
Need to preserve indentation Attribute chaining (.merge) ❗Why agentic tooling
alone was suboptimal
Base hash merged with additional parameters Kwsplat combined with explicit
key-value pairs ❗Why agentic tooling alone was suboptimal
None
Give a hat
Transform A Transform B Transform C … …. Transform X
Transform Y Transform Z
None
- Read files one at a time, manually approve changes
- Frequent hallucinations - Barely faster than performing manual edits and claude-3.5
and claude-4.0 - Sub-tasks (better parallelization) - Great when the
task at hand is simpler / smaller in scope - Imperfections when the prompt is too granular
- Great when the task at hand is simpler /
smaller in scope and claude-4.0 - Sub-tasks (better parallelization) - Imperfections when the prompt is too granular
Recap
Recap Observe.log Rails.event.notify
+
💚 Test Driven Development Step 0: Start with a new
Cop and its corresponding test Cop Cop_test
Step 1: Prompt Claude to write a (failing) test 💚
Test Driven Development
- Provides a base-line for Cop development / correctness -
Prevents regressions as you add additional cases 💚 Test Driven Development
Step 2: Ask Claude to create the Cop’s autocorrect logic
to pass this test case 💚 Test Driven Development
Step 2.5: Repeat steps 1 & 2 until all cases
are autocorrectable 💚 Test Driven Development
cops/observe_log_to_rails_event.rb
observe_log_to_rails_event_test.rb
Step 3: Run the Cop with the autocorrect flag (`-a`)
💚 Test Driven Development
Step 4: Reap the benefits 💚 Test Driven Development
- Less token use/time spent waiting for agents to run
- Leverage TDD and agentic tooling’s strengths to write the Cop itself - Cop that produces deterministic results every time 🚀
None