`export_job.py` is not ready to merge tomorrow as it stands: a failed export looks like a successful one, and nothing re-sends the missed day. The fixes for the four blockers are small, about half a day including tests.

I reviewed by reading the file only; nothing was run. The docstring names `test_export_job.py`, but that file is not next to `export_job.py`, so I could not confirm any tests exist.

## Blockers (fix before merge)

1. **Failures are swallowed — High.** `run()` catches every exception, logs one line and exits with code 0 (`export_job.py:56-57`).
   - Example: the finance endpoint returns 503 at 02:00. Cron records success and finance has no file, where the job should exit non-zero and alert.
   - Fix: log with `log.exception` and re-raise, or `sys.exit(1)`.

2. **A missed day cannot be re-sent — High.** The date is hard-coded to yesterday (`export_job.py:47`).
   - Example: if the 14 Nov run fails, the 15 Nov run exports only 14 Nov's invoices, and 13 Nov's are never sent.
   - Fix: accept an optional `--date` argument so a day can be re-run.

3. **The upload has no timeout — High.** `requests.post` at `export_job.py:42` waits forever if the endpoint stalls, holding the database connection open and never reaching the error path.
   - Fix: add `timeout=(10, 120)` or similar.

4. **Customer emails are written to the log — High (privacy).** `export_job.py:52` logs every customer's email address in one line.
   - Fix: log the count only.

## Should fix (can follow within the sprint if you name the debt)

5. **Logging is never configured — Medium.** Run from cron, the `log.info` lines go nowhere and only the error line reaches stderr, with no traceback. Add `logging.basicConfig` under `__main__`.

6. **"Yesterday" depends on two clocks — Medium.** The date comes from the cron host's local time, but the query boundaries are interpreted in the database session's time zone.
   - Example: with the host on US Pacific and the database on UTC, an invoice paid at 17:00 Pacific on 13 Nov lands in the 14 Nov file.
   - Nothing is lost, but finance's daily totals will not match their day. Pick one time zone and build explicit timestamps in it.

7. **Amounts are formatted inconsistently and assume two decimals — Medium.** `amount_cents / 100` (`export_job.py:37`) uses floating-point division.
   - Example: 1050 is written as `10.5` and 1000 as `10.0`, where finance would expect `10.50` and `10.00`.
   - If any invoice is in a currency without cents, such as JPY, 500 yen would export as `5.0`.
   - Fix: format with `Decimal`, and confirm which currencies occur.

8. **Test coverage is thin — Medium.** By the docstring, tests cover the CSV header and one row. Nothing covers the date window, an upload failure, the exit code, or zero invoices.

## Minor

9. **Formula injection in the CSV — Low.** An email starting with `=`, `+`, `-` or `@` is run as a formula if finance opens the file in Excel. Prefix such cells with `'`.
10. **Export files accumulate — Low.** Files with customer emails stay in `/var/exports` forever with default permissions, and a failed write leaves a partial file. Add cleanup or retention.
11. **Inconsistent configuration loading — Low.** `FINANCE_UPLOAD_URL` is read at import (`export_job.py:16`), so importing the module in a test without it raises `KeyError`, while `DATABASE_URL` is read at run time. Read both inside `run()`.
12. **A re-run uploads a duplicate — Low.** Whether that matters depends on whether the finance endpoint de-duplicates by file name; worth asking them.
13. **Null amount aborts the whole export — Low.** One invoice with a null `amount_cents` raises `TypeError` and no file is sent for that day.
14. **No authentication on the upload — Low, to confirm.** The request sends no credentials; fine only if the URL itself carries a token or the network is restricted.
15. **All rows are loaded into memory — Low.** `fetchall()` is fine at daily volumes; no action needed now.

VERDICT: NOT READY
