Validate query parameter input.

Check API query parameter values to make sure they make sense, and return 400
if they don't.
Fix Lens unit tests.

With the previous commit, a lens should *always* take a Unix timestamp for any
time-related parameters (previously, the expectations were implicitly and
erroneously different for API query filtering and webhook filtering).
remove commit_account. saving too lines isn't worth having another function
tx logging
query.join(Message) and .options(joinedload(ImapUid.message)) are NOT THE SAME.

In this context, one eats all the memory due to a lack of the right join
conditions. The other properly eagerly loads associated message objects.
Eager load namespaces by default.

This is a teeny tiny amount of data and we pretty much always want it.
Eager loading by default simplifies a lot of other code and reduces the
opportunity for errors caused by using joins incorrectly.
Deduplicate message download on poll too.

Notably, we don't want to re-download messages downloaded via IDLE
polling on Inbox via polling on All Mail.
Don't crash if folder monitors for account change during sync stop.
Never ignore soft deletes in mailsync sessions.

This fixes a potential bug where imapuids deleted in
check_new_g_thrids() will be soft-deleted instead of hard-deleted.
imapuids should never be soft-deleted.
Fix syncmanager_lock deadlock in Gmail sync.

Notably, this manifests when trying to run check_new_g_thrids() during
initial sync. It turns out that the code marked "XXX does this cause a
deadlock?" ...  caused a deadlock.