display_caveat(
outcome: DiffOutcome,
tool_name: str,
after_read_error: str | None = None| Name | Type | Description |
|---|---|---|
outcome* | DiffOutcome | |
tool_name* | str | |
after_read_error | str | None | Default: None |
Return what a successful file operation could not show, if anything.
Every case here leaves the caveat as the user's only account of a change the transcript cannot render, so each has to name what is missing. Silence would read as a complete report.
Covers all of DiffOutcome rather than the subset that mounts a diff: a
delete whose pre-image was lost produces no diff at all, so a caveat routed
only through the diff would leave destroying a 5,000-line file rendering
exactly like destroying an empty one.
Lives here rather than on any one surface because three need it: the tool
row, the DiffMessage that may replace it, and non_interactive's printed
output. A caveat produced in only one place is a caveat that goes missing on
whichever surface the user happens to be using — which is how -p came to
print an unqualified path for a change it could not verify.
Keyed on the outcome rather than on a FileOperationRecord so a widget
holding only the outcome produces the identical sentence, and the wording
cannot drift between surfaces. That holds for every outcome whose text is
self-contained; unreadable_after is the exception, degrading to a generic
reason without after_read_error. No current caller reaches it — that path
leaves record.diff unset, so no DiffMessage mounts — but a future one
passing only the outcome would render a weaker sentence than the tool row.
What the operation can honestly say about what it changed.
Name of the tool that ran, quoted into the sentence.
Reason the post-operation read failed. Required in
substance for unreadable_after, where it is the only part of the
sentence that says anything actionable.