**Not ready to merge as written, but the gap is small.** The structure is good (four small functions, parameterized SQL, half-open date window, connection always closed). Four problems can make finance lose or mis-read data without anyone noticing, and those should be fixed before merge. They are roughly half a day of work including tests, so tomorrow is still feasible.

I could only review `export_job.py`: `test_export_job.py` is not in this directory, so the testing points rest on the docstring ("CSV header and one row").

## Must fix before merge

1. **Failures are swallowed, so cron reports success (lines 56-57).** If the upload returns a 500, the job logs one line and exits with code 0. Finance gets no file and nothing alerts. Expected: non-zero exit and a traceback. Use `log.exception(...)` and re-raise, or remove the `except`.

2. **A failed day is never exported (line 47).** The date is hardcoded to yesterday, with no way to pass one in. If the 02:00 run on 14 Nov fails, the 15 Nov run exports only 14 Nov's invoices and 13 Nov's are never sent. Combined with item 1, this is a silent permanent gap. Add a `--date` argument.

3. **Customer emails are written to the logs (line 52).** Every run logs the full list of `customer_email` values at INFO. That is personal data in log storage, which usually has wider access and longer retention than the database. Log the count only.

4. **The upload has no timeout (line 42).** If the finance endpoint accepts the connection and never responds, the job hangs indefinitely with a database connection open. Add `timeout=`.

5. **Amounts are formatted inconsistently and wrongly for some currencies (line 37).** `amount_cents / 100` turns 1000 into `10.0` and 1990 into `19.9`; expected `10.00` and `19.90`. It also assumes two decimal places: a JPY invoice of ¥1000 stored as 1000 is exported as `10.0`. Format with `Decimal`, and confirm how non-two-decimal currencies are stored.

6. **Tests cover only the CSV header and one row.** Nothing covers the date window, the upload, the failure path or `run()`. Items 1, 2, 4 and 5 each need a test.

## Should fix, can follow shortly after

7. **"Yesterday" depends on server and database time zones (lines 28, 47).** `date.today()` uses the server's local zone, and the date bounds are interpreted in the database session's zone. If those differ from finance's business day, an invoice paid at 23:30 local time lands in the wrong day's file. Pick a zone explicitly.

8. **Logging is never configured.** With no handler set up, the INFO lines ("exporting…", "export finished") are discarded. Only the error line appears, with no timestamp. Call `logging.basicConfig` in the `__main__` block.

9. **`UPLOAD_URL` is read at import time (line 16).** Importing the module without `FINANCE_UPLOAD_URL` set raises `KeyError`, which includes importing it from tests. `DATABASE_URL` is read inside `run()`; do the same here.

10. **Spreadsheet formula injection via `customer_email` (line 37).** An email value such as `=HYPERLINK(...)` executes as a formula when finance opens the CSV in Excel. Prefix cells starting with `=`, `+`, `-` or `@` with a quote.

11. **Re-runs upload a duplicate file.** Whether that double-counts depends on the finance endpoint, which I can't see. Worth confirming once item 2 makes re-runs possible.

12. **No authentication is visible on the upload (line 42).** If the token is not embedded in the URL, the file of customer emails and amounts is posted unauthenticated. Confirm.

## Minor

13. Export files in `/var/exports` are never deleted, so customer data accumulates on disk. A failed run also leaves a partial file under the final name.
14. `open(path, "w")` has no `encoding="utf-8"` (line 33); under cron's minimal locale a non-ASCII email can raise `UnicodeEncodeError`.
15. `psycopg2.connect` sits outside the `try` (line 49), so a connection failure behaves differently from every other failure, and it has no connect timeout.
16. A day with zero invoices uploads a header-only file. Fine if finance expects that; decide explicitly.
17. `fetchall()` loads the whole day into memory (line 29). Fine at modest volume.
18. `paid_at.isoformat()` emits no offset if the column is a timestamp without time zone, so finance cannot tell which zone it is in.
19. `EXPORT_DIR` is hardcoded and not created if missing.
20. No type hints or function docstrings.

VERDICT: NOT READY
