`export_job.py` is close, but not mergeable as it stands: three small fixes should go in first, all doable before tomorrow. I reviewed by reading only; nothing was run, and `test_export_job.py` (named in the docstring) is not in this folder, so I could not check the tests.

The structure is sound: fetch, write and upload are separate small functions, the query is parameterised, and the connection is always closed.

## Fix before merge

1. **A failed export looks like a successful one** (`export_job.py:56-57`). The `except Exception` logs one line and then lets the script exit normally.
   - Example: the finance endpoint returns 503 at 02:00. `raise_for_status()` raises, the job logs "export failed", and it exits with code 0. Cron sees success, nobody is alerted, and finance is missing a day of invoices.
   - Expected: a non-zero exit and a full traceback. Use `log.exception(...)` and re-raise, or drop the `except` entirely.

2. **Customer emails are written to the logs** (`export_job.py:52`). The info line includes every `customer_email` for the day. That puts personal data into log files, which usually have wider access and longer retention than the invoices table. Log the count and the day only.

3. **The upload can hang forever** (`export_job.py:42`). `requests.post` has no `timeout`. If the finance endpoint accepts the connection and never answers, the job never ends and never fails. Add something like `timeout=(10, 120)`.

## Worth doing, can follow the merge

- **No logging setup.** Nothing configures logging, so when run from cron the two `log.info` lines are dropped and only the error message reaches stderr. A `logging.basicConfig(level=logging.INFO)` in the `__main__` block fixes it.
- **A missed day cannot be re-run.** `run()` always computes yesterday. Once fix 1 makes failures visible, you will want `run(day=None)` plus a command-line date argument to backfill.
- **"Yesterday" depends on two clocks.** `date.today()` uses the server's timezone and the `paid_at` comparison uses the database session's. If either differs from finance's reporting timezone, invoices paid near midnight land in the wrong day's file. Confirm both, or make the timezone explicit.
- **Amount formatting is uneven** (`export_job.py:37`). 1010 cents is written as `10.1` and 100000 as `1000.0`. The values are correct, but `f"{amount_cents / 100:.2f}"` is safer if finance parses the file strictly.
- **Import fails without the env var** (`export_job.py:16`). `FINANCE_UPLOAD_URL` is read at import time, so any test importing the module must set it first. Reading it inside `upload()` removes that coupling.
- **Test coverage is thin by your own standard.** The docstring says the tests cover the CSV header and one row. The failure path (fix 1), the date bounds passed to the query, and the upload call have none. A test that a failed upload makes `run()` raise should go in with fix 1.

VERDICT: READY WITH CHANGES
