Do you "automatically" lose your visa?
No, it's never automatic in France.
Or also I think the prefecture should warn/alert to withdraw your titre de sejour.
Yes, this is how it works in France.
The clearest official source for all this I could find is this FAQ on service-public.fr:
Pendant sa durée de validité, votre carte doit ou peut vous être retirée, si vous vous trouvez dans l'un des cas suivants :
- Vous ne remplissez plus l'une des conditions d'obtention du titre
- […]
It says “peut ou doit” because there are slight nuances between the bullet points. Most relevant for you are the rules created by article L432-5
Si l'étranger cesse de remplir l'une des conditions exigées pour la délivrance de la carte de séjour dont il est titulaire, fait obstacle aux contrôles ou ne défère pas aux convocations, la carte de séjour peut lui être retirée par une décision motivée. La décision de retrait ne peut intervenir qu'après que l'intéressé a été mis à même de présenter ses observations dans les conditions prévues aux articles L. 121-1 et L. 121-2 du code des relations entre le public et l'administration.
I emphasized the key part: to strip you of your carte de séjour, the préfecture must take action and give you an opportunity to respond (unless there are exceptional circumstances or a national security issue). It's never implicit. At the same time, the wording in article R432-3 is a little stronger and if you do get a letter informing you that your permit has been invalidated, you would typically have 30 days to leave France and there isn't much you can do unless you can prove special circumstances. You are not entitled to stay in France for the original duration of your permit.
It's really up to the préfecture if and when they enforce this strictly (based on the priorities and instructions they receive from the ministry). That explains why you might get different answers from different préfectures and why they might be careful not to give people a misleading sense of certainty by posting more specific information online when they do retain the legal right to intervene when they want.