  In recent work, Jamneshan, Shalom and Tao proved an inverse theorem for the
Gowers $U^{k+1}$-norm on finite abelian groups of fixed torsion $m$, where the
final correlating harmonic is a polynomial phase function of degree at most
$C(k,m)$. They also posed a related central question, namely, whether the bound
$C$ can be reduced to the optimal value $k$ for every $m$. We make progress on
this question using nilspace theory. First we connect the question to the study
of finite nilspaces whose structure groups have torsion $m$. Then we prove one
of the main results of this paper: a primary decomposition theorem for finite
nilspaces, extending the Sylow decomposition in group theory. Thus we give an
analogue for nilspaces of an ergodic-theoretic Sylow decomposition in the
aforementioned work of Jamneshan-Shalom-Tao. We deduce various consequences
which illustrate the following general idea: the primary decomposition enables
a reduction of higher-order Fourier analysis in the $m$-torsion setting to the
case of abelian $p$-groups. These consequences include a positive answer to the
question of Jamneshan-Shalom-Tao when $m$ is squarefree, and also a new
relation between uniformity norms and certain generalized cut norms on products
of abelian groups of coprime orders. Another main result in this paper is a
positive answer to the above central question for the $U^3$-norm, proving that
$C(2,m)=2$ for all $m$. Finally, we give a partial answer to the question for
all $k$ and $m$, proving an inverse theorem involving extensions of polynomial
phase functions which were introduced by the third-named author, known as
projected phase polynomials of degree $k$. A notable aspect is that this
inverse theorem implies that of Jamneshan-Shalom-Tao, while involving projected
phase polynomials of degree $k$, which are genuine obstructions to having small
$U^{k+1}$-norm.
