I'd hold the merge. Two problems in `export_job.py` need fixing first: a failed export looks like a success to cron, and every customer's email address gets written to the logs. The test file the docstring mentions also isn't in this directory. Each of these is a fairly small fix, so you could still merge tomorrow if they go in today.

## Blocking issues

**1. Failures are hidden (High)** — `export_job.py:56-57`
`run()` catches every exception, logs one line and returns normally. The process exits with code 0, so cron and any monitoring treat the run as a success.
- **Example:** the finance endpoint returns 500, so `raise_for_status()` raises. The job logs `export failed: 500 Server Error…` and exits 0. Finance gets no file and nobody is alerted. It should exit non-zero so the failure is visible.
- **Fix:** use `log.exception(...)` so the traceback is kept, then re-raise (or `sys.exit(1)`).

**2. Customer emails are logged (High)** — `export_job.py:52`
`[row[1] for row in rows]` writes every customer's email to the info log, every night. Logs usually go to more places and are kept longer than the export itself, so this is a privacy/GDPR exposure.
- **Fix:** log only the count and the day.

**3. The test file is missing (High, by your standards)** — `export_job.py:3`
The docstring says the job is "Tested by test_export_job.py", but that file doesn't exist in `p/`. Even as described, it would only cover the CSV header and one row. Nothing tests the upload failing, the database failing, an empty day, or how amounts are formatted.
- **Fix:** commit the test file. Add tests for: an upload error giving a non-zero exit, zero rows, amount formatting, and the log line containing no emails.

## Should fix, but not blocking if you write them down as tickets

**4. Amounts use float and assume 2 decimal places (Medium)** — `export_job.py:37`
`amount_cents / 100` produces a float.
- **Example:** 1000 cents becomes `10.0`, not `10.00`.
- **Example:** if you bill in JPY (no minor unit), ¥500 stored as 500 becomes `5.0`, which is 100× too small.
- **Fix:** use `Decimal` and quantize per currency. If you only ever bill in 2-decimal currencies, add a comment saying so.

**5. No upload timeout (Medium)** — `export_job.py:42`
`requests.post` has no `timeout`. If the endpoint stalls, the job can hang indefinitely, and it overlaps the next night's run. Add `timeout=` and consider a small retry.

**6. "Yesterday" depends on the server's timezone (Medium, not verified)** — `export_job.py:21, 47`
`date.today()` uses the server's local timezone. The query compares `paid_at` against plain dates, so Postgres applies the session timezone. If the server, the database session and finance's idea of a business day differ (say UTC versus local), invoices paid near midnight land in the wrong day's file. I can't tell from this code what timezone is configured. It's worth confirming and then making the timezone explicit.

## Minor

- `export_job.py:16`: `FINANCE_UPLOAD_URL` is read when the module is imported. That makes importing the module in tests fail with a `KeyError` unless the variable is set. Read it inside `upload()` or `run()` instead.
- `export_job.py:47`: the day is always derived from today, so you can't re-run a missed night. A `--day` argument would fix that.
- `export_job.py:48`: CSVs containing customer emails stay in `/var/exports` forever. Delete them after a successful upload, or set a retention policy.

## Fix order for tomorrow

Fix 1 and 2 (a few lines each), commit the tests from 3, and add the timeout from 5. That gets you to a safe merge. Items 4 and 6 can follow as tickets, as long as someone confirms which currencies you bill in and how the timezones are configured.

VERDICT: NOT READY
