  We revisit the low-energy effective $U(1)$ action of topologically twisted
$\mathcal N=2$ SYM theory with gauge group of rank one on a generic oriented
smooth 4-manifold $X$ with nontrivial fundamental group. After including a
specific new set of $\mathcal Q$-exact operators to the known action, we
express the integrand of the path integral of the low-energy $U(1)$ theory as
an anti-holomorphic derivative. This allows us to use the theory of mock
modular forms and indefinite theta functions for the explicit evaluation of
correlation functions of the theory, including but not restricted to those that
physically reproduce Donaldson invariants, thus facilitating the computations
compared to previously used methods. As an explicit check of our results, we
compute the path integral for the product ruled surfaces $X=\Sigma_g \times
\mathbb{CP}^1$ for the reduction on either factor and compare the results with
existing literature. In the case of reduction on the Riemann surface
$\Sigma_g$, via an equivalent topological A-model on $\mathbb{CP}^1$, we will
be able to express the generating function of genus zero Gromov-Witten
invariants of the moduli space of flat rank one connections over $\Sigma_g$ in
terms of an indefinite theta function, whence we would be able to make concrete
numerical predictions of these enumerative invariants in terms of modular data,
thereby allowing us to derive results in enumerative geometry from number
theory.
