In quantizing compact $2+1D$ $U(1)$ Chern-Simons theory (or Maxwell theory, for that matter) on the $L_x \times L_y$ torus in $A_0=0$ gauge, one starts with a mode decomposition for the vector potential. In every reference I have found, the decomposition is declared gauge-equivalent to (with all physical constants set to 1)

$$A_i = a_i - \epsilon^{ij}x_j B/2 + \tilde{A}_i$$

where $i=x,y$, $\epsilon^{ij}$ is the Levi-Civita symbol, $\tilde{A}_i$ is strictly periodic, $a_i$ is a constant, and $B$ is the mean magnetic field through the torus (quantized according to the Dirac condition). What, precisely, are the boundary conditions on $A$ that lead to such a form, or should there be a more general form?

Clearly one must allow $A_i$ not to be strictly periodic in order to account for the second term. What seems most reasonable is to require $A_i$ be periodic up to a gauge transformation, i.e.

$$A_i(x+L_x,y) = A_i(x,y) + \partial_i \alpha_x(x,y)$$

where $\alpha_x(x,y)$ can be either a large or small gauge transformation, and likewise for shifts in the $y$ direction. The aforementioned decomposition does obey such boundary conditions. But a configuration like $A_x=0$, $A_y \propto x \sin(2\pi y/L_y)$ also obeys these boundary conditions (with $\alpha_x \propto \cos(2\pi y/L_y)$) and does not seem to be gauge-equivalent to anything of the aforementioned form. So is this an unacceptable configuration? If so, why?

It's true that such a configuration has a spatially varying magnetic field, which violates the constraint of pure Chern-Simons theory, but I still want to understand as a matter of principle how I should be writing $A$ *before* imposing the constraint.

Thanks!