A developer wants to use Copilot to refactor a stable payment module without changing behavior. Which sequence provides the strongest evidence that the refactor is safe?

Published
  1. Delete the old tests because generated code uses a more modern style.
  2. Accept the refactor if it contains fewer lines than the original.
  3. Establish representative behavior tests, make a bounded refactor, then run the tests and inspect the diff.
  4. Generate a new implementation and rewrite all expected test outputs to match it.

Comments — 0