Not as it stands, but it's close: four small fixes, about an hour's work plus tests, should make it mergeable tomorrow. The structure is good — four small single-purpose functions, a parameterised query, a clean half-open date window, and the connection is always closed.

I read only `export_job.py`; I did not open `test_export_job.py` or run anything.

## Fix before merging

1. **A failed export looks like a success to cron** (`export_job.py:56-57`). The `except Exception` logs one line and the script exits with code 0. If the finance endpoint returns a 500 at 02:00, nothing alerts and finance simply has no file. Re-raise after logging (or `sys.exit(1)`), and use `log.exception` so the traceback is kept.

2. **A missed day can never be re-exported** (`export_job.py:47`). The day is hard-coded to "yesterday". If Tuesday's run fails, Wednesday's run exports only Tuesday's invoices, and Monday's are never sent unless someone edits the code. Let `run()` accept an optional date (a CLI argument defaulting to yesterday).

3. **Customer emails are written into the log** (`export_job.py:52`). The line logs every customer email for the day. Log the count and date only.

4. **The upload has no timeout** (`export_job.py:42`). `requests.post` waits forever by default, so a stalled endpoint leaves the job hanging and later nightly runs stack up behind it. Add `timeout=` (for example 60 seconds).

Related to 1 and 3: nothing configures logging, so under cron the `info` lines, including "export finished", are not written anywhere. Only the error message reaches stderr. Add `logging.basicConfig(level=logging.INFO)` in the `__main__` block, after removing the emails from the log line.

## Worth doing, not blocking

- **Amount formatting** (`export_job.py:37`): `amount_cents / 100` writes 2000 cents as `20.0` and 1010 as `10.1`, not `20.00` and `10.10`. The values are right but the format is inconsistent; `f"{amount_cents / 100:.2f}"` or `Decimal` fixes it.
- **Timezone of "yesterday"**: `date.today()` uses the cron server's clock, and the query compares against the database session's timezone. If those differ from finance's business day, invoices paid near midnight land in the neighbouring file. Confirm what finance expects.
- **Import-time environment lookup** (`export_job.py:16`): `os.environ["FINANCE_UPLOAD_URL"]` runs on import, so any test importing the module fails without that variable set. Reading it inside `upload()` avoids this.
- **Re-runs**: once fix 2 lands, check with finance whether uploading the same day twice creates duplicates on their side.

## Tests

The docstring says the tests cover the CSV header and one row. The parts that can hurt — the date window in `fetch_invoices`, an upload failure, and `run()` exiting non-zero on error — have no tests. By your own tests-first standard, add at least these three alongside the fixes:

- `run()` raises or exits non-zero when the upload fails.
- `run()` exports the explicit date it is given.
- An invoice paid exactly at midnight lands in the right day.

VERDICT: READY WITH CHANGES
