Chapter 122, paragraph beginning with “And right now, Harry James Potter-Evans-Verres was still a walking catastrophe”… and the stuff immediately preceding and following it. Seems like a pretty direct answer to your question.
Yes, but wasn’t he supposed to learn on his mistakes rather than rely on miracles to save him?
That’s what the end of the book is about.
The end of the book looks like Harry’s worst case of self-assurance and indiscretion to me.