The job was two upgrades at once. Angular from 16 to 21, five major versions, and Angular Material from its legacy components to the newer MDC-based ones. The second changes how nearly every button, field and dialog is drawn.
An earlier attempt had run the official migration schematic over the whole repo in one go. The branch fell behind main while it was being fixed, and it never caught up.
This time I did it alone, with coding agents writing much of the code under my direction. That made one question matter more than any other: how do I know a change is right without reading all of it? In an earlier piece I wrote about where an agent’s failures should go. This one is about a single gate, and the ways it lied.
One bar, and it doesn’t move
A change could merge if the app looked the same before and after it. Same pixels, route by route. Not “close enough”, and not “the agent says it’s cosmetic”.
Agents are good at explaining why a difference is fine, so nobody gets to explain. The threshold never goes up to let a run pass. If a difference is real and wanted, it goes in a ledger with a reason, and the ledger is reviewed like code. The skills that drive the agents ban the phrase “it should be fine”. Every step ends in a check, and numbers are measured again, never recalled.
The gate is my own tool, a Playwright screenshot comparer. It started with 11 hard-coded routes and fixed sleeps. It ended with 201 routes in a data file, 196 of them with an element to wait for and 150 with clicks or typing to reach the right state. Agents wrote most of its 5,661 lines too.
Over the migration: 753 runs, 78,771 screenshots, 50 fix cycles.
Making a page hold still
A pixel diff is only a gate if the same page gives the same pixels twice. Out of the box, it doesn’t. Clocks tick, data arrives late, spinners turn, and the caret blinks in whatever field has focus.
Each source of noise needed its own fix. Turn them off one at a time, or put one back and see what returns.
Still changing between captures: the list, the clock, avatar, badge, spinner, caret, the drawer, the chart panel, the heading font.
Order matters. Mocks go in before anything renders, and they’re the same files on both sides. A missing fixture fails the run instead of quietly reaching a real server. Animations go to zero, except the side drawer, which gets one millisecond. Newer Material waits for a transition to end before the drawer counts as open, and a transition of zero never ends.
Two more rules came from runs that went wrong. If the two screenshots differ in height, both are padded to the larger size and the padding is filled with magenta, so the change in height shows up as difference. And a route with a missing side is recorded as missing, never as a pass.
The login is the one step that must not repeat. It runs on test environments only, once per run, through the app’s own login page. The token is cached, a failed login is never retried, and a CAPTCHA or MFA prompt stops the run with a screenshot for me.
Both sides captured at once, with a settle step instead of fixed sleeps: 18 routes in 145.5 s instead of 257.5 s, still 18 of 18 at 0.00%.
Five ways to pass without earning it
Once the pages held still, the gate started passing things. Some of those passes were wrong, and they taught me more than any failure. Each needed its own fix, because each was a different way of having nothing real to compare.
Before and after the slice look the same, so the diff is empty.
The first one went unnoticed. Unreadable buttons scored 0.00% on every slice, because both sides of the comparison were already migrated and both had the same bug. A diff compares two pictures. If both are wrong in the same way, it has nothing to say.
So there are now three comparisons, and the baseline is never “today’s main”, which moves every day.
Before each run, a check asserts that the baseline is the commit it should be. If it isn’t, the run stops.
The other half is a contrast probe, and it needs no baseline at all. For every visible button with a label, it lays the label colour over the nearest solid background and works out the contrast. Anything under 1.5 to 1 fails. Its first run found 44 invisible buttons.
And one that nobody would have caught by eye. A change that everyone, me included, agreed couldn’t touch rendering measured 12.84%. When a number surprises me now, I zoom into the diff mask, not the screenshots. The screenshots look the same. The mask doesn’t.
Slices, not a big bang
The work was cut into slices, one area at a time, small enough that a failed gate points somewhere. Every slice branched from one long-lived integration branch, and that branch took main every day. The daily merge is what kept this attempt from drifting the way the first one did.
Four Claude Code skills ran the slices: one to do a slice, one to verify without writing code, one to move a single Angular major version, and one to bring a teammate’s branch in line. Together they’re 904 lines of instructions and no scripts. Each tells the agent it has no memory of earlier sessions, so where things stand is read from a markdown tracker and from git, every time.
What matters here is how a slice ends.
v = gate(slice.tags + ["gallery"], compare="slice") and contrast_probe()
if v.diff == 0 and not v.warnings and v.probe_failures == 0:
merge(slice, into="integration"); tracker.mark(slice, "merged")
else:
write_diff_report(); tracker.mark(slice, "blocked-visual"); stop()
Only a clean zero merges by itself. Anything else stops, with a report sorted worst first. Then a ladder decides who looks. Up to 0.1% goes to a cheap model to triage, up to 1% to the strongest model, and anything above that, or a change in size, or a missing side, is a fail. The gallery is one page that draws every shared component in every variant, so one route stands in for about 150.
Each drop is one slice. Pick one; the red dot is the slice that stopped at the gate.
Slice 7day 3, 12 files
From about 550 files still importing legacy components to none took 8 days. Then 4 days of hardening, then five version hops, one Angular major each. The last two closed on the same day.
The hops found things no type checker would. Material 20 changed design token values, which only showed up when I diffed the compiled CSS selector by selector, so they’re now pinned in a parity stylesheet. CDK 21 moved overlays to the browser’s popover API by default, which needed a config override. And the test harness hid real dependency injection errors behind its own providers, so an injector error in the harness now counts as a finding.
Final gates: 69 of 69 routes at 0 px, the second variant 12 of 12, and no failing buttons out of 1,001, 1,022 and 203.
Which model does which step
Not every step needs the strongest model, and the cheap one is faster. But a cheap model improvising on a judgement call is how a slice goes wrong quietly. So every step in the skills is tagged.
The gate is the scarce part
Agents are cheap to run side by side. The gate isn’t. Each run boots two dev servers, one per side, each in its own checkout, and a lock lets only one run at a time. So the plan for running several agents at once is really a plan for the gate.
Changes that can’t affect rendering skip the full gate: a type check, a build and one smoke screenshot. The rest wait until a few of them, each touching different areas, can go through together on a throwaway branch. One capture, one verdict per change. A failure goes back to its lane, and the rest merge one at a time through a single merger, the only one allowed to touch the integration branch or the tracker. If a change needs a new shared style rule, the batch stops. That rule lands first, with a full sweep, and every change still waiting is checked again on top of it.
I’ve run this as a pilot on one lane, over 19 files. The migration itself went slice by slice.
After the migration
The same pieces then ran a review. QA and I marked what looked wrong straight onto the screenshots, in a small review server I built for it. The agent grouped the marks by cause rather than by page, asked one batch of questions, and sent one subagent per cause to a shared fix branch, which went through the gate as one batch. One round went from about 50 marks to 7 causes, 2 lanes and 53 commits.
Next time I’d build the contrast probe before the diff. A diff can only tell me two pictures differ. The probe told me something was wrong when nothing differed, and that was the bug I couldn’t see.