**Not ready to merge tomorrow.** If the export fails, the job still exits successfully, so neither cron nor anyone watching would find out finance never got their file. That fix is small. I read `export_job.py` only. I didn't run it and didn't open `test_export_job.py`, so the test comments rely on the docstring.

## Must fix before merge

**1. Failures are swallowed (high).** `run()` catches `Exception` (`export_job.py:56-57`), logs one line, and returns normally. The process exits 0.
- Case: the finance endpoint returns a 500. `raise_for_status()` raises, the handler logs "export failed", and cron records a success. Finance is missing a day of invoices and nobody is alerted.
- Expected: the job exits non-zero.
- Fix: use `log.exception(...)` to keep the traceback, then re-raise, or call `sys.exit(1)`. Alternatively, remove the `except` and let `finally` close the connection.

**2. Customer emails are written to the logs (high).** Line 52 logs `[row[1] for row in rows]`, which is every customer email for the day, at INFO level, every night.
- This puts personal data in log files, probably with a wider audience and longer retention than the invoices table.
- Fix: log only the count and the date.

**3. The upload has no timeout (medium).** `requests.post(...)` on line 42 waits forever by default. If the endpoint accepts the connection and never answers, the 02:00 job hangs and the next night's run may overlap it. Add `timeout=(5, 60)` or similar.

**4. Amounts are written as floats (medium).** `amount_cents / 100` on line 37 gives `10.0` for 1000 cents, not `10.00`, and it is wrong for currencies that don't have two decimal places.
- Case: 1000 cents in USD is written `10.0`; a JPY amount of 500 is written `5.0`, which is off by 100×.
- If finance parses this strictly, it will break. Use `Decimal` with per-currency exponents, or export `amount_cents` as it is stored.

**5. Test coverage is thin (medium).** The docstring says the only test covers the CSV header and one row.
- Untested: `fetch_invoices` (the date window), `upload` (success and error), `run` (the failure path from item 1), an empty day, and the amount formatting from item 4.
- You asked for tests alongside the code, so I'd add at least the failure-exit test and the amount test before merging.

## Should fix, can follow up

- **Day boundary and timezone (medium, needs a requirement check).** `date.today()` uses the server's local time, and the SQL compares `paid_at` to bare dates, which resolve in the database session's timezone. If the server and database zones differ, or "yesterday" means a specific business zone, invoices near midnight land in the wrong file. I can't tell whether this is wrong without knowing finance's definition of a day.
- **Import-time environment lookup (low).** `os.environ["FINANCE_UPLOAD_URL"]` on line 16 raises `KeyError` when the module is imported, so any test or tool that imports the module without that variable fails. Read it inside `run()`.
- **No logging setup (low).** There is no `basicConfig`, so the `log.info` lines are dropped under cron unless something else configures logging. Today only the error line would appear, at WARNING and above.
- **Export file handling (low).**
  - The file is written straight to its final path, so a crash mid-write leaves a partial file.
  - `/var/exports` is assumed to exist.
  - The file holds customer emails with default permissions and is never cleaned up.
- **Re-runs (speculative).** Re-running after a partial failure re-uploads the whole file. If the endpoint doesn't deduplicate, finance could get duplicates. I haven't seen the endpoint's behavior.
- **CSV formula injection (speculative, low).** An email or field starting with `=`, `+`, `-` or `@` would be read as a formula if finance opens the file in Excel.

## Why this is a short fix list

Items 1–3 are each a few lines. Item 4 is a small change plus a test, and item 5 is the tests for items 1 and 4. That is realistic to finish before tomorrow. The rest can go into follow-up tickets, apart from the timezone question, which you should confirm with finance.

VERDICT: NOT READY
