DiffOutcome = Literal['shown', 'untrusted_before', 'unreadable_after', 'terminators_only']What a completed file operation can honestly say about what it changed.
One closed set rather than a set of independent booleans: the four states are mutually exclusive, and every consumer needs to agree on which one holds. Split across flags, a consumer that forgets one silently reports a change as fully displayed — which is how a delete whose pre-image was lost came to render identically to deleting an empty file.
shown: diff and diff_stats describe the change. Also the state for a
genuinely unchanged file and for operations that never compute a diff.untrusted_before: the pre-operation content could not be read, so
before_content is a stand-in empty string. Any diff against it is fiction —
an unchanged file looks like a no-op, a changed one like a whole-file
insertion — so diff_stats is None and the body must not be rendered.unreadable_after: the operation succeeded but its result could not be read
back, so there is nothing to diff. after_read_error carries the reason.terminators_only: the bytes changed but diff is None, because the change
lives entirely in line terminators, which splitlines() discards.