> I would be pretty ticked off.
Then the problem is with you. Like I've repeated, it is not about the food, it's about the company. You're thinking about your effort and your expenses, but inviting somebody for dinner is a nice gesture. What if you burnt the food by mistake while stressing about in the kitchen? Should the guest have a right to be mad because they're not getting their delicious meal? Of course not (and I hope I didn't need to state this). So why should you be ticked off if somebody does not eat at a dinner? Exception if you are only two people, and it's really about the food. But then I'd expect you to combine things ahead.
> "Oh, don't worry, I ate ahead of time"
That's not something you tell and not something you ask.
> How is it a better outcome for the guest to remain unfed, food to go to waste, and the host to have this information sprung on them at the last moment?
Because it's not about the food. You eat the leftovers for lunch the next day. You have something at home that you can make the guests if they're really hungry and can't eat the main meal.
If you're invited for dinner it's not about you or your aching belly. It is about having a more intimate meeting with other people. So don't bother them about your diet unless they ask, and don't go on an empty belly. The guests are not there to get "fed", inviting somebody for dinner is an excuse to have a nice time in a relaxed environment with people you like or want to know better.