AI Academy · Book
Engineering Managers · Module 02 · Chapter 009

Legacy Modernization and Migration With AI

An assistant can draft thousands of migrated files in an afternoon, and that is exactly why migrations now fail in a new way: they start fast, stall in a long tail and break behavior nobody wrote down. A manager who sorts the work by kind, demands a recorded behavior baseline before any change, and reports only verified progress can say yes to AI-assisted migration with a date attached.

≈ 12 min read

After this chapter you can

  • Sort a migration into mechanical pattern, structural port or redesign, and judge how far an assistant can carry it.
  • Record the old system's behavior as characterization tests, leaving a named owner to decide which oddities are intended.
  • Plan the move in slices, each with a shadow run, a canary and a minutes-long rollback.
  • Report verified share, untouched rate, revert rate and parity instead of files drafted.
  • Size the manual tail from a pilot of about thirty units and plan review hours for it.

In March 2025, Airbnb’s engineers described moving nearly 3,500 test files to a new testing library in six weeks, against an estimate of a year and a half; the earlier chapter AI in Software Engineering told that story, and its lesson was that automated checks decided what counted as done1. Your team has probably read it, and someone has probably asked a fair question: if a model can do that, why are we still on the framework that is two versions from end of support? The question to bring to Monday’s planning is a harder one. Can we use AI to migrate or rewrite our legacy system, and how do we keep it safe and on schedule?

The answer is a qualified yes, and the qualifications are the manager’s work. AI makes the start of a migration cheap. It does not make the finish cheap, and it does nothing about the behavior of the old system that nobody documented. This chapter covers four decisions: what kind of migration you have, what safety net exists before anything changes, in what order the pieces move, and what you report while it runs.

First, sort the work by kind

“Migration” covers jobs with very different risk. Sorting them is the first review step, because the sort decides how much of the work an assistant can reasonably carry.

A table sorting migrations into mechanical patterns, structural ports and redesigns, with the AI fit and the proof of correctness for each.Kind of changeExampleFit for AI draftingWhat proves it rightMechanicalpatternSwap one test library or API callfor anotherHigh; many units followone patternExisting tests plus compile andlint checksStructural portMove a service to a new frameworkor language, same behaviorMedium; needs slicing and reviewRecorded old behavior plus ashadow runRedesignReplace the data model or mergetwo productsLow; the target is a decision, nota translationProduct sign-off; the old systemcannot be the oracle
Figure 2.9.1 A planning aid with illustrative ratings: the further down the table, the less the old system can serve as the answer key.

The mechanical rows are where the published experience sits. Slack described converting its front-end tests from the Enzyme library to React Testing Library, as part of a move to React 18, and the account is useful because it reports failures as well as results2. Slack’s engineers said over 15,000 tests were involved. When they used a language model alone, they saw conversion success rates that “fluctuated between 40-60%.” Combining a rule-based syntax-tree transformation with the model reached 80% on the files they selected for evaluation, and that figure came from a manual review of nine test files. They reported a 22% saving in developer time, based on roughly 2,300 test cases across 338 files, of which about 500 were converted, ran and passed. Humans checked the generated code before it merged, and the authors added that AI might not be the ultimate tool for this kind of conversion.

In Slack's account, a model alone converted 40 to 60 percent of tests, a hybrid with syntax-tree rules reached 80 percent on nine reviewed files, and developers saved 22 percent of time where tests passed.40-60%Model aloneConversion success rate80%Model plussyntax-tree rulesNine selected files, reviewedby hand22%Developer time savedWhere converted tests passedSource: Slack Engineering · May 2024, updated Oct 2024
Figure 2.9.2 Slack’s own account of one test-library migration; the 80% comes from nine files and should not be read as a general rate.

Read this narrowly. It is one company’s report of one conversion, with a small evaluation sample. What it supports is a design lesson: the model did better inside a pipeline that handled the mechanical part deterministically and supplied context, and humans remained in the loop. Google’s experience report on internal code migrations reaches a compatible but broader conclusion in its abstract: use of language models can reduce migration time significantly and lower the barrier to starting and completing migration programs3. Its detail cuts the other way too: for one migration, 80 percent of the landed code modifications were fully AI-authored and engineers estimated a 50 percent time saving, yet they still had to revert some model changes that were incorrect or unnecessary. It is an experience report, not a controlled study. Neither account tells you your migration will go the same way. They tell you which kind of migration to try first.

Record what the old system does before anyone changes it

A legacy system is, among other things, the only complete specification of itself. Nobody can say what correct means for a 15-year-old pricing rule except by running it. That is why the central safety control in a migration is a characterization test, a term coined by Michael Feathers in Working Effectively with Legacy Code. Such a test does not check what the code should do; it records what the code actually does now4. You run the existing code on chosen inputs, note the outputs and write tests that assert those outputs. Afterward, any change that alters behavior shows up as a failing test, whether the new behavior is right or wrong.

An assistant is useful here, and the manager should expect it to be used. It can propose inputs, read the code for branches nobody has exercised and draft the test scaffolding quickly. What it must not do is decide which recorded behavior is intended. Characterization tests freeze bugs along with features, and only a person with product knowledge can say whether a strange rounding rule is a defect or a promise to a customer. The pattern from the previous chapters holds: generation is delegated, and judgment stays with a named owner. The rule from Testing in an AI-Assisted Pipeline, that humans decide what counts as correct, applies with extra force when the old code is the only reference.

A chain of record, slice, compare and cut over, ending with retiring the old path only once the new one matches it.RecordCapture oldbehavior as testsSliceMigrate oneseam at a timeCompareShadow runagainst oldsystemCut overCanary, withfast rollbackRetire the old path only after parity holds
Figure 2.9.3 A four-step safety net: nothing moves until its behavior is recorded, and nothing is retired until parity is shown.

Move in slices, and keep the old path alive

The best-known pattern for moving a system that matters is the strangler fig. Martin Fowler’s description, from August 2024, is to build the replacement beside the old system and gradually move behavior across until the old one can go5. He lists reasons for preferring it to a cutover rewrite. Replacing a serious system takes a long time and users cannot wait for new features; the details of existing behavior are hard to figure out; smaller pieces carry less risk; the business gets value from new components earlier; and the team learns the consequences of replacing a piece, which informs the next decision.

Several of those reasons bite harder once an assistant is involved. Fast drafting can make the one-shot rewrite more tempting, since the code appears so quickly (a risk I am pointing to, not one the sources measured). But a large AI-drafted change is a large change, and everything from Small Batches and Pull Request Discipline applies: review, rollback and learning all get slower as the batch grows. So slice by seam, a boundary where the old and new code can coexist, and give every slice four things: its recorded tests, a shadow comparison on real requests, a canary release and a rollback that takes minutes. Slices should be ordered so the early ones teach the most for the least risk: leaf modules first, shared and hot paths last.

There is a cost the plan has to carry honestly. While the strangler runs, you operate two systems. Each extra week of dual running is a week of double on-call, double patching and double confusion for new hires. A migration plan that leaves this out has understated its price, and the assistant’s speed does not remove it.

Report verified progress, not drafted progress

The most dangerous number in a migration is “files converted.” An assistant converts files at a rate set by compute, not by whether they are correct. The first report a director sees can show 90 percent of files drafted while most of them have never passed a behavior check. Set the measures before the work starts, and define each one so it cannot be inflated by drafting speed.

A table of six migration measures with what each counts, an illustrative starting threshold and what a miss indicates, led by verified share and untouched rate.MeasureWhat it countsStarting thresholdWhat a miss tells youVerified shareUnits passing recorded tests and shadowparity in production, over total unitsReported weekly; no target untilthe pilotDrafted code is being mistakenfor done workUntouched rateAI-migrated units passing everycheck with no human edit50% or more to continue tofull sweepThe work is not as mechanical asit lookedRevert rateMerged migration changes laterrolled back, over mergedUnder 2% per waveChecks are too weak; fix thembefore the next waveParityShadow requests where old andnew answers match99.5% or more of 10,000sampled requestsBehavior drift; hold the cutoverReview hoursvs planActual human review andfinishing hours over plannedWithin 20% of planThe tail is bigger than estimated;replan, do not pushDual-runningdaysDays both systems arein productionA target set per sliceThe cost of delay is accumulating
Figure 2.9.4 Illustrative starting thresholds, not rules: set your own from a pilot, and report verified share rather than units drafted.

Two of these deserve a comment. The untouched rate is a measurement of the work, not of the model: a low rate means the migration is more semantic than anyone assumed, and it should change the estimate rather than shame the team. And the revert rate is the early warning that the checks are weak. If migrated changes keep being rolled back, the problem is the safety net, and drafting more files faster will make it worse. This connects to the drift signals from Technical Debt and Code Quality Drift: a migration that finishes with two coding styles and half the old abstractions still in use has traded one debt for another.

A team-sized worked example

Illustrative numbers follow, chosen to show the arithmetic; they are an illustration, not a reported case. A team of six engineers owns a billing-rules service with 300 source files that must move from an old data-access library to the current one. The team is tempted to start a full run, and the manager asks for a pilot first.

In an invented pilot of 30 files, 18 passed untouched, 8 needed one fix and 4 needed a rewrite; scaled to 300 files, the 40 manual files take 120 of 190 review hours.Pilot outcome (30 files)FilesShare of pilotScaled to300 filesReview timeper fileHoursPasseduntouched1860%18010 minutes30Passed after onehuman fix826.7%8030 minutes40Needed manualrewrite413.3%403 hours120Total30100%300190
Figure 2.9.5 Invented figures for a 300-file migration: the manual tail is 13.3% of files but 63% of the review hours.

The pilot yields a go decision. The untouched share is 60 percent, above the team’s invented gate of 50 percent, and the manual share, 13.3 percent, is under its invented limit of 20 percent (both illustrative starting values, not rules). But thirty files is a small sample. A rough 95 percent interval around 18 of 30 is 60 percent plus or minus about 18 points, which is roughly 42 to 78 percent. The gate of 50 sits inside that range, so the manager tells the director the estimate is soft and promises to recompute after the first wave.

The finishing hours are the cost the demo hid. The tail of 40 manual files is 13.3 percent of the files and takes 120 of the 190 hours, 63 percent of the effort. With 60 hours a week of capacity (six engineers, ten hours each, since they also run the service), 190 hours is about 3.2 weeks. The plan says four weeks, which adds 25 percent of buffer for the soft estimate. These hours cover review and finishing only, not the assistant’s run time.

Before the sweep, the team records 120 old-system cases from sanitized logs as characterization tests. Four of them expose behavior that looks wrong. The billing owner and a product lead review them: three are kept, because customers depend on them, and one is fixed on purpose in a separate change after the migration. That is the owner’s decision, not the assistant’s. The migration then goes in three waves of 40, 110 and 150 files, which sum to 300. Each wave goes through a shadow run with a 99.5 percent parity gate and a canary, and the report to the director each week shows verified share, untouched rate and revert rate, never files drafted.

What goes wrong, and the review questions that catch it

A good answer to the second question names a person. A good answer to the sixth gives hours, not a feeling. A proposal with a confident date and none of these answers has not yet estimated the migration; it has estimated the drafting.

What this means for engineering managers

Your own Monday action (you own the pilot; name one engineer to run it): pick the migration your team has been wanting to start and ask for a pilot of about 30 units with three numbers back (untouched, one-fix and manual) before anyone promises a date. Copy this report skeleton for the weekly update:

Migration report, week N. Scope: units total, units in current wave. Verified share: x of y (verified means recorded tests and parity pass in production). Untouched rate: x%. Revert rate: x%. Parity this wave: x%. Review hours: actual versus plan. Dual-running days so far. Open decisions for owners: (list). Next gate: (date, criterion).

Check yourself

  1. If an AI assistant can draft 90 percent of the files in a day, the migration is 90 percent done.
  2. Characterization tests record what the old system actually does, including behavior that may be a bug.
  3. In Slack’s account, the 80 percent conversion figure was a measured general success rate across all 15,000 tests.
  4. Moving a system in slices lets you learn from early parts and limit the damage of mistakes.
  5. A small pilot gives a precise estimate of the whole migration.
  6. While old and new systems run side by side, the team pays for operating both.

Reflection

What comes next

A migration changes the code and leaves behind another problem: what the team knows about the system. The next chapter, Documentation, Knowledge and Onboarding With AI, covers how to keep that knowledge accurate for people and agents alike.

Laws referenced

General Data Protection Regulation · EU

Regulation (EU) 2016/679

Personal data is any information relating to an identified or identifiable person, directly or indirectly, including by an identifier such as an online ID (Art. 4(1)). Lawful basis and purpose limitation (Arts. 5-6); processing special-category data, including biometric data used to identify a person, health data and data revealing ethnicity, is prohibited unless a specific exception applies (Art. 9); data protection by design and by default (Art. 25); processors such as AI vendors may act only under a written contract with required terms and sufficient guarantees (Art. 28); transparency to data subjects (Arts. 13-14); right not to be subject to a decision based solely on automated processing with legal or similarly significant effects (Art. 22); breach notification to the supervisory authority within 72 hours (Art. 33) and to individuals without undue delay when the risk is high (Art. 34); data protection impact assessment for high-risk processing (Art. 35). Fines up to EUR 20 million or 4% of global turnover.

  • 2018-05-25 — Applies

Last verified 2026-10-08 · official text

Digital Operational Resilience Act (DORA) · EU (financial sector)

Regulation (EU) 2022/2554

Banks, insurers, investment firms and other financial entities must manage ICT risk, report major ICT incidents, test their resilience and manage ICT third-party risk: keep a register of ICT service contracts, include required contract terms (exit, audit, incident support) and plan for provider failure. Critical ICT third-party providers, which can include cloud and AI service providers, fall under direct EU oversight.

  • 2025-01-17 — Applies

Last verified 2026-10-08 · official text

References

  1. Charles Covey-Brandt. Accelerating Large-Scale Test Migration with LLMs. The Airbnb Tech Blog. 2025.
  2. Slack Engineering. Balancing Old Tricks with New Feats: AI-Powered Conversion From Enzyme to React Testing Library at Slack. Slack Engineering blog. 2024.
  3. Stoyan Nikolov, Daniele Codecasa, Anna Sjovall, Maxim Tabachnyk, Satish Chandra, Siddharth Taneja and Celal Ziftci. How is Google using AI for internal code migrations?. ICSE 2025, Software Engineering in Practice (arXiv 2501.06972). 2025.
  4. Michael C. Feathers. Working Effectively with Legacy Code; characterization test (as summarized in Wikipedia). Prentice Hall (book); Wikipedia (summary). 2004.
  5. Martin Fowler. Strangler Fig. martinfowler.com. 2024.

Further reading

Sources last verified 2026-10-12.