`export_job.py` is not ready to merge as written, but the gap is small: three fixes to how it fails and what it logs, plus tests for them, would get it there — roughly half a day of work.

I reviewed by reading only; nothing was run. `test_export_job.py`, which the docstring names, is not in the working directory, so my view of test coverage comes from the docstring alone. I had no requirements document, so I judged against the docstring: export yesterday's paid invoices to finance every night.

## Must fix before merge

**1. A failed export exits as if it succeeded (high).**
`run()` catches every exception at lines 56-57, logs one line and returns, so the process exits with code 0.
- **Concrete case:** the finance endpoint returns 503 at 02:00. `raise_for_status()` raises, the job logs `export failed: 503 Server Error...` and exits 0. Cron and any exit-code monitoring see success, and finance has no file for that day.
- **Expected:** a non-zero exit and a stack trace.
- **Fix:** use `log.exception(...)` and re-raise, or `sys.exit(1)`.

**2. The upload has no timeout (high).**
`requests.post` at line 42 has no `timeout`, and `requests` waits forever by default.
- **Concrete case:** the endpoint accepts the connection and never responds. The job hangs indefinitely, holding its database connection open, and never reaches the error path.
- **Fix:** add `timeout=(10, 120)` or similar.

**3. Customer emails are written to the log (high, privacy).**
Line 52 logs the full list of `customer_email` values for every run.
- **Current state:** the script never configures logging, so today this INFO line is dropped. The emails land in log files the moment anyone adds `logging.basicConfig` or imports this from a configured app.
- **Fix:** log the count and the day only.

**4. Tests cover only the CSV header and one row (high against your own standards).**
By the docstring, nothing tests the date window in the query, a failed upload, the exit behaviour of `run()`, or amount formatting. Fixes 1-3 should each land with a test.

## Should fix, can follow shortly after

**5. A missed day cannot be re-run (medium).**
The day is hardcoded as yesterday at line 47. After any failed night, the only recovery is editing code or exporting by hand. Take an optional `--date` argument.

**6. Amounts are formatted inconsistently (medium).**
Line 37 does `amount_cents / 100`, which gives a float.
- **Concrete case:** 1000 cents is written as `10.0`, 10 cents as `0.1`, 1999 cents as `19.99`.
- **Expected:** `10.00`, `0.10`, `19.99`.
- **Fix:** format with `Decimal` or integer arithmetic. A NULL `amount_cents` would also crash the whole export.

**7. No success or failure logging reaches anyone when run from cron (medium).**
With no logging configuration under `__main__`, both INFO lines are dropped. Only the bare error message reaches stderr. Add `logging.basicConfig(level=logging.INFO)` in the `__main__` block, after fixing item 3.

**8. Importing the module requires `FINANCE_UPLOAD_URL` (low).**
Line 16 reads the environment at import time, so any test that imports the module fails with `KeyError` unless the variable is set. Read it inside `upload()` or `run()`.

**9. A failed run leaves a partial CSV, and files are never cleaned up (low).**
The file is written directly to its final path in `/var/exports`. These files contain customer emails and accumulate with no retention.

## Speculative: depends on facts I cannot see

- **Time zones:** "yesterday" comes from the cron host's local clock, while the `paid_at` comparison uses the database session's time zone. If these differ, invoices near midnight land in the wrong day's file.
- **Non-two-decimal currencies:** dividing by 100 is wrong for currencies such as JPY, if you bill in any.
- **Upload authentication:** the POST sends no credentials. That is fine only if the URL carries a token or the network restricts access.
- **Double ingestion:** re-running a day uploads the file again. Whether finance's endpoint deduplicates is unknown.
- **Spreadsheet formula injection:** an email beginning with `=` or `+` would be treated as a formula if finance opens the CSV in Excel.
- **Memory:** `fetchall()` loads the whole day at once, which only matters at very high daily volume.

## What is sound

The query is parameterised, the half-open date window (`>=` start, `<` end) avoids double-counting across days, the connection is always closed, and the functions are small and separately testable.

VERDICT: NOT READY
