afewmail / afew

an initial tagging script for notmuch mail
ISC License
325 stars 99 forks source link

dry-run doesn't show what's going to happen due to querying the database consecutively after rules are applied #349

Open Rutherther opened 1 month ago

Rutherther commented 1 month ago

Hi,

I've encountered an issue that led me to something that might be classified as a bug. I had a rule for folder:spam, to mark it with spam tag, but I put it only after InboxFilter rule. Since InboxFilter rule gets executed first, and removes new tag, afew --new will not match the spam rule anymore, because the mail is not tagged new at that point anymore. This is due to the consecutive nature of the queries.

I've first tried using --dry-run, and I noticed that it actually tells me it will assign the message spam filter. But it's not what happens. This is, I suspect, because with --dry-run the operations do not happen, so the message still has tag:new, but when it actually runs, the tag is first removed, and only then the .

Is this intended behavior? I would expect dry run to show me what will happen if ran without --dry-run, but it is not the case.

Of course it's probably not going to be easy to solve this. Is it intended that due to this consecutive nature my spam was not marked spam, because it was after InboxFilter?