Why does discourse leave "(post deleted by author)" debris after deleting a post

Is it some sort of shaming, or just to pique the curiosity of readers?
It breaks up the flow of the conversation putting extra junk before the corrected post.

I don’t think it’s either of those; that post had a URL which led directly to it, and when the post is deleted that URL should still land in a useful place instead of returning a ‘not found’ result.

I think the deleted post goes away after a bit? Or maybe a moderator hid it.

Maybe it’s so you can still flag the post if it was spam, so you can’t break the flagging system by repeatedly posting and deleting the post quickly thereafter?

Keep in mind that post deletion doesn’t git rid of the copies sent
via E-mail to those of us with our accounts set to “mailing list
mode,” nor does it prevent us from responding to a deleted post and
potentially even quoting part or all of it in our posts. No
notification is sent to subscribers when a post is deleted, so we
have no way of knowing that we shouldn’t reply to it.

Assuming you’re using the web UI, the intended flow is that you just edit the original post rather than delete and re-post it. The “deleted” serves as an indication for the record that the post was there but was later deleted. Though, if you do create a post (or at least a thread) and delete it within 5 minutes, the indication is not shown.

Also, deleted posts are still visible to mods for moderation reasons, and while I can’t confirm it now as I’m not a user, I believe mod/flag hidden posts are shown as “hidden” rather than “deleted” and may be expandable (though again, cannot 100% confirm what normal users actually see in specific circumstances).

For the first 24 hours after a post has been deleted by its author, I see the “(post deleted by author)” message, and can still view the post’s edit history. After that time period has elapsed, I no longer see that message, and no longer have an option to view the post’s edit history. There is no obvious trace of the post’s former existence visible to me, except for gaps in the numbering of the posts within the discussion, and references to the post in extant replies to that post.

Quite likely, that view applies to most “normal” users.

I can see mod/flag hidden posts until they get removed. They also seem to vanish completely after they get deleted.

EDIT: To clarify, to the best of my recollection, when a post gets flagged by someone other than myself, there remains only a message to the effect that the post was flagged by the community and is temporarily hidden. Subsequently, the post disappears from my view entirely. On the other hand, if I flagged the post, it is still readable to me, but it is accompanied by a reminder that I flagged it. Ultimately, the post also disappears from my view entirely.