`export_job.py` is not ready to merge as written: a failed export looks like a success to cron, so finance could miss a day's invoices without anyone being alerted. The fixes are small and tomorrow is still realistic if the first three items below are done and tested.

I reviewed by reading only; nothing was run. `test_export_job.py`, which the docstring cites, is not in this folder, so I could not check what it covers.

## Must fix before merge

1. **Failures exit with status 0** (`export_job.py:56-57`). `run()` catches every exception, logs one line and returns normally.
   - Example: the finance endpoint returns 503, the log gets `export failed: 503 Server Error`, the process exits 0, and cron reports success.
   - Expected: non-zero exit and a traceback. Use `log.exception(...)` and re-raise, or remove the `except` entirely.

2. **The upload has no timeout** (`export_job.py:42`). `requests.post` waits forever by default, so if the endpoint accepts the connection and never answers, the job hangs indefinitely. Add `timeout=(10, 120)` or similar.

3. **Customer emails are written to the log** (`export_job.py:52`). The line logs the full list of `customer_email` values for every invoice exported. Log the count and the day only.

4. **Failure paths are untested.** The docstring says the tests cover the CSV header and one row. There is nothing for the query's date window, a failing upload, or `run()` exiting non-zero on error. The test for item 1 should be written first, since it fails today.

## Confirm before merge (possible wrong data sent to finance)

- **Amount conversion assumes two decimal places** (`export_job.py:37`). `amount_cents / 100` is wrong for currencies without two minor digits, and the query selects a `currency` column. A JPY invoice of 5000 would be exported as 50.0.
- **Amount formatting is inconsistent.** 1000 cents is written as `10.0` and 1999 as `19.99`. Formatting with `Decimal` to a fixed number of places avoids this.
- **"Yesterday" depends on two clocks** (`export_job.py:47` and the query). The day comes from the server's local date, and the midnight boundaries are interpreted in the database session's time zone. If those differ, or `paid_at` is stored in UTC, invoices near midnight land in the wrong day's file or in none.
- **No way to re-run a missed day.** The day is hardcoded to yesterday, so recovering from a failed night means editing code. A `--date` argument fixes that. Check whether the finance endpoint tolerates the same file being uploaded twice.
- **Upload has no authentication in the code.** If the token is embedded in `FINANCE_UPLOAD_URL`, the `requests` error message includes the full URL, so it would be logged on failure.

## Smaller cleanup

- `UPLOAD_URL = os.environ[...]` runs at import (`export_job.py:16`), so importing the module in a test raises `KeyError` unless the variable is set. Read it inside `run()` or `upload()`.
- No logging configuration exists, so the `info` lines are dropped when run from cron and only the error line reaches stderr.
- CSV files containing customer emails accumulate in `/var/exports` with no cleanup or explicit file permissions.

## What is fine

The query is parameterised, the half-open date range (`>=` start, `<` end) is correct, the connection is always closed, and the functions are small with one job each.

VERDICT: NOT READY
