For this, options were invented Just inspect the orange line in the PnL diagram: nothing can escape it, so the risk is fully "contained", thanks to options.
To me, it's when I see the company has lost its niche to the point that it impacts majorly their market position or their revenue generation, whether it's due to a change in market or people's taste, or a regulation or law change or a death or departure of a pivotal person or a change in intangible property rights that's when I would consider selling. If a company has nothing special, it's supposed to just be able to earn enough to cover their cost but for them to earn excess profit, it has to offer something special of offering the same thing faster and/or better and/or in larger quantity, doing something different or not achievable by others, an edge I should say. It's this edge that allows the company to earn excess profit and command a higher price for a share of the company. Once that edge is eroded or gone, then there is no or much less excess profit to be made then it's no longer justified for its stock to command the high price and that's when I would consider dumping the stock. Sometimes the companies do earn back their niche or develop a new niche that continues to justify its high stock price but during the interim, this is when you see the stock price tanking but people continue to hold onto it trying to give the company a chance to rebound. And during the time, they short calls to earn some income to recoup some of the losses from the stock and/or buy puts to hedge against potential further deterioration in the stock price.