  Given a K\"ahler manifold $X$ with an ample line bundle $L$, we consider the
metric space of $L^1$ geodesic rays associated to the first Chern class
$c_1(L)$. We characterize rays that can be approximated by ample test
configurations. At the same time, we also characterize the closure of algebraic
singularity types among all singularity types of quasi-plurisubharmonic
functions, pointing out the very close relationship between these two seemingly
unrelated problems. By Bonavero's holomorphic Morse inequalities, the
arithmetic and non-pluripolar volumes of algebraic singularity types coincide.
We show that in general the arithmetic volume dominates the non-pluripolar one,
and equality holds exactly on the closure of algebraic singularity types.
Analogously, we give an estimate for the Monge--Amp\`ere energy of a general
$L^1$ ray in terms of the arithmetic volumes along its Legendre transform.
Equality holds exactly for rays approximable by test configurations. Various
other cohomological and potential theoretic characterizations are given in both
settings. As applications, we give a concrete formula for the non-Archimedean
Monge--Amp\`ere energy in terms of asymptotic expansion, and show the
continuity of the projection map from $L^1$ rays to non-Archimedean rays. We
also show that the closure of ample test configurations and filtrations gives
the same set of rays.
