The compass is swung with electrics on
The DI gyro is aligned with the North and South indications, it also has a certain ammount of freedom in that plane(whether its pitch on a north/south heading, roll on east/west or either one on any other heading. Gyro wont be affected by normal climb/descent attitudes, It has an Erection mechanism.
Compass errors (apart from liquid swirl) are a result of dip(Z) so in a climb/descent the needle may be more/less dipped (until it reaches the stops)
Unless I have misuderstood something, provided we are not turning or accelerating, or in a vertical climb/descent when the compas is no longer swinging freely, we can expect a sensible compass indication.