Also index message.received_date.
Log exception type when mail sync dies.
Directly filter messages by namespace_id for API queries.

Summary:
Now that messages have a namespace_id, we don't need to do the wonky
joining-to-threads thing. This makes the /messages endpoint two to three times
faster on large mailboxes.

Test Plan: Unit tests.

Reviewers: khamidou

Reviewed By: khamidou

Differential Revision: https://review.inboxapp.com/D539
[sentry] Whitelist stack locals

Summary: Stack locals contain valuable debugging information. Keep some of them which are not PII (so far, only `account_id`).

Test Plan: Triggered an exception, tested that locals got stripped.

Reviewers: dlitz, emfree

Reviewed By: emfree

Projects: #sync-engine

Differential Revision: https://review.inboxapp.com/D546
Validate recipients before sending a draft.

Summary:
We shouldn't let people try to send drafts when the recipients are patently
invalid. So check them before sending.

Test Plan: Unit test added.

Reviewers: khamidou

Reviewed By: khamidou

Differential Revision: https://review.inboxapp.com/D544
Migration to drop easaccount.eas_state column.
setup.py: pep8
Providers: Also configuring the port for IMAP; Use consistent syntax.

Test Plan:
Ran the unit tests, changed the port number, and tried it out.  It seems to
have worked.

Reviewers: emfree

Reviewed By: emfree

Differential Revision: https://review.inboxapp.com/D548
Basic test case for labels

Summary:
Emfree,

I've got a basic system test for labels. The idea is to use a crispin client to modify the IMAP backend and check that mailsync picks up the changes. So far, I haven't been able to find a bug but I'm sure I'll find something ;)

Test Plan: Yo dawg I herd you liked tests so I put a test in your test

Reviewers: emfree

Reviewed By: emfree

Projects: #sync-engine

Differential Revision: https://review.inboxapp.com/D541
Fix uidvalidity_cb in inbox.console.
Log account_id, provider_name in commit_uids() for more
dashboard graphs.
Don't log account_id again.
Remove unneeded account_id arg.
Provider plugins via setuptools entry_points

Test Plan:
Ran the unit tests, added a couple of tests, and played with it on
my Vagrant VM.  It seems to work.

Reviewers: emfree

Reviewed By: emfree

Differential Revision: https://review.inboxapp.com/D549
Add tests/data/* to .agignore

Summary:
Removes some noise from the results when grepping the source code with
'ag'.

References:

- The Silver Searcher (ag)
    http://geoff.greer.fm/ag/

- Vim plugin for the_silver_searcher, 'ag'
    https://github.com/rking/ag.vim

Test Plan: None

Reviewers: emfree

Reviewed By: emfree

Differential Revision: https://review.inboxapp.com/D551
Handle excessively many message recipients.

Summary:
We do this by emptying out the offending field and logging it as a decode error
for now.

Test Plan: Regression test added.

Reviewers: kav-ya

Differential Revision: https://review.inboxapp.com/D552
first pass at dockerization
complete (though probably not correct) redwood config for fig.yml, move inbox-eas stuff out to child dockerfile
introduce leading tabs in line-break-escaped apt list so quay stops complaing
group run commands to save image layers