Not yet, but the blocking fixes are small and could be done today. The two that matter most: when the job fails it hides the failure, and it writes every customer's email address into the logs. The tests the file mentions also don't exist.

## Blocking (fix before merge)

**1. Failures are silent** (`export_job.py:56-57`). The `except` block logs the error and carries on, so the process exits with status 0. Cron reports success and nobody gets alerted.
- Example: the finance endpoint returns a 500 and `raise_for_status()` raises. The job logs "export failed" and exits 0. Finance gets no file for that day, and the first anyone hears of it is when finance asks.
- Fix: log with `log.exception(...)`, then re-raise (or `sys.exit(1)`) so cron and monitoring see the failure.

**2. Customer emails go into the logs** (`export_job.py:52`). `[row[1] for row in rows]` puts every paying customer's email address into the log every night. Logs are usually kept longer and seen by more people than the database, so this is a data-protection problem.
- Example: 3,000 invoices means 3,000 email addresses in one log line.
- Fix: log only the count and the day. Log invoice IDs if you need to trace something.

**3. No tests.** The docstring says the job is "Tested by test_export_job.py", but that file isn't in this directory. Even as described (CSV header and one row), it wouldn't cover the parts that carry risk. At a minimum, add tests for:
- An upload failure makes `run()` exit with an error.
- Zero invoices (decide on purpose whether an empty file gets uploaded).
- The day window: an invoice paid at 23:59:59 is included and one paid at 00:00:00 the next day is not.
- Amount formatting (see item 4).
- The log output doesn't contain email addresses.

To make `run()` testable without a real database and network, pass the date and connection in, or inject them. Move `UPLOAD_URL` out of import time: right now importing the module without `FINANCE_UPLOAD_URL` set crashes with `KeyError`, which is probably why tests are awkward to write.

## Should fix (could follow quickly, but say so in the PR)

**4. Money is converted with a float, ignoring currency** (`export_job.py:37`). `amount_cents / 100` gives `1.0` for 100 and `0.05` for 5, so the number of decimal places changes from row to row. It also assumes every currency has 2 decimal places. A JPY invoice of 500 comes out as `5.0` instead of `500`, and KWD and BHD use 3 decimal places. Use `Decimal` and a per-currency decimal-place lookup, or ask finance whether they'd rather have cents.

**5. "Yesterday" depends on the server's timezone** (`export_job.py:47`, `:28`). `date.today()` uses the cron host's local timezone. `paid_at >= date` uses the database session's timezone. If the two differ, or across a daylight-saving change, invoices can land in the wrong day's file or be missed entirely. Pick one timezone (probably UTC, or whatever finance books in) and pass it explicitly. I couldn't check this one: I can't see the type of `paid_at`.

**6. The upload has no timeout** (`export_job.py:42`). If the finance endpoint stops responding, `requests.post` waits forever and the job never finishes. Add something like `timeout=(5, 60)`, and consider one or two retries.

## Minor

**7. You can't rerun a past day.** The date is always "yesterday", so if Tuesday's run fails you can't export Monday's invoices again without editing the code. Add an optional date argument. Check whether the finance endpoint handles a re-upload safely.

**8. The CSV stays on disk.** Files in `/var/exports` contain email addresses, use default file permissions, and are never cleaned up. Restrict the permissions and either delete the file after a successful upload or set a retention period.

**9. `fetchall()` loads the whole day's invoices into memory.** That's fine at daily invoice volumes. Only worth revisiting if volume grows a lot.

## What's fine

The query is parameterised, so there's no SQL injection risk. The connection is always closed. The code is split into small, readable functions.

Items 1–3 are each well under an hour of work. If those are done tomorrow and items 4–6 are tracked as follow-ups with a named owner, merging is reasonable. As the file stands now, it isn't.

VERDICT: NOT READY
