I have a few questions about differentiating the on-shell action.
Here is what I currently understand (or think I do!):
Given that a system with Lagrangian $\mathcal{L}(\mathbf{q}, \dot{\mathbf{q}}, t)$ has the coordinate $\mathbf{q}_1$ at time $t_1$, and the coordinate $\mathbf{q}_2$ at time $t_2$, there exists a unique 'extremal path' $\gamma(t_1, \mathbf{q}_1, t_2, \mathbf{q}_2; t)$ which makes the action functional $$ \mathcal{S}[\mathbf{q}(t)] = \int_{t_1}^{t_2} \mathcal{L}(\mathbf{q}, \dot{\mathbf{q}}, t)\text{d}t $$ stationary. In other words, $\gamma$ satisfies the Euler-Lagrange equations, $$ \left.\left(\frac{\partial \mathcal{L}}{\partial q} -\frac{\text{d}}{\text{d}t}\frac{\partial \mathcal{L}}{\partial \dot{q}} \right)\right|_{q(t) = \gamma(t)} = \mathbf{0}, $$ and has $\gamma(t_1, \mathbf{q}_1, t_2, \mathbf{q}_2; t_1) = \mathbf{q}_1$ and $\gamma(t_1, \mathbf{q}_1, t_2, \mathbf{q}_2; t_2) = \mathbf{q}_2$.
Moreover, the existence of this function allows the velocity, momentum etc. to be defined at the endpoints, e.g. the momentum at $(t_2, \mathbf{q}_2)$ is $$ \mathbf{p}_2 = \left.\frac{\partial \mathcal{L}}{\partial \dot{\gamma}(t)}\right|_{t=t_2}, $$ where $\dot{\gamma} \equiv \partial \gamma(t_2, \mathbf{q}_2; t) /\partial t$.
Ignoring $t_1$ and $\mathbf{q}_2$ for simplicity, this allows the on-shell action (see here) to be defined as $$ s(t_2, \mathbf{q}_2) = \int_{t_1}^{t_2} \mathcal{L}(\gamma(t_2, \mathbf{q}_2; t), \dot{\gamma}(t_2, \mathbf{q}_2; t), t)\, \text{d} t. \tag{1} $$ Importantly, $s$ is a function of $t_2$, $\mathbf{q}_2$, and not a functional. It can therefore be differentiated as any other function.
It is shown in Landau that
$$ \frac{\partial s}{\partial t_2} = -\mathcal{H}_2, \quad \frac{\partial s}{\partial \mathbf{q}_2} = \mathbf{p}_2, \tag{2} $$
but I don't follow the argument given.
I would like to derive the equations (2) by directly differentiating (1). I have read several answers which derive this in a different way (here, here and here), but I still have some questions. Firstly, here is my attempt at differentiating with respect to $\mathbf{q}_2$.
\begin{align} \frac{\partial s}{\partial \mathbf{q}_2} &= \frac{\partial}{\partial \mathbf{q}_2} \int_{t_1}^{t_2} \mathcal{L}(\gamma(t_2, \mathbf{q}_2; t), \dot{\gamma}(t_2, \mathbf{q}_2; t), t)\, \text{d} t \\ &= \int_{t_1}^{t_2} \frac{\partial}{\partial \mathbf{q}_2} \mathcal{L}(\gamma(t_2, \mathbf{q}_2; t), \dot{\gamma}(t_2, \mathbf{q}_2; t), t)\, \text{d} t\\ &= \int_{t_1}^{t_2} \frac{\partial \mathcal{L}}{\partial \gamma}\cdot\frac{\partial \gamma}{\partial \mathbf{q}_2} +\frac{\partial \mathcal{L}}{\partial \dot{\gamma}}\cdot\frac{\partial \dot{\gamma}}{\partial \mathbf{q}_2} \text{d}t. \end{align} Now, $$ \frac{\partial \dot{\gamma}}{\partial \mathbf{q}_2} =\frac{\partial}{\partial \mathbf{q}_2} \frac{\text{d}\gamma}{\text{d} t} = \frac{\text{d}}{\text{d} t} \frac{\partial \gamma}{\partial \mathbf{q}_2}, $$ so we can integrate by parts to yield \begin{align} \frac{\partial s}{\partial \mathbf{q}_2} &= \left[ \frac{\partial \mathcal{L}}{\partial \dot{\gamma}} \cdot \frac{\partial \gamma}{\partial \mathbf{q}_2}\right]_{t_1}^{t_2} + \int_{t_1}^{t_2} \underbrace{\left(\frac{\partial \mathcal{L}}{\partial \gamma} - \frac{\text{d}}{\text{d} t} \frac{\partial \mathcal{L}}{\partial \dot{\gamma}}\right)}_{\mathbf{0}}\cdot\frac{\partial \gamma}{\partial \mathbf{q}_2} \text{d} t\\ &=\mathbf{p}_2\cdot\frac{\partial \gamma}{\partial \mathbf{q}_2}(t_2). \end{align} For (2) to be true, we ought to have $\frac{\partial \gamma}{\partial \mathbf{q}_2}(t_2) = \mathbf{I}$. Is it valid interchange the order of evaluation and differentiation to write $$ \left.\frac{\partial \gamma(t_2, \mathbf{q}_2; t)}{\partial \mathbf{q}_2}\right|_{t=t_2} = \frac{\partial \gamma(t_2, \mathbf{q}_2; t_2)}{\partial \mathbf{q}_2} = \frac{\partial \mathbf{q}_2}{\partial \mathbf{q}_2} =\mathbf{I}?\tag{3} $$ If so, why? If not, then how else is it possible to arrive at equation (2) from here?
Secondly, here is my attempt at differentiating with respect to $t_2$. \begin{align} \frac{\partial s}{\partial t_2} &= \frac{\partial}{\partial t_2} \int_{t_1}^{t_2} \mathcal{L}(\gamma(t_2, \mathbf{q}_2; t), \dot{\gamma}(t_2, \mathbf{q}_2; t), t)\, \text{d} t \\ &= \mathcal{L}_2 + \int_{t_1}^{t_2} \frac{\partial}{\partial t_2} \mathcal{L}(\gamma(t_2, \mathbf{q}_2; t), \dot{\gamma}(t_2, \mathbf{q}_2; t), t)\, \text{d} t\\ &=\mathcal{L}_2 + \int_{t_1}^{t_2} \frac{\partial \mathcal{L}}{\partial \gamma}\cdot\frac{\partial \gamma}{\partial t_2} +\frac{\partial \mathcal{L}}{\partial \dot{\gamma}}\cdot\frac{\partial \dot{\gamma}}{\partial t_2} \text{d}t\\ &= \mathcal{L}_2 +\left[ \frac{\partial \mathcal{L}}{\partial \dot{\gamma}} \cdot \frac{\partial \gamma}{\partial t_2}\right]_{t_1}^{t_2} + \int_{t_1}^{t_2} \underbrace{\left(\frac{\partial \mathcal{L}}{\partial \gamma} - \frac{\text{d}}{\text{d} t} \frac{\partial \mathcal{L}}{\partial \dot{\gamma}}\right)}_{\mathbf{0}}\cdot\frac{\partial \gamma}{\partial t_2} \text{d} t\\ &=\mathcal{L}_2 + \mathbf{p}_2\cdot\frac{\partial \gamma}{\partial t_2}(t_2) \end{align} To get from the first to the second line I used Leibniz' rule for differentiating integrals. For equation (2) to be true, we ought to have $$ \frac{\partial \gamma}{\partial t_2}(t_2) = -\dot{\mathbf{q}}_2.\tag{4} $$ Is this correct? If so, how can it be shown?
I would be very grateful for any help anyone is able to give!