**`export_job.py` is not ready to merge as it stands: three blockers and one high-severity problem should be fixed first.** The fixes are small and should fit in a few hours, so tomorrow is still realistic.

This is from reading the file only. I did not run anything, and I did not open `test_export_job.py`, so the test finding relies on the module docstring.

## Blockers

1. **A failed export looks like a successful one.** `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. The job prints `export failed: 503 Server Error` and cron records success, where it should exit non-zero with a traceback so someone is alerted.
   - Fix: use `log.exception(...)` and re-raise, or `sys.exit(1)`.

2. **A missed day is never exported.** The day is hard-coded to "yesterday" (`export_job.py:47`) and there is no way to pass a date.
   - Example: the 14 Nov run fails, and the 15 Nov run exports only 14 Nov's invoices. The 13 Nov invoices never reach finance, and because of blocker 1 nobody is told.
   - Fix: accept an optional date argument so a day can be re-run.

3. **Every customer email is written to the log.** The info line at `export_job.py:52` includes the full list of `customer_email` values. That is personal data in log files, and one very long line on a busy day.
   - Fix: log the count only.

## High

4. **The upload can hang forever.** `requests.post` has no timeout (`export_job.py:42`). If the endpoint accepts the connection and stalls, the job never ends and the next night's run starts alongside it.
   - Fix: add `timeout=(10, 120)` or similar.

## Medium

5. **"Yesterday" depends on the server's timezone.** `date.today()` uses the machine's local time, and the date bounds are interpreted in the database session's timezone. If `paid_at` is stored in UTC and finance works in New York time, an invoice paid at 23:30 on 13 Nov in New York (04:30 UTC on 14 Nov) lands in the 14 Nov file. The intended timezone should be chosen and made explicit.

6. **Amounts are formatted inconsistently and assume two decimal places.** `amount_cents / 100` (`export_job.py:37`) writes 1050 as `10.5` and 2000 as `20.0`, where finance would expect `10.50` and `20.00`. A zero-decimal currency such as JPY stored as 500 would come out as `5.0`. Use `Decimal` with a fixed format, and confirm how non-two-decimal currencies are stored.

7. **Tests cover only the CSV header and one row** (per the docstring). Nothing tests the date window, an upload failure, the exit code, or an empty day. At minimum, the blocker fixes need tests.

8. **Progress logs are never emitted.** No logging is configured, so when cron runs the script the two `log.info` lines are dropped and errors appear as a bare line on stderr with no timestamp. Add `logging.basicConfig(...)` under `__main__`.

## Low

9. `FINANCE_UPLOAD_URL` is read at import time (`export_job.py:16`), so importing the module in tests fails with `KeyError` unless the variable is set. `DATABASE_URL` is read lazily, which is the better pattern.
10. `psycopg2.connect` sits outside the `try` (`export_job.py:49`), so a connection failure is handled differently from every other failure. This goes away once blocker 1 is fixed.
11. CSV files containing customer emails pile up in `/var/exports` with default permissions and no cleanup, and a failed run leaves a partial file behind.
12. A day with no paid invoices uploads a header-only file. Confirm finance wants that rather than no upload.
13. An email beginning with `=`, `+`, `-` or `@` would be treated as a formula if finance opens the CSV in Excel.
14. `fetchall()` loads the whole day into memory, and the file is opened without an explicit `encoding="utf-8"`. Neither is a problem at small volumes.
15. No retry on a transient upload failure. This is acceptable once failures are visible and a day can be re-run.

## Open question

The upload sends no authentication header. If the URL does not carry a token and the endpoint is not restricted to your network, that is a blocker too.

VERDICT: NOT READY
