  The alignment between halo spins and the cosmic web is still poorly
understood despite being a widely studied topic. Here, we study this alignment
within the context of tidal torque theory (TTT) and deviations from it. To this
end, we analyze the evolution of the shape and spin direction of proto-haloes,
i.e. of all the volume elements associated to a $z=0$ halo, with respect to the
present-day filaments. We find that the major axis of proto-haloes undergoes a
major change, from being strongly perpendicular to the filament spine in the
initial conditions, to being preferentially aligned at the present time. In
comparison, the spin orientation shows only a mild evolution: it starts
slightly parallel to the filament spine, but the subsequent evolution, up to
$z{\sim}1$, gradually changes its orientation to preferentially perpendicular.
In order to analyze these signals in the TTT framework, we split the haloes
according to their net spin growth with respect to the median TTT expectation,
finding a clear correlation with the spin--filament alignment. At the present
time, haloes whose spin grew the most are the ones most perpendicular to the
filament spine, while haloes whose spin grew below the median TTT expectation
are typically more aligned. The dependence of spin directions on net spin
growth is already present in the initial conditions, and gets further modified
by late-time, $z<2$, evolution. Also, spin directions mildly deviate from the
TTT predictions even at high redshift, indicating the need for extensions to
the model.
