I have a Lagrangian $L(q,\dot q, t)$ that defines a variational problem, along with a constraint that takes the form $$ df = 0 \tag{1}$$ with $f(q,t)$. I take it is what is called a "semi-holonomic" constraint (see here and here), which here is integrable. It implies that solutions of the constraint obey $$ f(q(t),t) = constant_0 \tag{2}$$
Then when I want to solve the variational problem over all paths obeying to the constraint, I need to consider variations preserving the constraint. A part of these variation are nonlocal. I can consider solutions obeying to say $f=0$ and then essentially do as is my configuration space was that $f=0$ subspace. But I also need to consider these variations with $$\partial_q f \delta q + \partial_t f = \delta constant_0 = constant_1\tag{3}$$ that would change that $constant_0$ to another constant. For $\partial_t f\neq 0$, these can have to be nonlocal, so they do not enter the local Euler-Lagrange equation frame, but still have the global form
$$ \int (\partial_t (\partial_{\dot q}L \cdot\delta q) + \delta L\cdot\delta q)dt = 0\tag{4}$$ where $\delta L$ is the so-called variational derivative of $L$.
Now, this global integral doesn't even have to exist. As far as I understand, the action defined by a Lagrangian is essentially a tool to justify the Euler-Lagrange equations, which we care about as local equations. One could argue that these $constant_0$ define different "topological sectors" of the solutions, but in my case I want to be able to make that constant vary continuously.
Question: Is my analysis right, and if so how do I deal with this extra nonlocal equation? Ideally I want to express this constraint in the Hamiltonian formalism.
Note: My actual problem involves field theory and some kind of more complicated higher degrees constraints, but I think I need to understand this simpler case first.