Add decisions-based mailing list routing
The prompts used to arrive at this change since the previous commit User said that in the future they will run scripts themselves when instructed, then asked to take the next step after the decisions.json mailing-list routing report and plan. Any special observations that may be relevant for version management for this version. Be brief. Added mailinglist_routes.json as the normalized runtime policy and wired mail_routes.py to use it before legacy domain routes. No mailbox-affecting scripts were run; validation was local only.
This commit is contained in:
@@ -14,7 +14,9 @@ Purpose: interpret `decisions.json` as the user intent for mailing-list handling
|
||||
- `a` ("afmelden"): 89 entries, 2,683 messages.
|
||||
- `s`: 1 entry, 26 messages.
|
||||
|
||||
The current sorter does not read `decisions.json`. It only reads the hardcoded routes in `mail_routes.py`. Therefore these decisions are currently advisory data, not active routing behavior.
|
||||
The sorter still does not read `decisions.json` directly. The decisions have been normalized into `mailinglist_routes.json`, which is now loaded by `mail_routes.py` for routing and destination-folder generation.
|
||||
|
||||
The normalized policy contains 153 grouped rules and covers every key in `decisions.json` through `source_decision_keys`.
|
||||
|
||||
## Interpretation
|
||||
|
||||
@@ -247,21 +249,21 @@ These decisions conflict with the current hardcoded route table or expose incomp
|
||||
|
||||
## Plan To Add This Structure
|
||||
|
||||
1. Introduce a structured policy file generated from `decisions.json`.
|
||||
1. Introduce a structured policy file generated from `decisions.json`. Done.
|
||||
- Suggested file: `mailinglist_routes.json`.
|
||||
- Fields: `action`, `mailbox`, `domains`, `sender_patterns`, `list_id_patterns`, `source_decision_keys`, `notes`.
|
||||
- Fields: `action`, `mailbox`, `domains`, `from_contains`, `source_decision_keys`, `notes`.
|
||||
- Do not make `decisions.json` itself the runtime file; it contains unsubscribe URLs and analysis artifacts.
|
||||
|
||||
2. Extend `mail_routes.py` to load mailing-list policy.
|
||||
2. Extend `mail_routes.py` to load mailing-list policy. Done for domain and `From` substring matching.
|
||||
- Keep `DOMAIN_ROUTES` for stable functional/business mail.
|
||||
- Add a runtime lookup for generated mailing-list rules.
|
||||
- Support domain matching, exact sender address matching, display-name matching, and List-ID/header matching.
|
||||
|
||||
3. Add `Afmelden` to destination folder creation.
|
||||
3. Add `Afmelden` to destination folder creation. Done through `destination_folders()`.
|
||||
- `maak_mappen.py` should create all `INBOX.Afmelden.*` folders from the generated policy.
|
||||
- Existing `destination_folders()` should include both functional keep folders and unsubscribe review folders.
|
||||
|
||||
4. Update routing precedence.
|
||||
4. Update routing precedence. Done for invoice, mailing-list policy, then legacy domain fallback.
|
||||
- Invoice keyword routing should remain first.
|
||||
- Exact/list-specific mailing-list rules should run before broad domain rules, especially for shared senders such as `substack.com`.
|
||||
- Domain rules should remain the fallback for normal service/vendor mail.
|
||||
@@ -280,4 +282,3 @@ These decisions conflict with the current hardcoded route table or expose incomp
|
||||
- Run dry-run sorter on backup.
|
||||
- Review planned moves.
|
||||
- Run actual sorter only after explicit confirmation.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user