Cross-team projects and migrations
A migration is cost you move onto other teams. The staff engineer's job is to make that cost small, make every step reversible, and finish the last ten per cent personally
You are leading the move of 40 services from an old internal API to a new one. The new API is built and documented. Which services do you migrate first?
A cross-team project is any piece of work whose outcome needs changes in code that several teams own. A migration is the most common and least loved kind: the organisation agrees that something old should be replaced, and every team that depends on it has to do work it did not choose, on a timeline it did not set, for a benefit that mostly lands somewhere else.
That last clause is why migrations are a staff problem. The engineering is usually not the hard part. The hard part is that the cost falls on twelve teams and the benefit on one, so every team has a rational reason to go last. A staff engineer’s job is to change that arithmetic: make the cost per team close to zero, make every step safe enough that nobody has to be brave, and own the end so that it arrives.
This chapter is about running the migration from the technical lead’s seat. The manager’s side, deciding whether to fund it and protecting the team’s time to finish it, is in technical decisions as a manager. The decision to invest in a platform at all belongs to the head of engineering, in architecture governance and platform investment. You arrive after the decision to migrate, or you are the person proposing it.
The model: cost moved onto other teams
Will Larson calls migrations “the only mechanism to effectively manage technical debt as your company and code grow”, and lays out three stages: derisk, enable, finish. The EM chapter summarises them. Here is what each one asks of you as the engineer leading it.
Derisk. Write the design and take it to the teams that will find it hardest. Larson’s instruction is to “shop it with the teams that you believe will have the hardest time migrating” and to “embed into the most challenging one or two teams”. You are looking for the caller that uses the old system in a way nobody documented: the batch job that reads a column the API does not expose, the regulatory report that needs a consistent snapshot, the partner integration nobody at the company can redeploy. Each one either changes the design or becomes a named exception with its own plan. A design that has only been read by people who agree with it has not been derisked.
Enable. Build what makes the migration cheap for everyone else. Larson’s line is that it is “better to slow down and build tooling to programmatically migrate the easy ninety-percent”. That means generated clients, codemods, a migration guide with the five most common diffs, a test harness that proves a caller behaves the same before and after, and, where you can, pull requests your team opens for them. Google formalises this at its scale: Software Engineering at Google defines a large-scale change as “any set of changes that are logically related but cannot practically be submitted as a single atomic unit”, and its tool, Rosie, shards one such change “based upon project boundaries and ownership rules” so each owner reviews a small diff in their own code. You do not need Rosie. You need the idea: the central team writes the change; the owning team reviews it.
Finish. Stop new use first, then burn down the inventory, then delete the old thing. Larson says to start “by stopping the bleeding”, by ensuring that new code uses the new approach, and he is explicit about the tail: “getting to 100% is going to require the team leading the migration to dig into the nooks and crannies themselves.” That is you, or the team you lead. The last ten per cent is where staff engineers earn the title, because it is the work nobody else can be asked to do.
The cost function is worth writing down. Total cost is roughly the number of teams times the cost per team, plus the cost of running two systems for as long as the migration lasts. You control both terms. Tooling drives the first towards zero. Sequencing and finishing drive the second down. Announcements and deadlines change neither.
The patterns, and which one fits
Most migrations are a combination of a handful of named patterns. Pick per part, not per project: the read path, the write path and the data often want different ones.
| Pattern | How it works | Fits when | What it costs |
|---|---|---|---|
| Big-bang cutover | Stop writes, copy everything, switch every caller at once | Data small enough to copy in an accepted window; few writers that deploy together | One night carries all the risk; rollback after the window loses or must replay writes |
| Expand and contract (parallel change) | Add the new interface beside the old, move callers, then remove the old | An API, schema or library change with many callers | Both versions live for the whole migration |
| Strangler fig | Put a facade in front, route one capability at a time to the new system | Replacing a monolith or a service behaviour by behaviour | A routing layer to build and run; the old system shrinks slowly |
| Dual write, then switch | Write to both stores, backfill, compare reads, switch reads, then writes | The data model changes and many code paths touch it | Keeping two stores consistent; verification tooling |
| Replication cutover | Copy, catch up from the change log, verify, pause briefly, switch | Same data, new home: a new cluster, shard layout or engine | A pause of seconds; needs the database’s replication or a change follower |
| Codemod or large-scale change | Generate the diff for every repository; owners review | Mechanical code changes: a renamed call, a new client | Building the tool; reviewing hundreds of small changes |
Danilo Sato describes expand and contract, also called parallel change, a technique Joshua Kerievsky first documented: “In the expand phase you augment the interface to support both the old and the new versions,” then you migrate every client, then you contract. Martin Fowler’s strangler fig makes the same bet at the level of a system: gradual replacement means “both investment and returns occur gradually and visibly”, where a single replacement delivers nothing until the end, if it gets there.
Data: the steps, and where the mechanics live
When the data itself moves, Stripe’s four steps are the reference: dual write and backfill, change all read paths, change all write paths, remove the old data. Stripe compared old and new reads with GitHub’s Scientist library before switching reads, backfilled from database snapshots with MapReduce, and ramped dual writes by “slowly ramping up the percentage of objects that get duplicated”. The post’s own rule is the one to hold the plan to: “Our two tables need to stay consistent with each other at every step.”
You do not need to re-derive the mechanics, but you do need to know where they bite, because the plan has to budget for them.
- Application dual writes are not atomic. Two writes to two systems can half-succeed, and two writers can reach the second store in a different order from the first. The caching chapter shows the race on a cache, and choosing a database is blunt that dual writes from the application are not a way to keep copies consistent. During a migration, keep one store as the system of record, feed the other through a transactional outbox or change capture, and run a reconciliation job that compares them. The distributed transactions chapter and the idempotency lesson cover the outbox and why the consumer must be idempotent.
- The backfill races the live writes. A backfill that overwrites a row the dual-write path updated a second ago puts old data back. Backfill with insert-if-absent or a version check, and expect it to take hours or days on a large table; rehearse it on a copy to get the real rate.
- Verification is a step, not a hope. Compare reads from both sides in production and log every mismatch. Testing in production covers shadow traffic and tap compare from the quality seat, including measuring the noise floor before you trust the mismatch rate.
- Every switch needs a way back. The partitioning and sharding chapter puts it in one line: every working online migration copies, catches up, verifies and switches, with a way back. The shard-the-shop project is that cutover as a script: pause, drain, fence the old database, verify, move the sequences, repoint, with an abort path rehearsed first.
Your plan cites these as the mechanism and spends its words on the parts that are about people: which team switches when, who decides the step is done, and what happens if it is not.
Big-bang or incremental: where practitioners disagree
The incremental patterns are the default advice, and they are not free. An incremental migration takes longer in calendar time, runs two systems for months, needs routing, flags and verification tooling that a big-bang does not, and gives every team a reason to put its slice off. Teams that have lived through a stalled one sometimes argue, with reason, that a rehearsed big-bang over a weekend would have been cheaper.
The big-bang’s problem is that its risk is concentrated in one event you cannot fully rehearse, because the rehearsal never has production’s data, traffic and timing. If it goes wrong at 04:00, the choice is to push forward or roll back and lose whatever was written since the switch. That trade is acceptable for a small table with one writer. It is not for a payments ledger with four writers in three codebases.
A second disagreement is who does the work. One camp says the migrating team should change everyone’s code: they know the new system, and a central team making two hundred small changes is cheaper than two hundred teams each learning it. The other says owners should migrate their own code, because they know its edge cases and will maintain it afterwards. Google’s model sits between them: the central team writes the change, owners review it. Most companies end up there for the mechanical part and with owners doing the hard cases alongside you.
The third is deadlines. A hard switch-off date moves the long tail like nothing else, and a missed one teaches everyone that dates are soft. Use dates when the reason is external and real, a licence renewal, an end-of-support date, a regulatory change, and say what the reason is. The deprecation mechanics, telemetry by caller, warning headers, brownouts before shutdown, are in platform and technical PM, written for external APIs and as true for internal ones.
What the migration plan contains
The migration plan is a design doc with a schedule and an inventory. The design part goes through your normal RFC process, with a named decider and a date. The rest is what makes it runnable across teams.
- Why, and why now. The cost of the old way in terms another team’s manager would accept: incidents, hours, a licence, a date.
- End state. What is true when this is finished, including what is deleted. “Callers use the new API” is not an end state; “the old schema is dropped and the licence is not renewed” is.
- What does not change. Callers’ behaviour, latency budgets, data retention. Reviewers worry about these first.
- Inventory. Every caller, job, report and dataset, with its owning team, a size, the pattern, and who will do the change. Built from telemetry and code search, not from memory.
- Phases with entry and exit criteria. Each phase says what must be true to start, what evidence ends it, and how to go back. “Zero unexplained read mismatches for fourteen days including a month-end” is an exit criterion. “Looks good” is not.
- Stopping new use. The first change: a lint rule, a CI check, revoked database grants for new services, templates that only offer the new path.
- Asks of other teams. Each one sized, dated and agreed with the team’s manager, not announced to them.
- Tracking. A burndown from telemetry, updated automatically, and where it is published.
- Risks and the named exceptions. The callers that cannot move on the standard path, each with its own plan.
- Deletion. When the old system is turned off, archived and removed, and who presses the button.
Running it across teams
Treat other teams’ time as the scarce resource. A product team in the middle of a launch that declines your migration this quarter is not obstructing you. It is doing its job. Ask its manager what would make the change cheap enough to fit, offer to write the pull request, and agree a date. When two priorities genuinely collide, take it to the sponsor with both costs written down; that is what the sponsor is for. How to escalate without burning the relationship, and how to write the weekly status, is in managing across teams and upward.
Have a sponsor and use them rarely. A migration that crosses a dozen teams needs a director or VP who has agreed it is a priority and will say so in planning. You do not want them chasing teams. You want them to resolve the two or three real conflicts, and to make the end date credible because they have put their name on it.
Publish the burndown. Larson suggests “a mechanism which pushes migration status to teams”. A dashboard of callers remaining by team, fed by telemetry rather than by self-report, does more than any status meeting, because nobody likes being the last bar on the chart. Keep it accurate: a dashboard that shows a team as unmigrated after they finished is the fastest way to lose their goodwill.
Hold office hours. Two half-hour slots a week where any engineer can bring a stuck migration. Most problems are the same five problems; the migration guide grows from what you hear.
Do the tail yourself. The callers left at 90% are the ones with no owner after a reorganisation, the partner integration, the report the finance team runs once a year. Plan engineering time for them from the start. Larson’s warning is the reason: “If you leave one migration partially finished, folks will be exceedingly suspicious of participating in the next.”
Celebrate the deletion, not the launch. Larson argues that “the majority of the celebration and recognition should be reserved for its successful completion”. The new system going live is the start. The old one being deleted is the outcome.
Where migrations go wrong
- The design is reviewed by the easy teams. The hard callers turn up in month five, and the API needs a second version.
- New use is never stopped. The inventory grows while you burn it down, and the chart goes sideways.
- No exit criteria. Each phase ends when someone gets bored of it, and the switch happens on a feeling.
- No way back. A switch that cannot be undone turns every small surprise into an incident.
- Two systems of record. Application dual writes with no reconciliation drift quietly until a customer notices.
- The migrating team is reassigned at 80%. The organisation runs two systems indefinitely. Fund it to the end or do not start.
- A rewrite disguised as a migration. If nothing ships until everything ships, it is a rewrite, with a rewrite’s risk.
Day to day
In the derisk phase, most of your week. You write the plan, run the review, and sit with the hardest teams. You read their code and their dashboards rather than asking them to explain it. You migrate the pilot caller yourself or pair on it. The exit is a pilot in production with the numbers the plan promised.
Weekly, through the enable and finish phases. A thirty-minute sync with the team building the new system: the burndown, the blocked callers, the next phase’s entry criteria. A short written status to the sponsor and the affected managers: what moved, what is stuck, what you need. Two office-hour slots. Review of the migration pull requests your team opens for others, because their quality is your reputation.
Per phase. A go or no-go meeting, thirty minutes, with the owning team’s manager, the on-call lead and you. Read the exit criteria aloud and check the evidence against each. If one is not met, the answer is no and the date moves; record that in the decision log.
On switch days. A runbook with each step, its check and its abort, rehearsed at least once on a copy. A named person who decides to abort, and the authority to do so without a meeting. Announce the window to the teams and support beforehand, and the result afterwards.
Monthly. A review with the sponsor: burndown against plan, the named exceptions, and any ask that needs their weight. Cut scope here if you must, explicitly, so the end state stays true.
At the end. Delete the old system, archive what retention requires, revoke the access, cancel the contract. Write a one-page retrospective: what the migration cost against the plan, what the tooling saved, what you would do differently. It is the evidence the next migration will be judged on.
There is no platform team and no staff title, and the migration is usually one engineer moving the company off a framework, a database or a hosting provider. Every caller is in one or two repositories, so a codemod and a weekend often beat an incremental plan. Write a one-page plan anyway: end state, the order of steps, how you go back, and what you will delete. The real risk is that the work is interrupted by a customer fire at 60% and never resumed, so pick something you can finish in the time you can protect.
This is where the first real cross-team migration happens: the shared database that every service reads, the first move off the monolith, the second CI system. Teams now have managers and roadmaps, so asks need sizes and dates. Tooling is thin, which makes building it part of the plan. Expect to be the person who writes the design, embeds with the hard teams and does the tail, because nobody else has the context. The burndown and a VP sponsor are new to most people here; introduce both.
Migrations come from platform teams with their own roadmaps and from external dates: a licence, an end-of-support, a regulator. Hundreds of callers, some in teams that no longer exist, some in vendors’ code. There is a change process, an architecture forum and a programme office, and you work through them. Your leverage is tooling that makes owners’ review the only cost, a sponsor high enough to settle priority conflicts, and the credibility of having finished the last one. The long tail is measured in quarters; budget for it.
Template
# Migration plan: <from> to <to>
Author · Sponsor · Owning team · Status: draft | in review | running | done
Last updated · Tracking dashboard: <link> · Design doc: <link>
## Why, and why now
<The cost of the old way, in terms another team's manager accepts. The external date if there is one.>
## End state
<What is true when finished, including what is deleted, archived or cancelled.>
## What does not change
<Behaviour, latency budgets, retention, on-call ownership.>
## Inventory
| Caller / job / dataset | Owning team | Size (S/M/L) | Pattern | Changed by | Status |
|---|---|---|---|---|---|
## Approach
<Pattern per part: expand and contract, strangler, dual write then switch,
replication cutover, codemod. Which store is the system of record at each step.
Link the mechanism; do not re-explain it.>
## Phases
| Phase | What happens | Entry criteria | Exit criteria (evidence) | Way back | Target |
|---|---|---|---|---|---|
| 0 Derisk | | | | | |
| 1 Stop new use | | | | | |
| ... | | | | | |
| n Delete | | | | | |
## Asks of other teams
| Team | Ask | Size | By | Agreed with |
|---|---|---|---|---|
## Named exceptions
- <caller that cannot take the standard path> — <its plan, who moves it>
## Verification
<What is compared, how mismatches are logged, the noise floor, the threshold.>
## Tracking and communication
<Burndown source, where published, status cadence, office hours.>
## Risks
| Risk | Likelihood | Impact | Mitigation | Owner |
|---|---|---|---|---|
## Decision log
| Date | Decision | Who | Why |
|---|---|---|---| WORKED EXAMPLE
Lovage is a fictional card processor serving issuers and acquirers: 600 people, 210 engineers in 26 teams. Yaa, a staff engineer, wrote this plan with Karim, the manager of the Settlement team, and Nour, the VP of Engineering, as sponsor.
Why, and why now. Seventeen services owned by eleven teams read or write the settlement schema directly over SQL. Every column change needs eleven teams to agree, and the Oracle support contract renews in 15 months.
End state. The settlement-ledger service, with its own Postgres, is the only thing that reads or writes settlement data. Other services use its API or its event stream. The Oracle schema is dropped and the contract is not renewed.
Inventory. Three writers (clearing-import, chargebacks, fee-engine) and 14 readers. Nine readers use four query shapes that API v1 covers, so the Settlement team opens their pull requests from a codemod. Three reporting readers move to the warehouse feed. Two are named exceptions: the risk team’s models and the regulatory report, which needs a consistent end-of-day snapshot. Yaa embeds with both.
Phases. 0, months 1–2: API v1 reviewed with the risk and regulatory teams; the regulatory report migrated as the pilot. Exit: two weeks in production, p99 under 40 ms at three times peak. 1, month 2: a CI check rejects new SQL against the schema outside an allowlist, and grants are frozen. 2, months 2–7: readers and then writers move to the API, which still reads and writes Oracle behind it (a strangler facade). 3, months 6–9, entry once all three writers call the API: Oracle stays the system of record; the service writes an outbox row in the same Oracle transaction, and a relay applies it to Postgres idempotently. The backfill of 2.6 billion rows (6 million a day, 14 months online) ran at 25,000 rows a second in rehearsal, about 29 hours, so it runs as five nightly six-hour chunks with insert-if-absent. Shadow reads compare both stores. Exit: zero unexplained mismatches for 14 consecutive days including a month-end. 4, month 10: reads switch by acquirer cohort behind a flag, then writes switch and Postgres becomes the system of record, with the relay reversed to keep Oracle current for 30 days as the way back. 5, months 11–12: stop the reverse relay, archive per retention, revoke grants, drop the schema.
Asks. Eight teams small (review one pull request), three medium (one to two weeks), each agreed with the team’s manager. The fee-engine team is mid-launch; its writer moves in month 6, agreed with its manager and logged.
Now you
You are a staff engineer at Chervil, a motorbike delivery and ride-hailing company: 450 people, 120 engineers in 15 teams, nine cities in three countries, about 180,000 trips a day. Pricing lives in the monolith as an internal HTTP endpoint, and 31 services owned by 9 teams call it. A new pricing service is built, with a different API: prices are quoted with an expiry and must be confirmed. The monolith’s hosts run an operating system that goes out of support in seven months, and pricing is the last large thing on them. Complications: the rider app team is in the middle of a launch and has said it cannot take work for six weeks; four callers belong to a team dissolved in last quarter’s reorganisation, and nobody has deployed them since; one caller is a grocery partner’s integration that Chervil does not control. Write the migration plan. It must say what you stop first, how each caller moves, how you will know the new prices match the old, and what happens to the partner and the orphaned callers.
Self-check
You are the staff engineer at Chervil, a motorbike delivery and ride-hailing company (450 people, 120 engineers, about 180,000 trips a day). The trips table, 310 million rows and 1.4 TB in the monolith's MySQL, must move to the new trips service's store; scheduled rides, launching in 10 weeks, is to be built on the new service. Four writers in three teams' code write it; 11 services read it. Jonas, the trips team's manager, proposes a big-bang: 7 weeks of work, then a two-hour write freeze from 03:00 that blocks about 2,200 trips. Ifeanyi, the tech lead, estimates a dual-write migration at 14 weeks, with the first city switched in week 9. Isabel, head of product, needs to know whether the launch date holds. What do you recommend?
- POST Migrations: the sole scalable fix to tech debt Will Larson, 2018
The derisk, enable, finish playbook, including starting with the hardest teams, stopping the bleeding, and the leading team owning the tail. Read it before you write the plan, then read the finish section again at 80%.
- POST Online migrations at scale Jacqueline Xu, 2017
Stripe's four-step dual-write pattern on hundreds of millions of objects: dual write and backfill, switch reads, switch writes, remove the old data. Read it for how each step is verified before the next.
- POST Parallel Change Danilo Sato, 2014
The expand, migrate and contract pattern for changing an interface without breaking its callers. Short; the vocabulary is what you will use in every migration design.
- POST Strangler Fig Martin Fowler, 2024
The case for replacing a system gradually behind a facade rather than in one rewrite, and why a single full replacement so often fails.
- BOOK Software Engineering at Google, chapter 22: Large-Scale Changes Hyrum Wright, 2020
How a central team makes one logical change across thousands of owners' code, and why the owners only review. The model for the enable phase. Read: Chapter 22, especially the sections on sharding a change and review by local owners.
- POST Scientist: Measure Twice, Cut Once Jesse Toth, 2016
GitHub's library for running old and new code side by side in production and returning the old result, built for a multi-year rewrite of its permissions code. The tool Stripe used to verify reads.
- BOOK The Staff Engineer's Path Tanya Reilly, 2022
How a staff engineer leads a large, ambiguous cross-team project: setting it up, keeping it moving, and what to do when it stalls. Read: Part II, Execution: chapter 5, Leading Big Projects, and chapter 6, Why Have We Stopped?.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.