**Not ready to merge as written, but it can make tomorrow: items 1–3 below are must-fix, and each is a few lines.** The structure is fine (small functions, parameterised SQL, connection always closed), so nothing needs redesigning. I reviewed only `export_job.py` and ran nothing; the test coverage comment relies on the file's docstring, not on reading `test_export_job.py`.

## Must fix before merge

1. **A failed export looks like a success (lines 56–57).** `run()` catches every exception, logs one line and exits with code 0.
   - Example: the finance endpoint returns 503 at 02:00. The only trace is `export failed: 503 Server Error...` on stderr, and cron sees a clean exit.
   - Expected: non-zero exit and a full traceback, so cron or alerting catches the missing file before finance does.
   - Fix: use `log.exception(...)` and re-raise, or `sys.exit(1)`.

2. **Customer emails are written to the logs (line 52).** The info line includes `[row[1] for row in rows]`, which is every customer email for the day.
   - Example: a day with 5,000 paid invoices produces one log line holding 5,000 email addresses, in whatever log store this ships to.
   - Fix: log the count and the day only.

3. **The upload has no timeout (line 42).** `requests.post` waits forever by default.
   - Example: the finance endpoint accepts the connection and never responds. The job hangs indefinitely and the next night's run starts alongside it.
   - Fix: `timeout=(10, 120)` or similar.

## Should fix (soon after, or now if time allows)

4. **A missed day cannot be re-run.** `run()` always computes yesterday and takes no date argument. If Tuesday's run fails, exporting Tuesday's invoices on Thursday means editing the code. An optional `day` parameter or CLI argument fixes this, and matters more because of item 1.

5. **"Yesterday" depends on the server's timezone (lines 47, 28).** `date.today()` uses host local time, and the date-to-timestamp comparison uses the database session's timezone.
   - Example: on a UTC host, an invoice paid at 23:30 UTC on 13 Nov lands in the 13 Nov file, even if finance's business day in their timezone says 14 Nov.
   - Fix: pick the timezone explicitly and build the two boundaries as timezone-aware datetimes.
   - Related: `paid_at.isoformat()` has no offset if the column is a plain timestamp.

6. **Amount formatting is inconsistent and assumes two decimals (line 37).** `amount_cents / 100` writes 2000 as `20.0`, 1050 as `10.5` and 1999 as `19.99`.
   - For JPY, which has no minor unit, 500 yen stored as `500` would be exported as `5.0`.
   - A NULL `amount_cents` raises `TypeError` and fails the whole export.
   - Fix: format with `Decimal` to a fixed number of places, and confirm how non-two-decimal currencies are stored.

7. **Tests cover only the CSV header and one row.** There is nothing for the date window in `fetch_invoices`, an upload failure, the failure path in `run()` or amount formatting. Items 1, 3 and 6 each deserve a test alongside the fix.

8. **Email values can be read as spreadsheet formulas.** `customer_email` is customer-supplied; a value starting with `=`, `+`, `-` or `@` runs as a formula if finance opens the CSV in Excel. Prefix such values with `'`, or confirm the file is only machine-read.

9. **Export files with customer emails pile up in `/var/exports`.** They are never deleted and are created with default permissions, typically world-readable. Set the file mode to `0o600` and add a retention rule.

## Minor

10. **`UPLOAD_URL` is read at import time (line 16).** Importing the module without the variable set raises `KeyError`, including in tests. `DATABASE_URL` is read inside `run()`; do the same for both.
11. **A connection failure behaves differently from every other failure (line 49).** `psycopg2.connect` sits outside the `try`, so it crashes with a traceback while everything else is swallowed. Fixing item 1 makes them consistent.
12. **No logging configuration.** Run as a script, the `log.info` lines are not emitted at all; only warnings and above reach stderr. Add `logging.basicConfig(level=logging.INFO)` under `__main__`.
13. **No `encoding="utf-8"` on `open` (line 33).** Under cron's minimal locale, a non-ASCII email could fail or be encoded unexpectedly.
14. **No visible authentication on the upload.** If the credential is not embedded in the URL, the endpoint is open. Worth confirming it is HTTPS too.
15. **An empty day uploads a header-only file.** This is probably fine, but confirm finance expects it.
16. **Re-running a day uploads a duplicate.** Confirm whether the endpoint de-duplicates by filename.
17. **Invoices are filtered by current status.** One paid yesterday and refunded before 02:00 is silently left out. Confirm that is intended.
18. **`fetchall()` loads the whole day into memory.** This is fine at current volumes.
19. **`EXPORT_DIR` is hard-coded and not checked for existence.** There are also no type hints.

VERDICT: READY WITH CHANGES
