Airbnb recently completed a large-scale, LLM-driven code migration of nearly 3.5K React component test files from Enzyme to React Testing Library in just 6 weeks, instead of 1.5 years estimated for manual migration.
The shift from Enzyme to RTL was necessitated by Enzyme's outdated design and misalignment with modern React testing practices.
Airbnb's automated migration approach involved using large language models (LLMs) to refactor and validate test files in a step-by-step process.
Retry loops and dynamic prompting were employed to improve migration success rates, with files reattempted multiple times until validation errors were resolved.
Rich contextual prompts, including source code, related tests, and project-specific examples, enhanced the LLM's understanding of complex test files.
Systematic improvement strategies, like stamping files with migration status and targeted re-runs based on failure points, helped address remaining issues in the migration.
The automation pipeline successfully migrated 75% of target files in 4 hours, with further refinement pushing the completion rate to 97% over four days.
For the remaining 3% of files, manual intervention based on automation outputs facilitated swift completion of the migration.
The use of LLMs for large-scale code transformation proved more efficient and cost-effective compared to manual migration estimates.
Airbnb plans to further leverage LLM-powered automation for code transformations and enhance developer productivity.