In an ideal world, this wouldn’t be an issue because anybody entering a relationship would recognize that the other person has varying levels of mental health, just like they do. You share that with each other. You don’t have something strange that your partner can’t identify with.
But we don’t live in a totally ideal world so this urge to hide mental health and figure out how to confess it, persists. I think people run into difficulty with this because of an out-dated way of thinking about mental illness–that it’s static, permanent, and debilitating. But recovery is possible. That you’re struggling with OCD now doesn’t mean you’ll be struggling with OCD later if you take steps to address your mental health challenges. So framing a confession of OCD like you’re about to tell your partner that you have an alien growing inside of you and there’s nothing you can do to stop it from hatching and destroying the world, seems like a misperception of how brains work.
Because our brains can change, and because you’re taking steps to deal with your mental health issues (you are, right?), I always recommend that you explain mental health challenges framed around what you’re doing to deal with the challenges and improve your mental health. That really applies to any problem. Don’t define yourself by the problem. If you build your identity around the problem, the problem will always be following you around. Build yourself around the healthy things you’re doing to overcome the problem. Those are things your partner can participate in and support you in.
So when should you tell your partner that you’re actively taking steps to improve and support your mental health? As soon as possible. Sharing healthy, supportive activities and interests is a wonderful way to build a relationship.