`export_job.py` is not ready to merge tomorrow: when the export fails, the job hides the failure and that day's invoices can never be re-sent. The fixes are small (roughly half a day with tests), but two of them decide whether finance ever finds out about a missing file.

This is a read-through only; I did not run anything. The docstring says the job is tested by `test_export_job.py`, but that file is not in this folder, so I could not check the tests.

## Blockers

1. **A failed export looks like a success (High).** `run()` catches every exception, logs one line and exits with code 0 (`export_job.py:56-57`).
   - Example: the finance endpoint returns 503 at 02:00. Cron records success, no alert fires and finance has no file. The job should exit non-zero.
   - The log line has no stack trace. Use `log.exception` and re-raise.

2. **A missed day is lost for good (High).** The day is always "yesterday" (`export_job.py:47`), with no way to pass a date.
   - Example: the 14 Nov run fails, so the 13 Nov invoices are never exported, because the next run only covers 14 Nov.
   - Add a `--date` argument. Also confirm with finance whether uploading the same day twice creates duplicates on their side.

3. **Customer emails are written to the log (High, privacy).** Line 52 logs the full list of customer emails on every run. Log the count only.

4. **The upload has no timeout (High).** `requests.post` at line 42 waits forever if the endpoint stalls. The job then hangs silently, and later nightly runs stack up behind it. Add a timeout and, ideally, a small retry.

5. **Test coverage is one CSV row (High against your standards).** By the docstring's own description, nothing tests the date window, an upload failure or `run()` itself. `run()` is hard to test because it reads the clock, the environment and the database directly; passing the day in fixes that and item 2 together.

## Should fix, can follow shortly after

6. **Day boundary depends on server time zone (Medium).** `date.today()` uses the server's clock, and the database interprets the date in its own session zone.
   - Example: with a UTC server and finance in US Eastern, an invoice paid at 20:30 Eastern on 12 Nov lands in the 13 Nov file.
   - Pick the business time zone explicitly.

7. **Amount formatting (Medium).** `amount_cents / 100` writes 2000 as `20.0` and 1050 as `10.5`, not `20.00` and `10.50`. It is also wrong for currencies without two decimals: JPY 500 is exported as `5.0` if stored in minor units. Format with `Decimal` and per-currency exponents, or confirm that only two-decimal currencies exist.

8. **No logging setup (Medium).** Nothing configures logging, so the `info` lines, including "export finished", are dropped. Only the error line reaches stderr.

9. **No visible authentication on the upload (Medium, unverified).** The POST sends no credentials. That is fine only if the URL itself carries a token and is HTTPS; I cannot see its value.

10. **File handling in `/var/exports` (Medium).**
    - The CSV contains customer emails and is created with default permissions.
    - Files are never deleted.
    - A crash mid-write leaves a partial file under the final name.

11. **Spreadsheet formula injection (Low to Medium).** An email starting with `=`, `+`, `-` or `@` is run as a formula when finance opens the CSV in Excel. Prefix such cells with `'`.

## Minor

12. **`FINANCE_UPLOAD_URL` is read at import time (Low).** Line 16 makes importing the module, including from tests, crash when the variable is unset. Read it inside `run()`, as `DATABASE_URL` is.
13. **No file encoding specified (Low).** `open(path, "w")` uses the cron locale; set `encoding="utf-8"`.
14. **All rows are loaded into memory (Low).** `fetchall()` is fine at current volumes but will not scale indefinitely.
15. **An empty day uploads a header-only file (Low).** Finance cannot tell this apart from a broken query; at least log a warning.
16. **No guard against overlapping runs (Low).** This matters once item 4 is fixed with retries.
17. **`paid_at` may be written without a time zone offset (Low).** This happens if the column is a naive timestamp.

The query itself is parameterised correctly, and the connection is always closed.

VERDICT: NOT READY
