Harden historical sorter header parsing

The prompts used to arrive at this change since the previous commit

User asked to check the audit log in the current directory before reordering the real mailbox.

Any special observations that may be relevant for version management for this version. Be brief.

The inspected log was a partial real backup run, not a hans audit. Header parsing now skips non-bytes FETCH payloads instead of aborting. verplaats_log.json and plan.md were left unstaged.
This commit is contained in:
2026-07-05 11:48:09 +02:00
parent d0e78e728a
commit edcad4560c
2 changed files with 30 additions and 0 deletions
+4
View File
@@ -85,6 +85,7 @@ Historical sorting:
- Account selection is explicit with `--account <naam>`, for example `--account backup`.
- `--audit` is available in dry-run mode.
- It logs to `verplaats_log.json`, retries IMAP aborts where implemented, and parses FETCH responses defensively.
- Header parsing now guards against non-bytes FETCH payloads in both step 2 and step 3 so a malformed/odd IMAP response is logged as a failed header fetch instead of aborting the whole run.
Folder creation:
@@ -228,6 +229,8 @@ Totaal gepland: 0 | Totaal geen match: 2218 | Totaal overgeslagen: 8219 | Totaal
Treat that as a successful backup historical-sorter run with no immediate recovery work needed.
A later local `verplaats_bestaand.log` in the workspace is not a `hans` audit. It shows a real `backup` execution (`LET OP`, `Account: backup`) that aborted at `INBOX.Bestellingen.PostNL` with `AttributeError: 'int' object has no attribute 'decode'`. The visible partial counters before the crash were 74 folder summaries, 5,921 planned, 5,920 moved, 3,105 no match, 1,765 skipped, and 1 error. Do not treat this log as approval to run the real `hans` mailbox move.
## Verification Commands
Latest local verification included:
@@ -241,6 +244,7 @@ git diff --check
```
After the plain-mode stop wrapper change, `bash -n deploy_vps.sh` was rerun successfully.
After the historical-sorter header guard change, `python3 -m py_compile verplaats_bestaand.py` was rerun successfully.
Useful routing sanity check: