Replaying a migration, day by day

While coding agents moved a large Angular app across five major versions, the whole program lived in one markdown file. They committed to it all day and most of the night. I built a dashboard that reads that file and checks it against git, and a replay that lets me go back to any day and see what happened.

In the pixel parity piece I wrote about the gate that every change had to pass during an Angular 16 to 21 migration. This one is about the other half of running a long job with agents: knowing where it stands, and being able to look back at how it got there.

The agent worked almost non-stop. It picked up a slice, ran it through the gate, merged it, and picked up the next. By the time I looked, a lot had happened, across a lot of commits. I needed two things. One was the state right now, in a form I could trust. The other was a way to go back to any day and see what changed, slice by slice.

Agents wrote most of both tools too, under my direction. What I decided was where the data comes from and what each tool is allowed to touch.

The program was a markdown file

The migration’s state lived in one tracker: a 330-line markdown file in the repo. It had the burn-down of files still importing legacy components, the prep work, every slice with its status, the version hops, and the decisions made along the way.

That was deliberate. The skills that drove the agents start every session by reading the tracker and git, because the agent has no memory of the last session. Only one supervisor writes to the tracker. Markdown in git meant the agent could read and edit it with the tools it already had, and I could review every change to it like code.

The cost is that a 330-line file is a bad dashboard. It tells you everything and shows you nothing.

The tracker is the database

So the first tool is a dashboard that treats the tracker as its only database. It’s a small Node server with no dependencies and no build step, and it parses the file again on every request. There’s no copy of the data to go stale. Reload the page and you see the file as it is.

The parser doesn’t trust the file’s layout, because the agent edits it. Columns move, tables gain a column, a section gets a new heading. So it finds tables by the headers they must have, not by where they sit, and it maps the many ways of writing a status onto a few.

// Illustrative sketch, not the real parser.
const tables = splitSections(md).flatMap(parseTables);
const pick = (...need) => tables.find((t) => need.every((h) => t.headers.includes(h)));

const slices = pick('Slice', 'Status', 'Files').rows.map((r) => ({
  ...r,
  status: normalise(r.Status), // "Merged ✅", "done", "merged into integration" → "merged"
}));

From those tables it builds one model: burn-down rows, prep items, slices, hops and decisions. The burn-down rows are ordered by the time of the commit each row names, not by where they appear in the file. A row without a commit falls back to its position.

Dashboard server 702 lines, its page 585.

Ask git, not the tracker

The tracker is what the agent says happened. The dashboard also asks git what actually happened, and puts the two side by side.

It counts what’s left with git grep against the remote integration branch, read-only. The remote, not the local branch, because merges happen in detached worktrees, so the local branch lags behind on purpose. A drift badge compares git’s count with the tracker’s latest row. Green if they match, amber if they don’t.

The badge is only as honest as the thing it counts. Count every line that mentions the old components and it finds the project’s own words about them: comments that say what something used to be, a README that explains the migration, a doc that says the count must stay at zero. The tracker says zero, git says four, and the badge stays amber for a migration that’s finished.

tracker says0
git says4
drift
git grep legacy-
libs/ui/button/button.component.ts// was: legacy-button, kept for the diff report
libs/ui/README.mdlegacy-* imports were removed slice by slice.
apps/web/src/app/forms/field.ts/* see legacy-form-field notes in the tracker */
docs/migration/styles.md`@angular/material/legacy-*` must stay at 0.

Four hits, and none of them imports anything.

The fix is to count what the tracker actually claims: import lines, in TypeScript files. That count can’t be fooled by documentation, because documentation doesn’t import anything. The rule I took from it: choose a measure that can’t match the project’s own description of the measure.

History is a free time machine

The tracker is a file in git, and the agent committed to it many times a day. So its history already holds every state the program was ever in. The replay just reads it.

First, git log --follow on the tracker, keeping the newest commit of each day. A day without a commit carries the previous day forward. Then a request for day N runs git show <sha>:tracker.md and passes the result through the same parser the dashboard uses. Old snapshots never change, so each parsed one is cached by its SHA. The second visit to a day costs nothing.

// Illustrative sketch.
const days = newestPerDay(gitLog('--follow', 'tracker.md')); // fills gaps with the day before
const cache = new Map();

app.get('/api/data', (req) => {
  const sha = days.at(+req.query.day - 1) ?? days.at(-1);
  if (!cache.has(sha)) cache.set(sha, parse(gitShow(sha, 'tracker.md')));
  return withDayNumbers(cache.get(sha));
});

Because it’s the same parser, the replay can’t disagree with the dashboard about what a status means. And because it only reads git, it can’t break anything. The worst it can do is be slow on the first visit to a day.

Scrub through it. The data here is invented, but the order is the real one: slices one after another, then four days of hardening, then five version hops, the last two on the same day. Pick a slice to jump to the day it merged.

58 commitstracker @ daa66d1
hardening, then hops5500070commits per dayDay 16302 files
Slices pick one to jump to the day it merged
Hardening and hops
H1H2H3H4v17v18v19v20v21
What happened on day 3
S7 merged at 0.00% · 349 → 337
S8 merged at 0.00% · 337 → 311
S9 stopped at the gate, report written
S9 fixed, gate again, merged · 311 → 302
S10 started
git log --follownewest per daygit showparsecache[sha]first visit to this SHA: read and parse

Drag, use the arrow keys, or click a bar. Invented data: 779 commits over 16 days.

Going by slices is how I used it most. I’d pick a slice, land on the day it merged, and read what else happened that day: what stopped at the gate, what started next, how far the count fell. When something looked wrong later, I could go back to the day it went in instead of reading the git log.

Replay server 599 lines, its page 491.

The screenshots replay too

Every gate run left a folder behind: screenshots, diffs and an HTML report. A second small server serves that archive in step with the replay. Ask for a day and you get the runs up to that day; anything later returns a 404. So the report you open is the one that existed then, next to the tracker as it was then.

The archive is never modified. Anything the server needs to change in a report, it changes on the way out. One script starts both servers with the same window of days and stops both when it exits, so they can’t drift apart.

Archive replay server 210 lines.

What I’d keep

Putting the program’s state in a text file in git was the cheapest decision of the whole migration, and it paid for everything here. The agent could read and write it without new tools. I could review it like code. And its history was a time machine I didn’t have to build, only read.

The dashboard taught me the other half. A tracker is a claim. Next to it there should always be a number git computes on its own, and it should count the thing itself, not the words around it.