Not quite ready to merge as written, but it's close. Three small fixes, all doable today, would get it there.

The structure is good. Fetch, write and upload are separate functions, the query is parameterized, the connection is closed in `finally`, and the CSV is written with `newline=""`.

**Fix before merging**

1. **Failures are hidden from cron.** In `run()` (`export_job.py:56-57`), `except Exception` logs the error and then returns normally, so the process exits 0. If the database is down or the upload returns a 500, cron sees a success and nobody is alerted. Finance just doesn't get a file. Re-raise after logging, or call `sys.exit(1)`. The `finally` block will still close the connection.
2. **Customer emails are written to the logs.** `export_job.py:52` logs `[row[1] for row in rows]`, which puts every customer's email address into the log file each night. Log the count only, which the line already does. If you want traceability, log the invoice IDs instead.
3. **The upload has no timeout.** `requests.post(...)` at `export_job.py:42` waits forever by default. If the finance endpoint stalls, the 02:00 job hangs and may overlap the next night's run. Add something like `timeout=30`.

**Worth doing, but not blocking**

- **Tests cover only the happy path.** The docstring says `test_export_job.py` checks the CSV header and one row. Before merge, add a test that `run()` raises when upload fails. That test would have caught item 1. Tests for `fetch_invoices` and `upload` with mocks would round it out.
- **Amounts go through float.** `amount_cents / 100` (line 37) works for typical values, but money is safer as `Decimal(amount_cents) / 100`, formatted to two places. It also assumes every currency has two decimal places, which isn't true for JPY, for example.
- **"Yesterday" depends on timezones.** `date.today()` uses the server's local time. If `paid_at` is stored as `timestamptz` and the database session is in a different zone, the day boundaries can shift. For example, an invoice paid at 23:30 UTC could land in the wrong day's file. Pinning both to UTC would settle it.
- **`UPLOAD_URL` is read at import time.** Importing the module without `FINANCE_UPLOAD_URL` set raises `KeyError`, which makes tests more awkward. Reading it inside `upload()` or `run()` avoids that.

Items 1–3 are each a line or two, so this is realistically an hour of work including the failure-path test.

VERDICT: READY WITH CHANGES
