This is a reference request for a relationship in quantum field theory between the electromagnetic potential and the electromagnetic field when they are presented in test function form. $U(1)$ gauge invariance becomes a particularly simple constraint on test functions for smeared electromagnetic potential operators to be gauge invariant observables. This is such a simple constraint that I think it must be out there, but I have never seen this in text books or in the literature, presumably because we mostly do not work with test function spaces in QFT; instead we use operator-valued distributions directly, where, however, gauge fixing is a perpetual nuisance.

For the electromagnetic potential operator-valued distribution smeared by a test function $f^\rho(x)$ on Minkowski space, $\hat A_f=\int_M \hat A_\rho(x)f^{\rho*}(x)\mathrm{d}^4x$, to be an observable that is invariant under $U(1)$ gauge transformations $\hat A_\rho(x)\rightarrow\hat A_\rho(x)-\partial_\rho\alpha(x)$, we require that $\int_M \partial_\rho\alpha(x)f^{\rho*}(x)\mathrm{d}^4x$ must be zero for all scalar functions $\alpha(x)$.

Integrating by parts over a region $\Omega$ in Minkowski space, we obtain, in terms of differential forms,
$$\int_\Omega d\alpha\wedge(\star f^*)=\int_{\partial\Omega}\alpha\wedge(\star f^*)-\int_\Omega \alpha\wedge(d\!\star\! f^*),$$
which will be zero for large enough $\Omega$, and hence for the whole of Minkowski space, for any smooth test function $f^\rho(x)$ that has compact support and is divergence-free, $d\!\star\! f=0$.
[If we constrain the gauge transformation function $\alpha(x)$ not to increase faster than polynomially with increasing distance in any direction, it will be enough for the test function $f^\rho(x)$ to be Schwartz and divergence-free.]

So we have proved:

**Theorem:** The smeared electromagnetic potential $\hat A_f$ is a $U(1)$ gauge invariant observable if the test function $f^\rho(x)$ is smooth, of compact support, and divergence-free.

The divergence-free condition on $f^\rho(x)$ ensures that the commutator for creation and annihilation operators associated with the electromagnetic potential
$\hat A_f=\mathbf{\scriptstyle a}^{\,}_{f^*}+\mathbf{\scriptstyle a}^{\dagger}_f$ ,
$$[\mathbf{\scriptstyle a}^{\,}_f,\mathbf{\scriptstyle a}^\dagger_g]=-\hbar\int \tilde f^*_\rho(k)\tilde g^\rho(k)2\pi\delta(k_\nu k^\nu)\theta(k_0)\frac{\mathrm{d}^4k}{(2\pi)^4},$$
is positive semi-definite (which is necessary for us to be able to construct a vacuum sector Hilbert space), and that because $\delta f=\delta g=0$ we can construct, on Minkowski space, $f=\delta F$, $g=\delta G$, where $F$ and $G$ are bivector potentials for the electromagnetic potential test functions $f$ and $g$.

In terms of $F$ and $G$, we can write $a^{\,}_F=\mathbf{\scriptstyle a}^{\,}_{\delta F}$ , $a_G^\dagger=\mathbf{\scriptstyle a}^\dagger_{\delta G}$ , which satisfy the electromagnetic *field* commutator
$$[a^{\,}_F,a_G^\dagger]=-\hbar\int k^\alpha\tilde F_{\alpha\mu}^*(k) k^\beta\tilde G_\beta{}^\mu(k)2\pi\delta(k_\nu k^\nu)\theta(k_0)\frac{\mathrm{d}^4k}{(2\pi)^4}.$$
Consequently, turning around the usual relationship because we are working with test functions instead of directly with quantum fields, we can regard test functions for the electromagnetic field as potentials for test functions for the electromagnetic potential.

Because of the restriction that electromagnetic potential test functions must have compact support (or that gauge transformations must be constrained if electromagnetic potential test functions are taken to be Schwartz), electromagnetic potential observables are less general than electromagnetic field observables if electromagnetic field test functions are taken to be Schwartz (as is most commonly assumed), or equivalent if electromagnetic field test functions are taken to be smooth and to have compact support.

So, references?

EDIT (October 24th 2011): Noting the Answer from user388027, and my comment, a decent reference for what constraints are conventionally imposed on gauge transformations would be welcome. I would particularly hope for a rationale for the constraints from whatever theoretical standpoint is taken by the reference.

This post has been migrated from (A51.SE)