I wouldn't merge `export_job.py` tomorrow as it stands. The fixes are small and could fit in a day, but two problems matter now. If the job fails, nobody finds out. And it writes every customer's email address to the logs each night. The module docstring also says the job is tested by `test_export_job.py`, but that file isn't in the directory, so none of this code has tests.

## Must fix before merge

**1. Failures are silent (High).** `export_job.py:56-57` catches every exception, logs one line and returns normally, so the process exits with code 0. For example, if the finance endpoint returns a 500, `raise_for_status()` raises, the error is caught, and cron records a successful run. Finance gets no file and no alert fires. The log line has no traceback either. Fix: use `log.exception(...)`, then re-raise or `sys.exit(1)`.

**2. Customer emails go into the logs (High).** `export_job.py:52` logs `[row[1] for row in rows]`, which is every customer's email address, at INFO level every night. Logs usually have wider access and longer retention than the database, so this is a privacy and compliance risk. Fix: log only the count.

**3. There are no tests (High).** The docstring at line 3 says a test file covers the CSV header and one row, but `test_export_job.py` doesn't exist. Even if it did, one header-and-row test wouldn't cover the failure path in #1, the amount formatting in #4, or the date window in #6.

## Should fix (can be quick follow-ups if time is tight, but log them)

**4. Amounts come out wrong for some currencies (Medium).** Line 37 always divides by 100. A 500 JPY invoice is exported as `5.0`, but yen has no minor unit, so it should be `500`. Currencies with three decimal places (BHD, KWD) are off by 10×. Even for USD, the output is a float (`10.0` rather than `10.00`). Fix: use `Decimal` and a per-currency exponent, or export `amount_cents` unchanged and let finance convert.

**5. The upload has no timeout (Medium).** `requests.post` at line 42 sets no timeout. If the endpoint hangs, the job hangs with it, possibly until the next night's run starts. Fix: add `timeout=(5, 60)` or similar.

**6. You can't re-run a missed day (Medium).** Line 47 always exports yesterday. Combined with #1, if a night fails silently, the only way to recover that day is to edit the code. Fix: accept an optional date argument.

**7. The "yesterday" window may not line up with the database (Medium; please check).** `date.today()` uses the server's local timezone. If `paid_at` is `timestamptz`, Postgres converts the date bounds to timestamps using the DB session's timezone, which may differ. If they differ, invoices paid near midnight can be dropped or exported on two nights. Please confirm which timezone finance means by "yesterday" and pass explicit timestamps with timezones.

## Minor

- **Line 16:** reading `FINANCE_UPLOAD_URL` when the module loads means importing the file without that variable set fails with `KeyError`, which makes tests awkward. Read it inside `run()` instead.
- **Line 48:** CSVs with customer emails stay in `/var/exports` indefinitely. Delete them after a successful upload, or agree a retention period.

The code itself reads cleanly and is well split into small functions, so this is mostly about error handling and tests rather than restructuring. I can make fixes 1–6, with tests written first (including the failure-path and currency cases), if you'd like.

VERDICT: NOT READY
