Happy endings are great and all but I prefer movies where the ending isn't all sunshine and rainbows. A movie where the hero / mission is flawed and well written or where there is a great sacrifice that the protagonist will probably never recover from, and the implications of their actions are massive either personally or for the world/ culture they inhabit.
I have a terrible memory so can't recall many examples but off the top of my head I would say Rouge One fits what I am looking for. This isn't the best example of what I am looking for, but it's one I assume most people would know about.
Also the movie about the kid who gets tricked into wiping out a race of insectoid aliens in a "simulation" and feels horrible about it after.
Or books, if they are better versions than the movie.