Compare CSV snapshots by ID and hand off only changes
Comparing by row number makes a reorder look like a full rewrite. Use a stable ID to classify changed, added, removed and unchanged rows. Stop when keys are duplicate or missing.
Duplicate or blank IDs must stop the comparison instead of guessing a match.
Reproduce it with fixtures
old.csv and new.csv are reordered: A002 changes, A003 is removed and A004 is added. expected.csv is the change-only result; duplicate.csv is a negative case.