Calculus with indefinite integral Any other solutions(advice) are welcome

 A: First of all, there is a mistake in the computation from the second to the third line. The correct answer therefore should be $\sec(x) + \tan(x) - x$.
Usually in these exercises, it is generally understood that the antiderivative (or the derivative for that matter) is only to be taken where it makes sense. However, you have a point here in the sense that the solution $\sec(x) + \tan(x) - x$ is incomplete. In fact, the antiderivative of $\frac{\sin(x)}{1-\sin(x)}$ is perfectly well defined in $\sin(x) = -1$. Therefore a complete solution would be $$\begin{cases} \sec(x) + \tan(x) - x & \text{for } \sin(x) \notin\{\pm 1\} \\ \frac{\pi}{2} & \text{for } \sin(x) = -1\end{cases}$$
and of course undefined for $\sin(x) = 1$. The case $\sin(x) = -1$ is just an artefact of the computation method.
A: When you dual with indefinite integral, you always assume implicitly that the function is on a valid interval. For example, in this question, you may assume the function is on $(\frac{-3\pi}{2},\frac{\pi}{2})$.
Your arguments about the condition $Sin(x)\neq-1$ is correct, the final result obviously does not hold for $Sin(x)=-1$. You can get the complete solution as in Klaus answer. Here I give another solution which can avoid this situation:
\begin{align}
\int \frac{\sin(x)}{1-\sin(x)}dx
&=\int (-1+\frac{1}{1-\sin(x)})dx \\
&=-x+\int \frac{1}{1-2 \sin(\frac{x}{2})\cos(\frac{x}{2})}dx \\
&=-x+\int \frac{1}{(\sin(\frac{x}{2})-\cos(\frac{x}{2}))^2}dx \\
&=-x+\int \frac{1}{2 \sin^2(\frac{x}{2}-\frac{\pi}{4})}dx \\
&=-x- \cot(\frac{x}{2}-\frac{\pi}{4})+C
\end{align}
Auxiliary angle formula $a\sin(x)+b\cos(x)=\sin(x+\arctan(\frac{b}{a}))$ has been used in second last line
