I wouldn't merge this tomorrow. There are three serious problems: when the job fails it still reports success to cron, it writes every customer's email address into the logs, and the test file the docstring mentions doesn't exist. None of these is a big fix, so if you do them tomorrow morning plus a small test suite, merging later the same day is realistic.

## High severity (must fix before merge)

1. **Failures are hidden, so nobody finds out the export didn't happen.** `export_job.py:56-57` catches every exception, logs one line and returns normally. The process exits with code 0, so cron and any monitoring treat the run as a success.
   *Example:* the finance endpoint returns 500 → `raise_for_status()` raises → the error is logged → exit code 0. Finance gets no file and no alert fires. The right outcome is a non-zero exit (or an alert).
   *Fix:* log with `log.exception(...)` and then re-raise, or remove the try/except and keep only the `finally`.

2. **Customer emails go into the logs.** `export_job.py:52` logs `[row[1] for row in rows]`, the full list of customer emails, every night. That is personal data leaking into log storage, which usually has wider access and longer retention than the database.
   *Fix:* log only the count.

3. **There are no tests.** The docstring says the job is "Tested by test_export_job.py", but that file isn't in the directory. Even as described, it would only cover the CSV header and one row. Nothing tests the failure path, the date window or the money formatting.

## Medium severity (should fix before merge)

4. **Money is written as floats, so the format varies.** `amount_cents / 100` (line 37) turns 1050 into `10.5`, 100 into `1.0` and 5 into `0.05`. Finance would expect `10.50`, `1.00` and `0.05`. Float division can also produce values like `0.30000000000000004` in other arithmetic.
   *Fix:* use `Decimal(amount_cents) / 100` formatted with 2 decimal places, or integer math `f"{c // 100}.{c % 100:02d}"`. Watch negative amounts (refunds) if they can occur.

5. **The upload has no timeout.** `requests.post` on line 42 waits forever if the endpoint hangs, and the next night's cron run can then overlap it.
   *Fix:* add something like `timeout=(10, 120)`.

6. **The date window depends on the server's timezone.** `date.today()` uses the server's local timezone, and the database compares `paid_at` against a bare date using its own session timezone. If the two disagree, invoices near midnight land in the wrong day's file or are skipped. Decide which timezone counts as a finance day and make it explicit, for example UTC timestamps in the query.

7. **A failed night can't be re-run.** The day is hard-coded to "yesterday" (line 47). After an outage, you can't export a specific date without editing the code.
   *Fix:* accept an optional date argument that defaults to yesterday.

## Low severity (fine as follow-ups)

8. `UPLOAD_URL` is read when the module is imported (line 16), so importing it without that environment variable crashes. That is also what makes it hard to test. Read it inside `run()` or pass it in.
9. Logging is never configured under `__main__`, so the `log.info` lines (including "export finished") are never printed. Only warnings and errors reach stderr.
10. The CSV is written straight to its final path. A crash part-way leaves a partial file. Write to a temp file and rename.
11. `EXPORT_DIR` is hard-coded to `/var/exports`. Make it configurable, like the other settings.

## Tests to add with the fixes
- A CSV row check that covers amounts like 1050, 100 and 5.
- A failed upload leads to a non-zero exit or the exception propagating.
- The query gets the right start and end for a given date.
- The log output contains no email addresses.

These can use a fake connection and a mocked `requests.post`, so they don't need a real database.

VERDICT: NOT READY
