**Not quite ready as written, but the fixes are small and you can finish them before tomorrow.** The structure is good: query, CSV writing and upload are separate small functions, the query is parameterized, the date range is half-open, and the connection is always closed. Three things need fixing before merge.

**Must fix**

1. **Failures are silent.** `run()` catches every exception, logs it, and exits 0.
   - Example: the finance endpoint returns a 500. `raise_for_status()` raises, the `except` logs one line, and cron sees a successful run. Finance never gets that day's file and nobody is alerted.
   - Fix: re-raise after logging (or call `sys.exit(1)`), so cron's failure handling fires.
2. **Customer emails are written to the logs.** Line 52 logs `[row[1] for row in rows]`, so every night's logs hold a full list of customer emails. Log the count and date only.
3. **The upload has no timeout.** `requests.post` waits forever by default. If the endpoint stalls, the 02:00 job hangs and may overlap with the next night's run. Add something like `timeout=30`.

**Should fix (small)**

- **Time zones.** `datetime.date.today()` uses the server's local zone, while `paid_at` comes from the database. If the server is in UTC and the business day isn't, invoices paid near midnight land in the wrong day's file. Pick one zone explicitly and use it for both.
- **Amounts.** `amount_cents / 100` assumes two decimal places. A JPY invoice of 500 would export as 5.0, which is wrong. If you only handle two-decimal currencies, say so in a comment. Otherwise use `Decimal` with per-currency exponents.
- **Logging setup.** Nothing calls `logging.basicConfig`, so the `log.info` lines won't appear when cron runs this. Configure it in the `__main__` block.

**Tests**

The docstring says the tests cover only the CSV header and one row. Before merging, add tests for:
- `fetch_invoices` passing the right date range.
- An empty day.
- An upload failure making `run()` fail (this guards fix 1).
- Emails not appearing in the logs (this guards fix 2).

Mock `requests` and the database connection for these. Writing the failing-upload test first will also confirm that fix 1 works.

VERDICT: READY WITH CHANGES
