Not ready to merge tomorrow as written. If the export fails, the job still looks like it succeeded to cron. It also writes every customer email into the logs. And the test file its docstring mentions isn't in this folder. None of these is a big fix, so it can still make tomorrow.

## Must fix before merge

**1. Failures are hidden from cron (high).** `export_job.py:56-57` catches every exception, logs one line and exits normally with code 0.
- *Example:* the finance endpoint returns a 500 at 02:00. `raise_for_status()` raises, the `except` logs "export failed" and the process exits 0. Cron and any alerting see a successful run, and finance gets no file for that day.
- *Expected:* a non-zero exit, so the failure gets noticed.
- *Fix:* log with `log.exception(...)` (which keeps the stack trace), then re-raise. Leave the `finally: conn.close()` as it is.

**2. Customer emails are written to the logs (high).** `export_job.py:52` logs `[row[1] for row in rows]`, which is the full list of customer emails, on every run. That puts personal data into wherever your logs go and keep it.
- *Fix:* log only the count and the day.

**3. The tests it relies on aren't here (high for merging).** The docstring says it's "Tested by test_export_job.py", but there's no such file next to it. Even if it exists somewhere else, by that description it only checks the CSV header and one row. Nothing tests `fetch_invoices`, `upload` or `run`, so the two bugs above would get through. Tests to add:
- `run()` exits non-zero (raises) when the upload fails.
- `run()` doesn't log emails.
- The date range passed to the query is `[day, day+1)`.
- `upload` posts the file and raises on a 4xx/5xx response.
- An empty day writes a header-only file. Confirm whether finance actually wants that file.

## Should fix (this PR or a follow-up ticket you name)

**4. No timeout on the upload (medium).** `requests.post` at line 42 has no `timeout`, so a stalled endpoint can hang the job forever. Add something like `timeout=60`.

**5. Amounts are wrong for some currencies (medium).** Line 37 divides every amount by 100 and writes a float.
- *Example:* a JPY invoice of `amount_cents=500` (yen have no minor unit) exports as `5.0`; it should be `500`.
- *Example:* a USD invoice of `1000` exports as `10.0`, not `10.00`.
- If you only have 2-decimal currencies, this is just cosmetic. Otherwise, use `Decimal` with each currency's number of decimal places.

**6. You can't re-run a missed day (medium).** `run()` always exports "yesterday". Once failures are visible (fix 1), someone will need to re-export a specific day. Accept an optional `--day` argument.

**7. "Yesterday" depends on server time zones (medium, please confirm).**
- `date.today()` uses the server's local time zone.
- The comparison against `paid_at` uses the database session's time zone if `paid_at` is a `timestamptz`.
- If those differ from the business day finance expects, invoices paid near midnight end up in the wrong file. Pin the time zone explicitly.

## Minor

- **The upload URL is read when the module is imported.** Line 16 reads `FINANCE_UPLOAD_URL`, so even importing the module (including in tests) fails if it isn't set. Read it inside `run()`/`upload()` or pass it in.
- **Spreadsheet formula risk.** If finance opens the CSV in Excel, an email starting with `=`, `+`, `-` or `@` can run as a formula. Escaping that field is cheap.

The query, the cursor handling and the CSV writing themselves look right.

**What to do:** fixes 1 to 3 plus the timeout (4) are about an hour of work and enough to merge tomorrow. Do 5 to 7 in the same PR if you have time; if not, put them on a named follow-up ticket so the gaps are tracked.

VERDICT: NOT READY
