I learned the hard way to always be prepared to move on. I keep myself current. I actually assume the project will fail and prepare for it. If it succeed that's great news.
I never had and probably never will have golden parachutes. My insurance is what I know and why I do. It must be valuable for the marketplace, not just for the company I am currently working for. That is my duty.
I learned the hard way to always be prepared to
move on.
This bears repeating. I have had many jobs, and a lot of them were great jobs. Sometimes for whatever reason, you need/want to move.
It is quite often out of your control (e.g. the company is in trouble and they layoff your entire department or cancel the project you're working on) and even in socialist Europe there isn't really such A thing as job security (outside of the public sector anyway).
Even huge succesful companies like amazon/microsoft/google/etc sometimes have layoffs. Or they become less succesful for whatever reason you couldn't predict ahead of time and then have layoffs. Or they merge/buy another company and get rid of redundant/duplicate positions.
> I actually assume the project will fail and prepare for it
I do as well, but it is always a bit of a conflict in the back of my mind wrt feeling 100% dedicated to someone else's project. I want to feel that I'm committed 100%, but always have to be preparing for "this will not work out, what is plan B?".
At some point regardless of feelings you just shouldn't be 100% committed to some else's project, of which you have very limited control (if at all). You can be 90% committed and a professional and still get a lot done and do great work.
In the company's eyes you should be 100% or even more committed. Perception is everything in this case. But you must do it by creating your own reserve space, where you are really 90% (or less) committed while using the remainder to worry about your next gig, because it will come. That's when you learn to apply proactive procrastination (sometimes it pays off to hold off on something you suspect will be cancelled), and absolutely use all the time estimated and allocated. Say whatever they want, managers and people in general take estimates for what it must be. Therefore you make it so.