Not ready to merge as written, but the required fixes are small enough to do before tomorrow. I reviewed `export_job.py` by reading it only; nothing was run, and `test_export_job.py` is not in the folder, so I could not check the tests.

## Must fix before merge

1. **A failed export looks like a successful one.** `run()` catches every exception, logs one line and exits with code 0 (`export_job.py:56-57`). For example, if the finance endpoint returns 503, cron records success, finance gets no file, and the stack trace is lost. Use `log.exception` and re-raise (or `sys.exit(1)`) so the failure is visible.

2. **Customer emails are written to the log every night.** Line 52 logs the full list of `customer_email` values for every exported invoice. That puts personal data into log storage. Log the count and the day only.

3. **The upload can hang forever.** `requests.post` at line 42 has no timeout. If the finance endpoint accepts the connection and never responds, the job never ends and holds its database connection open. Add `timeout=(10, 120)` or similar.

4. **A missed day cannot be re-exported.** The day is hard-coded to "yesterday" (line 47), and there is no retry. If Tuesday's 02:00 run fails, Wednesday's run exports only Tuesday's invoices and Monday's are never sent. Accept an optional date argument so a failed day can be re-run.

5. **Tests cover only the CSV writer.** By the docstring, they check the header and one row. The query's date window, the upload and the failure path are untested. At minimum, add tests for:
   - the date boundaries passed to the query;
   - an upload returning a non-2xx status making the job fail;
   - amount formatting.

## Confirm before merge

- **Which timezone "yesterday" means.** `date.today()` uses the server's local time, while the comparison against `paid_at` uses the database session's timezone if the column is `timestamptz`. If those differ, invoices near midnight are skipped or exported twice. For example, with the server on UTC and the database on IST, an invoice paid at 00:30 IST lands in the wrong day's file. Pick one timezone and build the boundaries explicitly.
- **Amount formatting.** `amount_cents / 100` (line 37) writes 1000 cents as `10.0` and 10 cents as `0.1`. If finance expects `10.00`, format with `Decimal` to two places. It is also wrong for currencies with no minor unit, such as JPY, if any appear in `currency`.

## Can follow after merge

- `UPLOAD_URL` is read at import time (line 16), so importing the module in a test without that variable set raises `KeyError`. Read it inside `upload()` or pass it in.
- No logging configuration is set up, so the `log.info` lines are dropped when the script runs from cron; only the error line reaches stderr.
- The CSV, which contains customer emails, stays in `/var/exports` indefinitely with default permissions. Delete it after a successful upload or set a retention rule.
- `psycopg2.connect` sits outside the `try` (line 49), so a connection failure behaves differently from every other failure. This resolves itself once item 1 is fixed.

VERDICT: READY WITH CHANGES
