Video in progress

Staff 🌿 Git

Changing the event format in a shared `common-events` library affects 12 repos. How do you deliver this change?

A single atomic change is not possible in a polyrepo, so I do expand/contract: first a version that supports the old and new formats together, then migrate consumers step by step, and remove the old format at the end. I automate the coordination.

📖 Answer

The main idea: at no step should everyone have to deploy at the same time. Each service ships at its own pace, so every step has to be backward compatible.

The stages:

  1. common-events 4.3.0: a new field is added and the old one stays. Readers understand both (Jackson should be configured to ignore unknown fields).
  2. Consumers move up to 4.3.0. Automation helps here: Renovate or our own script opens PRs in 12 repos, with the CI results on one dashboard.
  3. Producers start writing the new format (filling in both).
  4. Once you are sure everyone is reading the new one, through metrics and not by guesswork, the old field is removed in 5.0.0.

What Git gives you here:

  • tying the PRs in every repo to one ticket or label, to see the state of the "campaign";
  • in the library repo, a clear CHANGELOG and tags: what changed in which version;
  • if there is Kafka or another broker, putting a schema registry and a compatibility mode check into CI.

Where mistakes are made: postponing step 2 "for later". In the end 3 repos stay on the old format, nobody owns them, and 5.0.0 does not ship for a year. So the campaign needs an owner and a deadline.

If such changes happen several times a month, that is a signal to revisit the monorepo, or at least the boundaries.