A relatively well-known finance book called Fixed Income Securities by Bruce Tuckman and Angel Serrat, features the following argument. Let the price of a security at time $t$, under a (random) factor value $x$ be given by $P_t(x)$. For context, $x$ refers to a random interest rate process, here assumed to be Bernoulli at each stage. Quoting from the book (excising an irrelevant detail about OAS for the sake of this question):
By the definition of a one-factor model […], the market price of a security at time $t$ and a factor value of $x$ can be written as $P_t(x)$. Using a first-order Taylor approximation, the change in the price of the security is $$dP = \frac{\partial P}{\partial x}dx + \frac{\partial P}{\partial t}dt.$$Dividing by the price and taking expectations, $$\mathbb E\left[\frac{dP}{P}\right] = \frac1P\frac{\partial P}{\partial x}\mathbb E\left[dx\right] + \frac1P\frac{\partial P}{\partial t} dt.$$
I want to give this book the benefit of the doubt because it is highly regarded in the finance community, but this last line seems absurd to be:
1) The expectation is just passing through $\frac1P$, even though $\frac1P$ is itself a random variable, depending on the deterministic factor $t$ and the random factor $x$.
2) The expectation is also just passing through $\frac{\partial P}{\partial x}$ and $\frac{\partial P}{\partial t}$, which are generally NOT constant in the setting of the book.
Am I missing something?
This is an imprecise statement about the approximate expected return of a security price $P(t,x)$ that is a function of time $t$ and a random factor $x$. The authors either assume the reader has a background in stochastic calculus and can fill in the details or is willing to accept an intuitive argument.
More rigorously, suppose, for example, the factor follows a stochastic process governed by the SDE $dx_t = \mu \, dt + \sigma \, dW_t$ where $W_t$ is a Wiener process. The process for $P$ can be derived using Ito's lemma,
$$dP = \frac{\partial P}{\partial t} \, dt + \frac{\partial P}{\partial x} dx_t + \frac{1}{2}\frac{\partial^2 P}{\partial x^2}dx_t^2 + \ldots,$$
Since $dW_t^2 = \mathcal{O}(dt),$ this leads to
$$\frac{dP}{P} = \frac{1}{P}\left(\frac{\partial P}{\partial t} + \mu\frac{\partial P}{\partial x} + \frac{\sigma^2}{2}\frac{\partial^2 P}{\partial x^2}\right) dt + \frac{1}{P} \frac{\partial P}{\partial x} dW_t $$
and the "expected return" or drift is
$$\mathbb{E}\left[ \frac{dP}{P}\right]= \frac{1}{P}\left(\frac{\partial P}{\partial t} + \mu\frac{\partial P}{\partial x} + \frac{\sigma^2}{2}\frac{\partial^2 P}{\partial x^2}\right) dt $$
In writing,
$$\mathbb{E}\left[ \frac{dP}{P}\right]= \frac1P\frac{\partial P}{\partial x}\mathbb E\left[dx\right] + \frac1P\frac{\partial P}{\partial t} dt$$
the authors are neglecting the contribution from the second-order partial derivative since $\mathbb{E}[dx_t] = \mu dt$.