If I try to solve a problem two different ways, I get two different answers which generally means I am committing some horrible sin!
Given the problem, \begin{align} \min_u\ S &= \int dt\ L(x, u) \\ \text{s.t.}\ \dot{x} &= f(u) \end{align} for $ x, u $ being functions of time.
Chain Rule Solution
Just doing chain rule, \begin{align} \delta S &= \int dt\ \left( \frac{\partial L}{\partial u} + \frac{\partial L}{\partial x} \frac{\partial x}{\partial u} \right) \delta u \\ \end{align}
Thus, \begin{align} \frac{\partial L}{\partial u} = -\frac{\partial L}{\partial x} \frac{\partial x}{\partial u} = -\frac{\partial L}{\partial x} \int dt\ \frac{\partial f}{\partial u} \\ \end{align}
Note that I have seen this done in literature and it was simulated numerically and worked ... so
Control Theory
Otherwise, if I follow the standard Control Theory way and use the method of undetermined multipliers, \begin{align} \bar{S} &= \int dt\ L(x, u) + \lambda (f(u) - \dot{x}) \\ &= (\lambda x)\big|_{(t_i, t_f)} + \int dt\ L(x, u) + \lambda f(u) + \dot{\lambda} x \end{align}
If I demand that variations vanish at the beginning and end points, \begin{align} \delta \bar{S} = \int dt\ \left( \frac{\partial L}{\partial u} + \lambda \frac{\partial f}{\partial u} \right) \delta u + \left( \frac{\partial L}{\partial x} + \dot{\lambda} \right) \delta x \end{align}
Then, \begin{align} \frac{\partial L}{\partial u} = -\lambda \frac{\partial f}{\partial u} \hspace{1cm} \dot{\lambda} = -\frac{\partial L}{\partial x} \end{align}
Thus, \begin{align} \frac{\partial L}{\partial u} &= +\frac{\partial f}{\partial u} \int dt\ \frac{\partial L}{\partial x} \end{align}
Which is clearly different from the above answer. What am I doing wrong?
The problem was that the physicist in me was sloppy. I know ... that never ever happens! A colleague pointed my mistake out to me.
I should have done it like this (I take all the lower integration bounds to be $ -\infty $ and drop them), \begin{align} \min_u S[u] &\triangleq \int^T_{-\infty} L(x(t), u(t)) \\ \text{s.t.}\ \dot{x} &= f(u) \end{align}
Chain Rule
\begin{align} 0 &= \frac{d}{d\epsilon} S[u + \epsilon \delta u] \Big|_{\epsilon = 0} \\ &= \int^T dt\ \frac{d}{d\epsilon} \left[ L(\int^t dt' f(u + \epsilon \delta u) + C, u + \epsilon \delta u) \right]_{\epsilon = 0} \\ &= \int^T dt\ \left( \frac{\partial L}{\partial x} \left[ \int^t dt\frac{\partial f}{\partial u} \delta u \right] + \frac{\partial L}{\partial u} \delta u \right) \\ &\stackrel{IBP}{=} \left[ \int^T dt\ \frac{\partial L}{\partial x} \right] \left[ \int^T dt\frac{\partial f}{\partial u} \delta u \right] + \int^T dt\ \delta u \left(\frac{\partial L}{\partial u} - \frac{\partial f}{\partial u} \left[ \int^t dt \frac{\partial L}{\partial x} \right] \right) \end{align}
Note that the first term can be written, \begin{align} \left[ \int^T dt\ \frac{\partial L}{\partial x} \right] \left[ \int^T dt\ \delta f(u) \right] = \left[ -\lambda \delta x \right]_{(-\infty, T)} \\ \end{align} which is take to be zero. Note that I made a sign error in the question when doing integration by parts for the control theory approach, as such, my boundary terms are equivalent.
Thus, I have shown equivalence to the Control Theory attempt in the question up to a sign error in the boundary terms from them attempt in the question. The problem was that the chain rule was done wrong in the question.