The job isn't ready to merge tomorrow. It's small, but three things block it: it hides its own failures, it writes customer emails into the logs, and the test file its docstring mentions doesn't exist. The good news is that each fix is small, so a day is enough if you start with the blockers.

## Blockers

**1. Failures are hidden, so finance silently gets no file** (`export_job.py:56-57`)
`run()` catches every exception, logs one line and returns normally, so cron sees exit code 0. For example: the finance endpoint returns a 500, `raise_for_status()` raises, the job logs `export failed: 500 Server Error` and exits 0. Nobody is alerted and that day's invoices never arrive. The log line also drops the stack trace.
*Fix:* use `log.exception(...)` and then `raise`, or `sys.exit(1)`, so cron and monitoring see the failure.

**2. Customer emails are written to the logs** (`export_job.py:52`)
The info log prints the full list of `customer_email` values. On a day with 500 invoices, that's 500 emails in the log system, which usually has wider access and longer retention than the database.
*Fix:* log only the count and the date.

**3. There are no tests** (`export_job.py:3`)
The docstring says the job is "Tested by test_export_job.py", but that file isn't in the directory. Even as described, it would only cover the header and one row. Untested paths include: no invoices, a failed upload, a failed database call, amount formatting, and the date window.
*Fix:* add the tests (see the list at the end). Fixing item 6 first makes this much easier.

## Should fix before merge

**4. Amounts use floating point and lose their formatting** (`export_job.py:37`)
`amount_cents / 100` produces a float. So 1050 becomes `10.5` instead of `10.50`, and 100 becomes `1.0`. Currencies without cents break completely: if JPY is stored as 500, it's exported as `5.0`.
*Fix:* `Decimal(amount_cents) / 100`, quantized to two places. Use a per-currency exponent if you support JPY or similar currencies.

**5. The upload has no timeout** (`export_job.py:42`)
If the endpoint accepts the connection but never responds, `requests.post` waits forever. The 02:00 job hangs, and the next night's run can pile up behind it.
*Fix:* `timeout=(5, 60)` or similar. Consider one or two retries.

**6. A missing setting crashes the import** (`export_job.py:16`)
`os.environ["FINANCE_UPLOAD_URL"]` runs when the module is imported. Without that variable the import itself fails with `KeyError`, which also breaks any test that imports the module.
*Fix:* read both env vars inside `run()` and pass them in.

**7. "Yesterday" depends on the server's time zone** (`export_job.py:47`, query on line 21)
`date.today()` uses the server's local time zone. Postgres then compares the bare date against `paid_at` using the database session's time zone. If those differ from the time zone finance uses for its books, invoices near midnight land on the wrong day. I couldn't check the schema, so I don't know whether `paid_at` is `timestamptz`.
*Fix:* compute the window explicitly in one named time zone (e.g. UTC) and pass timezone-aware datetimes to the query.

## Minor (fine as follow-ups)

- **No way to re-run a missed day.** The date is always yesterday. Accepting an optional `--date` argument would allow backfills.
- **A failed run can leave a partial file.** The CSV is written straight to its final path. Write to a temp file and rename it into place.
- **CSV files with customer emails are never cleaned up.** Files in `/var/exports` stay forever with default permissions. Decide on a retention period and access rights.

## Tests to add

- Happy path: rows go into the CSV with the correct header, and the upload is called.
- No invoices: decide whether to upload a header-only file or skip, and test that choice.
- Upload returns 500 or times out: the job exits with an error (not 0).
- Database error: the job exits with an error and the connection is closed.
- Amounts: 1050 → `10.50`, 100 → `1.00`, plus a JPY case if relevant.
- Date window: an invoice paid at 23:59:59 and one at 00:00:00 land on the correct days.
- Logs: no email addresses appear in log output.

VERDICT: NOT READY
