In the long term you've got to learn what you personally can and can't eat. What proportions make you lose, what puts you up and what makes you stay the same. If you go up or sts it's just a chance to examine your diet, were my portions too big? did I measure my hex's? have I had extra snacks? make small adjustments and learn more about yourself so that you are better prepared for when you are optimising to maintain.
A gain or sts is just part of the journey, not a failure, so don't panic if you get one. How many Maintainers do you think have never had one?