DEV Community

Mohammed Ali Chherawalla
Mohammed Ali Chherawalla

Posted on Originally published at wednesday.is

How to See What a Code Change Will Break Before You Make It

Ask AI to list every file, screen and test that uses what you're about to change, before it writes any code. Then check each item on that list after the change. You find the breakage on your desk instead of in production. The free AI starter kit we build our own products with maps the impact with you.

Name the change

Say exactly what you're changing: a function, a data field, a screen, a setting. Vague changes get vague maps.

List everything that uses it

Have AI search for every place that calls it, then every place that calls those, until it reaches screens, APIs and tests. Ask for file and line for each.

Mark what users would see

From that list, pull out the screens and flows a user would notice breaking. Those are what you check by hand.

Make the change, then walk the list

After the change, run the tests and open each screen on the list. Tick each one off.

Split it if the list is long

A long list means a risky change. Break it into smaller changes and check each one.

What goes wrong

What you see Why Fix
Something far away broke Only the direct callers were checked Follow the chain to screens and tests
AI changed more than asked No map before it started Map first, then change
The list is huge The change is too big Split it
Tests pass, screen broken No test covers that screen Check the screens on the list by hand

Get the set we use

The starter kit maps what a change touches before AI writes a line. Get the starter kit free on GitHub.

Questions

How do I find everything that depends on a function?

Search for every place it's called, then every place those are called, until you reach screens and tests. AI can do this search and give you the list.

Should the impact check happen before or after the change?

Before. Knowing what's at risk changes how you make the change, and gives you a list to check afterwards.

What if the change touches more than I expected?

Split it. Make the smaller change first, check it, then the next.

Originally published at wednesday.is.

Top comments (0)