The job's structure is good, but two problems need fixing before tomorrow's merge. A failed export currently looks like a success to cron, and the logs record every customer's email address. Each is a few lines to fix.

The rest is in good shape. The query is parameterised, the date window is half-open (`>=` start, `<` next day), so no invoice lands in two days' exports. Each step has its own small function and the connection is always closed.

## Must fix before merge

**1. Failures are hidden (`export_job.py:56-57`).** The `except Exception` logs the error and lets the script exit with code 0.
- Example: the finance endpoint returns 503 at 02:00. `raise_for_status()` raises, you get one `ERROR` log line, and the process exits 0. Cron and any monitoring see a successful run, and finance gets no file. You'd only find out when they ask.
- Expected: the script exits non-zero so the failure gets noticed. Fix: after `log.error(...)`, add `raise` (or use `log.exception(...)` then `raise`, which also logs the traceback).

**2. Customer emails go into the logs (`export_job.py:52`).** `[row[1] for row in rows]` writes every paying customer's email address into the log every night. That is personal data ending up in log storage, which usually has wider access and longer retention than the database. With 5,000 invoices, that's one log line holding 5,000 email addresses. Fix: log only the count and the day.

## Worth doing, but not blocking

3. **No timeout on the upload (`:42`).** If the endpoint hangs, `requests.post` waits forever and the 02:00 job never finishes. Add `timeout=60` or similar.
4. **The amount column is a float (`:37`).** `1000 / 100` writes `10.0`, not `10.00`. It also assumes every currency has two decimal places, which is wrong for JPY (0) and KWD (3). If finance's import is strict, write `f"{amount_cents / 100:.2f}"` or send the cents value unchanged.
5. **Which timezone counts as "yesterday"?** `date.today()` uses the server's timezone. If `paid_at` is a `timestamptz`, the date limits are read in the database session's timezone. If those differ from what finance thinks of as a day, invoices near midnight end up in the wrong file. It's worth confirming they all match.
6. **Tests.** The docstring cites `test_export_job.py`, but there's no such file in this folder, so I couldn't check it. Even if it exists, it covers only the CSV header and one row. I'd add three tests: the failure path (upload raises, so `run()` raises), the date window passed to the query, and the amount formatting. Fix #1 makes the failure test easy. Moving `os.environ["FINANCE_UPLOAD_URL"]` (`:16`) inside `upload()` also helps: right now importing the module in a test fails unless that variable is set.

Fix #1 and #2 and it's good to merge. Items 3–6 can follow in a later change if time is short tomorrow.

VERDICT: READY WITH CHANGES
