The structure is good, and two small fixes would make it safe to merge tomorrow. The code is easy to read, the query is parameterized, and the connection and file handles are closed properly. `fetch_invoices`, `write_csv` and `upload` are separate functions with a single job each.

**Fix before merging (both are quick):**

1. **Failures are hidden from cron.** `run()` catches every exception and only logs it (`export_job.py:56-57`). If the database is down or the upload returns a 500, the job still exits 0. Finance would simply never get the file, and nothing would alert anyone. Re-raise after logging (`log.exception(...)` then `raise`), or call `sys.exit(1)`. Cron mail or your monitoring will then see the failure.

2. **Customer emails go into the logs.** Line 52 logs `[row[1] for row in rows]`, which is the full list of customer emails, every night. That is personal data sitting in log storage. The count and the date are enough: `"exporting %d invoices for %s"`.

**Worth doing now, since they are small:**

- **Add a timeout to the upload.** `requests.post` has no timeout (line 42), so a stalled endpoint could hang the 02:00 job forever. `timeout=30` fixes it.
- **Use exact money values.** `amount_cents / 100` produces floats, and finance may see values like `19.9` instead of `19.90`. Use `Decimal(amount_cents) / 100`, or write `f"{amount_cents // 100}.{amount_cents % 100:02d}"`.
- **Check the day boundary.** `datetime.date.today()` uses the server's timezone, and `paid_at` is compared against a plain date. If `paid_at` is stored in UTC and the server isn't, "yesterday" will be off by hours. Confirm they match, or make the timezone explicit.

**Tests:** the docstring says the tests cover the CSV header and one row. That is a good start for `write_csv`. Before merging, I'd add a few cheap tests for the cases above:
- an upload that returns an error status and makes `run()` fail;
- a day with zero invoices;
- an amount like 1990 cents writing as `19.90`.

Once the logging and error-handling fixes are in, this is in good shape.

VERDICT: READY WITH CHANGES
