It's close, but don't merge it as written. Three changes are needed first, and each is a few lines, so tomorrow is still realistic. The structure is good: the fetch, write and upload steps are small separate functions, the query is parameterised, and the database connection is always closed.

## Fix before merging

**1. Failures are hidden from cron** (`export_job.py:56-57`). `run()` catches every exception, logs it and returns normally, so the script exits with code 0.
- Example: the finance endpoint returns a 500. `raise_for_status()` raises, the error is logged, and cron records a success. Finance gets no file and nobody is alerted.
- Fix: keep the log line but use `log.exception(...)` so you get the traceback, then `raise` again (or `sys.exit(1)`) so cron's failure alerting fires.

**2. Every customer email goes into the logs** (`export_job.py:52`). `[row[1] for row in rows]` writes all of the day's customer emails into the log on every run. That's personal data leaking into a system that usually has wider access and longer retention than the database. Log only the count and the date.

**3. The test the docstring mentions isn't here.** Line 3 says the job is covered by `test_export_job.py`, but that file isn't in this directory. If it lives somewhere else, fine. Either way, the docstring says it covers only the CSV header and one row. Before merging I'd add tests for:
- An upload failure making `run()` raise. This locks in fix 1.
- A day with no invoices, which should produce a CSV with just the header. Check that finance is happy to receive that.
- How amounts are formatted (see the next point).

## Worth fixing now or tracking as follow-ups

- **No timeout on the upload** (`export_job.py:42`). If the endpoint hangs, `requests.post` waits forever and the next night's run stacks on top. Add `timeout=30` or similar.
- **Amounts are floats and assume two decimal places** (`export_job.py:37`). If any currency has no minor unit, such as JPY, 500 yen stored as `500` would export as `5.0`. Even for USD, finance will usually want `19.99` and `10.00` rather than `10.0`. `Decimal(amount_cents) / 100`, formatted with a fixed number of places, avoids both problems, unless finance would rather receive cents.
- **"Yesterday" depends on the server's timezone** (`export_job.py:47`). `date.today()` uses the host's clock, and if `paid_at` is a `timestamptz` column, the day boundaries depend on the database session's timezone. Pin both to UTC (or whatever day boundary finance uses) so invoices near midnight don't land on the wrong day or get dropped.
- **You can't re-run a missed day.** The date is hard-coded to yesterday. A `--date` argument would let you backfill after an outage without editing the code.
- **`UPLOAD_URL` is read when the module is imported** (`export_job.py:16`). Any test that imports the module needs that environment variable set. Reading it inside `upload()` or `run()` makes the module easier to test.

Once fixes 1–3 are in, I'd be comfortable merging. The remaining items can be tracked as follow-ups if you're short on time.

VERDICT: READY WITH CHANGES
