Three CSV edge cases
Original synthetic examples by Shruti. Run node run-lab.mjs with Node 22+ to check all three supplied expectations.
Ambiguous keys
Left CSV
id,value C-01,ready C-01,draftDownload left CSV
Right CSV
id,value C-01,readyDownload right CSV
Reveal expected result and explanation
Expected counts: {"unchanged": 0, "changed": 0, "only_left": 0, "only_right": 0, "ambiguous": 1, "blank_key": 0, "invalid_numeric": 0}Two source records share an ID. No row is selected silently and no business resolution is inferred.
One record can span lines
Left CSV
id,value C-01,"first second"Download left CSV
Right CSV
id,value C-01,"first second"Download right CSV
Reveal expected result and explanation
Expected counts: {"unchanged": 1, "changed": 0, "only_left": 0, "only_right": 0, "ambiguous": 0, "blank_key": 0, "invalid_numeric": 0}A quoted newline belongs to one field. Physical line counts do not equal CSV record counts.
Reject incomplete quoted content
Left CSV
id,value C-01,"unfinishedDownload left CSV
Right CSV
id,value C-01,readyDownload right CSV
Reveal expected result and explanation
Expected rejection: unclosed quoted
Repair the input using the system of record. Guessing where a quoted field ends could silently change records.