In the book Statistical Physics of Particles by M. Kardar, the author shows the connection between the microcanonical ensemble and thermodynamics deriving the zeroth, 1st and 2nd laws. In the paragraph right before eq. $(4.7)$ it is stated the following:
The first law: we next inquire about the variations of $S(E,\mathbf{x})$ with $\mathbf{x}$, by changing the coordinates reversibly by $\delta\mathbf{x}$. This results in doing work on the system by an amount $ \delta W = J \cdot \delta \mathbf{x}$, which changes the internal energy to $E +\mathbf{J}\cdot \delta \mathbf{x}$ The first-order change in entropy is given by $$\delta S(E, \mathbf{x}) = S(E +J\cdot \delta \mathbf{x}, \mathbf{x}+ \delta \mathbf{x}) - S(E, \mathbf{x}) = \left(\frac{\partial S}{\partial E} \mathbf{J} + \frac{\partial S}{\partial \mathbf{x}} \right)\delta \mathbf{x} \tag {4.8}$$ This change will occur spontaneously, taking the system into a more probable state, unless the quantity in brackets is zero. Using Eq. $(4.7)$ ($\partial S/ \partial E = 1/T$), this allows us to identify the derivatives $$\frac{\partial S}{\partial x_i} |_{E, x_{j\ne i}} = - \frac{J_i}{T}.\tag{4.9}$$ Having thus identified all variations of $S$, we have $$d S(E, \mathbf{x})= \frac{dE}{T} - \frac{\mathbf{J} \cdot d \mathbf{x}}{T} \implies dE = TdS + \mathbf{J} \cdot d \mathbf{x} $$ allowing us to identify the heat input $\delta Q = TdS$.
What I don't understand is that if the author derived equation $(4.9)$ from the assumption that there's no heat (isolated system) and that the change $\delta \mathbf{x}$ is reversible, how can he just substitute this equation in the differential of entropy for a generic case (which allows flow of heat)?