**Not ready to merge as written, but it can be by tomorrow.** Four fixes of a few lines each, plus tests for the failure path, are needed first. The core of the job (query, CSV, upload) is clean and easy to read. I only read `export_job.py`; I did not run it or see `test_export_job.py`, so the test coverage comments rely on the docstring.

## Must fix before merge

**1. A failed export looks like a successful one (High)** — `export_job.py:56-57`
- **Case:** the finance endpoint returns 503 at 02:00. `raise_for_status()` raises, the `except Exception` logs one line, and the process exits with code 0.
- **Result:** cron sees success, nobody is alerted, and finance has no file for that day. It should exit non-zero.
- **Fix:** use `log.exception(...)` and then `raise` (or `sys.exit(1)`). The current `log.error` also drops the traceback.

**2. A failed day is never retried (High)** — `export_job.py:47`
- **Case:** the 14 Nov run fails. The 15 Nov run computes "yesterday" as 14 Nov's successor only, so 13 Nov's invoices are never exported unless someone hand-edits the code.
- **Fix:** accept an optional date argument (`python export_job.py 2026-11-13`) so a missed day can be re-run.

**3. The upload can hang forever (High)** — `export_job.py:42`
- **Case:** the finance endpoint accepts the connection and never responds. `requests.post` has no timeout, so the job never finishes and the next night's run starts on top of it.
- **Fix:** add `timeout=(10, 120)` or similar.

**4. Customer emails are written to the log (High, privacy)** — `export_job.py:52`
- **Case:** a day with 3,000 paid invoices produces one log line holding 3,000 customer email addresses.
- **Fix:** log the count and the date only.

**5. Tests cover only the CSV header and one row (Medium, by your own standard)**
- `fetch_invoices`, `upload` and the failure path of `run` are untested, and fixes 1–3 each need a test.
- Minimum: upload failure exits non-zero, the date argument is honoured, and the query receives the right day boundaries.

## Should fix, can follow shortly after

- **No logging setup (Medium)** — `export_job.py:13`. Nothing configures logging, so the two `log.info` lines are discarded and "export finished" never appears anywhere. Add `logging.basicConfig(level=logging.INFO)` under `__main__`. This is also why issue 4 is not leaking today; it starts leaking the moment logging is switched on.
- **Amounts are formatted inconsistently (Low)** — `export_job.py:37`. `amount_cents / 100` turns 1050 into `10.5` and 100 into `1.0`, where finance would expect `10.50` and `1.00`. Use `f"{amount_cents / 100:.2f}"` or `Decimal`.
- **Import fails without the environment variable (Low)** — `export_job.py:16`. `os.environ["FINANCE_UPLOAD_URL"]` runs at import, so any test importing the module raises `KeyError` unless the variable is set. Read it inside `upload()` or `run()`.
- **CSV files with customer emails pile up (Low)** — `export_job.py:15`. Files in `/var/exports` are never deleted and get default file permissions.

## Needs checking — I could not confirm from this file

- **"Yesterday" may be cut at the wrong hour.** The day comes from the server's local clock and is compared to `paid_at` in the database session's timezone. If the server runs in UTC and finance works in US Eastern, an invoice paid at 20:30 Eastern on 14 Nov lands in the 15 Nov file. Whether this bites depends on the `paid_at` column type and what finance means by a day.
- **Non-two-decimal currencies.** The query selects `currency`, so multiple currencies seem possible. If a JPY invoice is stored as 5000 (yen has no minor unit), it exports as `50.0`.
- **No authentication on the upload.** The POST sends no token or header. This is fine if the URL itself carries a signed secret; otherwise it needs one.
- **Empty days.** A day with no paid invoices uploads a header-only file. Confirm finance wants that rather than no file.
- **Spreadsheet formulas.** An email beginning with `=` or `+` would be treated as a formula if finance opens the CSV in Excel. This is unlikely but cheap to guard.

VERDICT: READY WITH CHANGES
