It's not ready to merge tomorrow. Three things block it: a failed export looks like a success to cron, every customer's email address gets written to the logs, and the test file the docstring points to doesn't exist. Each fix is small, so with a few hours of work it could still go in tomorrow.

I read `export_job.py` only. I didn't run anything, since there's no test file and no database to run against.

## Blocking issues

**1. A failed export looks like a success (High)** – `export_job.py:56-57`
`run()` catches every exception, logs one line and exits with code 0. Cron and any monitoring treat that as a successful run.
- **Example:** the finance endpoint returns 503 at 02:00. `raise_for_status()` raises, the error is caught and logged, and the process exits 0. Finance gets no file and nobody is told.
- **Expected:** a non-zero exit so the failure can be seen.
- **Fix:** use `log.exception(...)` (which also keeps the stack trace that `log.error` drops), then re-raise. Or remove the `except` and keep only the `finally`.

**2. Customer emails are written to the logs (High)** – `export_job.py:52`
`[row[1] for row in rows]` logs the `customer_email` of every exported invoice.
- **Example:** 4,000 invoices produce one log line with 4,000 addresses, which then goes wherever logs are shipped and kept.
- **Note:** the module never configures logging, so run directly from cron this INFO line is probably dropped today. It will leak the moment someone adds a logging config.
- **Fix:** log only the count.

**3. The test file doesn't exist (High)** – `export_job.py:3`
The docstring says it's tested by `test_export_job.py`, but there's no such file in the directory. Even the coverage it describes (CSV header plus one row) wouldn't cover the failure paths. The minimum to add:
- `write_csv` with zero rows, and with currencies that use 0 and 2 decimal places
- a failed upload makes `run()` raise
- the log output contains no email addresses

## Should fix before or soon after merge

**4. Amount conversion is wrong for some currencies (Medium)** – `export_job.py:37`
`amount_cents / 100` assumes every currency has 2 decimal places.
- **Example:** JPY `amount_cents=500` exports as `5.0` when it should be `500`.
- **Example:** KWD has 3 decimals and is off by a factor of 10.
- If the data is single-currency, say so in a comment. Otherwise look up decimal places per currency and format with `Decimal`, not float.

**5. Day boundaries depend on timezones (Medium)** – `export_job.py:28, 47`
"Yesterday" comes from the server's local clock, and comparing `paid_at` against a bare date uses the database session's timezone.
- **Example:** a server in UTC and a DB session in America/New_York (or the reverse) shifts the window by hours. Invoices paid near midnight then land in the wrong file or in no file.
- **Fix:** compute the window explicitly in UTC (or finance's agreed timezone) and pass timezone-aware datetimes.

**6. The upload has no timeout (Medium)** – `export_job.py:42`
If the endpoint stalls, `requests.post` can hang forever and the next night's run overlaps it. Add something like `timeout=60`.

**7. Failed days can't be re-run (Medium)** – `export_job.py:47`
The day is always "yesterday". Once #1 makes failures visible, someone will need to re-export a specific date. A `--day YYYY-MM-DD` argument is a small change.

## Minor

- **Upload URL read at import time** – `export_job.py:16`: `os.environ["FINANCE_UPLOAD_URL"]` is read on import, so importing the module in a test raises `KeyError` unless the variable is set. Read it inside `upload()` or `run()`.
- **CSVs with emails pile up** – the files stay in `/var/exports` indefinitely. Decide on retention or delete each file after a successful upload.
- **Partial file on crash** – `write_csv` writes straight to the final path. Write to a temp file and rename it.
- **Empty days** – a day with no paid invoices uploads a header-only file. That may be what finance wants; confirm with them.

## Suggested path for tomorrow

1. Fix #1 and #2 (about 5 lines).
2. Add the test file covering #1–#3.
3. Fix #6 (one argument).
4. If finance confirms a single currency and timezone, add a comment and a ticket for #4 and #5 and merge. Ship #7 as a quick follow-up.

VERDICT: NOT READY
