I'd hold this one. It isn't ready to merge tomorrow, but the fixes are small. The code is cleanly split into fetch, write and upload steps, the SQL is parameterised, and the date range is half-open (start of yesterday up to, but not including, today). That's a good base. Two problems block the merge: a failed export looks like a success, and every customer's email address gets written to the logs.

I also couldn't find `test_export_job.py` in this folder, though the file's docstring says it exists. So I couldn't check the tests. From that docstring, they only cover the CSV header and one row.

## Blocking (fix before merge)

1. **Failures are hidden from cron (lines 56–57).** The `except Exception` logs the error and then `run()` returns normally, so the process exits with code 0. For example, if the finance endpoint returns a 500 at 02:00, cron records a success, no alert fires, and finance just never gets the file. **Fix:** re-raise after logging, or call `sys.exit(1)`.
2. **Customer emails go into the logs (line 52).** `[row[1] for row in rows]` puts every customer email into an INFO log line every night. That's personal data leaking into log storage, which usually has wider access and longer retention than the database. **Fix:** log only the count, or the invoice IDs.
3. **The upload has no timeout (line 42).** If the endpoint accepts the connection but never responds, `requests.post` waits forever. The next night's run then overlaps with a job that's still hung. **Fix:** set `timeout=(5, 60)` or similar.
4. **There are almost no tests.** The test file isn't in this folder. Even if it exists elsewhere, header-plus-one-row leaves the important cases untested: the upload failing, a day with zero invoices, the amount formatting, and the exit code on failure. Problem 1 above is exactly the kind of bug a failure-path test would have caught.

## Should fix (soon, ideally in this PR)

5. **Money is written as a float, assuming 2 decimal places (line 37).** For example, `1000 / 100` comes out as `10.0` and `5 / 100` as `0.05`, so formatting varies from row to row. Currencies that don't use 2 decimals come out wrong: JPY 500 (stored as `500`) is written as `5.0`, and KWD uses 3 decimals. **Fix:** use `Decimal` with each currency's number of decimal places, or export the raw cents and let finance convert.
6. **"Yesterday" depends on the server's timezone (line 47).** `date.today()` uses the host's local time. If `paid_at` is a `timestamptz` column, the comparison also depends on the database session's timezone. If either is off from what finance expects (say, UTC), invoices near midnight land in the wrong day's file or are missed. **Fix:** pin both to an explicit timezone.
7. **There's no way to re-run a past day.** The date is hard-coded to yesterday. If Tuesday's run fails, nobody can regenerate Tuesday's file on Wednesday without editing the code. **Fix:** accept an optional `--date` argument.
8. **Importing the module crashes without the environment variable set (line 16).** `os.environ["FINANCE_UPLOAD_URL"]` runs at import time. Any test that imports this module fails with a `KeyError` unless the variable is set. **Fix:** read it inside `upload()` or `run()`, or pass it in as an argument.
9. **Logging is never set up.** Nothing calls `logging.basicConfig`, so the two `log.info` lines are silently dropped. Errors only reach stderr through Python's last-resort fallback handler, with no timestamp and no level.

## Minor

10. `log.error("... %s", error)` loses the stack trace. Use `log.exception(...)` instead.
11. Files with customer emails pile up in `/var/exports` with no cleanup or retention policy.
12. A day with no invoices uploads a file containing only the header row. That may be what finance wants, but it's worth confirming.
13. A failed upload isn't retried. Even one or two retries with backoff would cover brief network failures.
14. `EXPORT_DIR` is hard-coded, and the code assumes the directory already exists.
15. The CSV is written directly to its final path, so a crash partway through leaves a truncated file. Writing to a temp file and then renaming it avoids that.
16. There are no type hints or docstrings on the functions. This is cosmetic only.

Fixing 1–4 is about an hour's work. With those done, I'd call this ready with changes, and 5–9 could follow in a later PR if you track them.

VERDICT: NOT READY
