It isn't ready to merge yet: four problems can make finance lose or misread a day of invoices without anyone noticing, but all four are small fixes that fit before tomorrow. The structure itself is good (small single-purpose functions, a parameterised query, files and cursors closed properly), so this is about hardening.

I only read `export_job.py`; I didn't see `test_export_job.py`, the `invoices` schema or the cron entry, so items that depend on those say so.

## Blocking

1. **Failures are swallowed, so cron sees success** (`export_job.py:56-57`). `run()` catches every exception, logs one line and exits 0. If the finance endpoint returns a 503 at 02:00, the expected result is a non-zero exit and an alert; the actual result is exit 0, no file at finance, and nobody told. Re-raise after logging (or `sys.exit(1)`), and use `log.exception` so the traceback is kept.

2. **A missed day is never recovered** (`export_job.py:47`). The date is always "yesterday" with no way to override it. If the job fails on the 14th, the 15th's run exports only the 14th's invoices, and the 13th's are never sent. Add a `--date` argument so a failed day can be re-run.

3. **The upload has no timeout** (`export_job.py:42`). If the finance endpoint accepts the connection and never answers, `requests.post` waits forever. The job hangs, never reaches the error path, and the next night's run starts alongside it. Add `timeout=(10, 120)` or similar.

4. **Every customer email is written to the log** (`export_job.py:52`). On a day with 5,000 paid invoices, that is 5,000 email addresses in one log line, going wherever the logs are shipped and retained. Log the count only.

5. **The "yesterday" window depends on two timezones that may not agree** (`export_job.py:47`, `:21`). `date.today()` uses the server's timezone, and the database turns the date into midnight in its own session timezone. For example, with the server in US Eastern and the database in UTC, an invoice paid at 21:00 Eastern on the 13th is stored as 02:00 UTC on the 14th and lands in the 14th's file, not the 13th's. Whether this bites depends on whether `paid_at` is `timestamptz` and what finance means by a day; pick one timezone and build explicit, timezone-aware bounds.

## Should fix before or right after merge

6. **Logging is never configured** (`export_job.py:13`). Run as a script, Python drops the `info` lines and prints only the bare error message to stderr, with no timestamp. A successful run leaves no trace. Add `logging.basicConfig(...)` under `__main__`.

7. **Tests cover only the CSV header and one row**, per the docstring. The date window, upload failure, exit code and empty-day paths are untested, and those are where items 1–5 live.

8. **Amounts are formatted inconsistently and assume two decimal places** (`export_job.py:37`). 1050 cents is exported as `10.5` and 2000 as `20.0`. If a zero-decimal currency is stored in its own minor unit, JPY 5000 is exported as `50.0`. Use `Decimal` with the currency's exponent, or export `amount_cents` unchanged.

9. **A failed upload can log the upload URL** (`export_job.py:43`, `:57`). The `raise_for_status()` error message includes the full URL, so if it carries a token in the query string, that token ends up in the log. Related: the request sends no auth header, so check how the endpoint authenticates.

10. **Re-running a day uploads it twice.** Nothing tells the endpoint this file replaces an earlier one. Confirm that finance deduplicates by filename or invoice id.

11. **`FINANCE_UPLOAD_URL` is read at import time** (`export_job.py:16`). Importing the module in a test without the variable set raises `KeyError`. Read it inside `upload()` or `run()`, as `DATABASE_URL` already is.

## Minor

12. **CSV files with customer emails pile up in `/var/exports`**. They are never deleted, are created with default permissions, and a half-written file is left behind on failure.
13. **Spreadsheet formula injection** (`export_job.py:37`). An email beginning with `=`, `+`, `-` or `@` is run as a formula when finance opens the file in Excel. Prefix such cells with `'`.
14. **No encoding on `open()`** (`export_job.py:33`). The file encoding follows the cron locale; set `encoding="utf-8"`.
15. **`psycopg2.connect` sits outside the `try`** (`export_job.py:49`) and has no `connect_timeout`. A connection failure skips the job's own logging.
16. **A single `NULL` `amount_cents` aborts the whole export** with a `TypeError` (`export_job.py:37`).
17. **`fetchall()` loads the whole day into memory** (`export_job.py:29`). This is fine at today's volume; use a server-side cursor if it grows.
18. **An empty day uploads a header-only file.** This may be intended; if so, say it in the docstring.
19. **`EXPORT_DIR` is hard-coded** and not created if missing (`export_job.py:15`).
20. **Nothing stops two runs overlapping**, which only matters once item 3 is fixed and a manual re-run is possible.

VERDICT: NOT READY
