`export_job.py` is not ready to merge as it stands: a failed export exits as if it succeeded, the upload can hang forever, and customer emails are written to the log. The fixes are small and tomorrow is realistic if the three high-severity items are fixed and the two questions below are answered.

I reviewed by reading only; nothing was run. The docstring names `test_export_job.py`, but that file is not in this folder, so I could not review the tests.

## High severity (fix before merge)

1. **A failed export looks like a success** (`export_job.py:56-57`). The `except Exception` logs one line and the script exits with code 0.
   - **Failing case:** the finance endpoint returns 503 at 02:00. The job logs "export failed: 503 Server Error" and exits 0. Cron reports nothing, finance gets no file, and nobody is alerted.
   - **Expected:** a non-zero exit and a stack trace.
   - **Fix:** use `log.exception(...)` and re-raise, or remove the `except` entirely.

2. **The upload has no timeout** (`export_job.py:42`). `requests.post` waits indefinitely by default. If the endpoint accepts the connection and never answers, the job hangs holding a database connection, and the next night's run starts on top of it.
   - **Fix:** add `timeout=(10, 120)` or similar.

3. **Customer emails are written to the log** (`export_job.py:52`). The line logs every customer's email address for the day. That puts personal data in log storage, and the line grows with the invoice count.
   - **Fix:** log the count only.

## Medium severity

4. **Logging is never configured.** With no `logging.basicConfig`, the `log.info` lines are dropped when the file runs as a script. Only the error line reaches stderr, with no timestamp. A successful run leaves no trace.

5. **"Yesterday" depends on the server's timezone** (`export_job.py:47`). `date.today()` uses the host's local time, and the database compares `paid_at` in its own session timezone. If those differ from finance's business day, invoices near midnight land in the wrong file.

6. **Amount formatting** (`export_job.py:37`). `amount_cents / 100` produces a float:
   - 1000 cents is written as `10.0` and 1050 as `10.5`, not `10.00` and `10.50`.
   - Dividing by 100 is wrong for currencies without two decimal places: 500 JPY would be exported as `5.0`.
   - **Fix:** format with `Decimal`, and use a per-currency exponent if non-two-decimal currencies exist.

7. **No way to re-run a missed day.** The date is fixed inside `run()`. After a failed night, recovering that day's file means editing code.
   - **Fix:** accept an optional date argument. This also makes `run()` testable.

8. **Test coverage is thin.** By the docstring's own description, tests cover only the CSV header and one row. Nothing covers the date window in `fetch_invoices`, an upload failure, or `run()` as a whole. Item 1 is the kind of bug those tests would have caught.

## Low severity

9. `FINANCE_UPLOAD_URL` is read at import (`export_job.py:16`), so importing the module in tests fails without it. `DATABASE_URL` is read inside `run()`; do the same for both.
10. The CSV is written straight to its final path and never deleted. A crash mid-write leaves a partial file, and files with customer emails accumulate in `/var/exports`.
11. `open(path, "w")` has no `encoding="utf-8"`, so non-ASCII emails depend on the host locale.
12. `fetchall()` loads the whole day into memory. This is fine at modest volume, but worth a server-side cursor if days get large.
13. Email values are written unescaped. A value starting with `=` or `@` would be interpreted as a formula if finance opens the file in Excel.
14. A day with zero invoices uploads a header-only file. Confirm finance wants that and not a skipped upload.
15. The upload sends no auth header. This is fine if the URL carries a token or the network is private, but worth confirming.

## Questions for you

- **Timezone (item 5):** which timezone defines finance's "yesterday", and is `paid_at` a `timestamptz`? If the host, the database session and finance all use the same zone, this item drops out.
- **Currencies (item 6):** are any non-two-decimal currencies (JPY, KWD) in `invoices`? If not, only the formatting fix is needed.

VERDICT: NOT READY
