I don't think it's ready to merge tomorrow. Three things block it. If the export fails, cron is still told it succeeded, so nobody hears about it. Every run writes all customer emails to the log. And amounts go through floating point, which breaks the format for some values and is wrong for currencies that don't use cents. The overall structure is good: small functions, a parameterised query, and the connection is always closed. So the fixes are mostly local.

I couldn't check the tests. The docstring points to `test_export_job.py`, but that file isn't in this directory.

## Blocking

**1. Failures are hidden from cron** (`export_job.py:56-57`)
`except Exception` logs the error and then `run()` returns normally, so the process exits with code 0.
- Example: finance's endpoint returns a 500. `raise_for_status()` raises, the job logs one line and exits 0. Finance gets no file, and cron and any alerting report success.
- Expected: a non-zero exit. Fix: use `log.exception(...)` (it keeps the traceback) followed by `raise`, or drop the `except` entirely.

**2. Customer emails are logged on every run** (`export_job.py:52`)
`[row[1] for row in rows]` writes every customer's email address into the logs every night. That's personal data in a place with wider access and longer retention than the database. Log the count only, or invoice IDs if you need traceability.

**3. Amounts use float division and assume every currency has cents** (`export_job.py:37`)
`amount_cents / 100` gives a Python float, which causes two problems:
- **Format:** 1000 cents comes out as `10.0`, not `10.00`. Finance tools may reject it or misread it.
- **Wrong currency scale:** a ¥500 invoice, if stored as 500, exports as `5.0`. Some currencies, like KWD, use three decimal places.
- Fix: use `Decimal(amount_cents) / 100` with an explicit per-currency scale, or export the integer cents and let finance divide.

## High

**4. "Yesterday" depends on two different clocks** (`export_job.py:47`, `:28`)
`date.today()` uses the server's local timezone. The `paid_at >= date` comparison uses the database session's timezone. If they differ, invoices paid near midnight end up in the wrong day's file or in no file.
- Example: the server runs in UTC and the DB session is in `America/New_York`. An invoice paid at 23:30 New York time is missing from that night's export.
- Fix: pick one timezone (say UTC), compute explicit start and end timestamps in it, and pass them to the query.

**5. Tests are missing or too thin.** The test file isn't here. Going by the docstring, it covers only "CSV header and one row". None of these paths is tested:
- an upload failure exits non-zero
- amount formatting for 1000 cents and for a zero-decimal currency
- the day boundaries
- a day with no invoices

Items 1, 3 and 4 would each have been caught by one test.

## Medium

**6. The upload has no timeout** (`export_job.py:42`)
If the endpoint hangs, the job hangs with it, possibly until the next night's run starts on top of it. Add something like `timeout=(5, 60)`.

**7. You can't re-run a missed day.** The day is hard-coded to yesterday. If Tuesday's upload fails, the only way to resend it is to edit the code. Accept an optional `--date` argument.

**8. Importing the module fails without the upload URL set** (`export_job.py:16`)
`os.environ["FINANCE_UPLOAD_URL"]` runs when the module loads, so importing it in a test or REPL without that variable raises `KeyError`. Read it inside `upload()` or `run()`, the same way `DATABASE_URL` is read.

**9. Logging is never configured.** Nothing calls `logging.basicConfig`, so under cron both `log.info` lines are dropped: Python's default only shows warnings and above. You'd have no record of successful runs. Configure logging in the `__main__` block.

## Low

**10. Spreadsheet formula injection.** A customer email such as `=HYPERLINK(...)` would run as a formula if finance opens the CSV in Excel. Prefix any cell starting with `= + - @` with a `'`.

**11. Failed runs leave half-written files.** If the job fails partway through writing, a partial `invoices-<day>.csv` stays in `/var/exports`. Write to a temp file and rename it when done.

**12. The export directory is hard-coded and assumed to exist** (`export_job.py:15`). Make it configurable and create it if it's missing.

**13. Days with no invoices upload a header-only file.** That may be what you want. Confirm finance expects it rather than no upload at all.

**14. Minor style points:**
- `psycopg2.connect` sits outside the `try`. That's fine as it stands, but it will matter once item 1 is fixed.
- The functions have no docstrings.

VERDICT: NOT READY
