-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does gmailctl split this kind of "or" filter into separate rules? #372
Comments
Big filters make Gmail flaky (i.e. filters get applied inconsistently). This doesn't happen if you split them up into multiple filters. Gmailctl does this aggressively to prevent the problem. Re bloating/obfuscating: Anything non-trivial is almost impossible to understand from the Gmail settings UI. This was one of my main motivations for starting the project. I don't think that keeping filters from splitting will make it any more clear. |
What about some hint I could add to a rule config to request not splitting, or some heuristic to not split tiny rules? I understand it's a good safe default but for these cases it actually makes my filters much much harder to read and reason about in practice, if understandability in the Gmail settings UI is a motivating factor. |
I'm trying to keep gmailctl as simple as possible, so I don't normally add options if not strictly necessary. The only one we have right now is It's my experience that people ask for features when they first use the project thinking they will need them, but then later on they actually don't use them. This is also the first time it was asked, so I'm double reluctant. Would it be possible for you to keep this on your fork for a few months and see whether it's actually what you want and makes the usability better? I'm open to discussing implementation afterwards. Glancing at your PR, it seems easy enough and going in the right direction. |
Thanks, absolutely! Agreed about simplicity, and I wouldn't want to add a weird option on a whim if we'd end up regretting the mechanics or naming of it. That override scratches my itch but does feel a little hacky. I honestly feel like some heuristics to automatically avoid splitting some trivial cases would be better. Would you be up for having a little more discussion here about the mechanics of it and seeing if we can come up with something better to merge? I could also share some more specifics about my use cases and why this type of split has been getting so annoying, if it helps. |
Oh yes, sure! I'm all in for making the heuristics better. |
Great, so to start somewhere concrete: whatever heuristics we ended up with, would you be fine if it that example I gave in the issue description didn't split? In changing the behavior it's also worth considering that existing users might see confusing extra diffs next time they apply changes after updating. That's probably not worth worrying about too much but might warrant some note in the documentation or something, recommending to check |
Yes, I think it's fine to not split your example.
It's precisely my worry, but we did change the logic a bit in the past, so it would be fine if things don't get too confusing.
Uhm, yes minimizing diffs sounds also nice, but I wonder how complicated that would be. It requires potentially splitting filters up at the time we do the diff (rather than earlier). We currently just do a best effort similarity match to minimize diffs, but perhaps we can add logic to that. |
Okay great, so as a start I'd propose to not split a filter that's <10 query terms and <100 values, or some numbers in that ballpark. For example:
That should split most items that are either computationally heavy or visually awful to read. WDYT? |
If the goal is clarity, there are a few more things to consider: The filter criteria itself is not a single query string. It's represented in Gmail as this object, which maps nicely to what you see in the settings UI. A filter like {
"query": "{from:a subject:b}"
} or by two simpler filters: {
"from": "a"
} {
"subject": "b"
} Additionally, we are already grouping filters of this type: I'm not sure that the first version is more clear than the second to be honest. Keeping things together until they become too large may not give the best results, because everything is dumped into the |
Right, for these heuristics I'm talking about, I'm talking in terms of the final Gmail filter syntax, and it might be a little subjective how some counting gets applied. I'm not claiming that one trivial CasesOne aspect that gets annoying is when it's splitting across multiple dimensions, so that one gmailctl rule like this: {
filter: { or: [{ from: 'a' }, { subject: 'b' }] },
actions: { labels: ['X', 'Y'] },
} gets split into four Gmail filters instead of two:
Another scenario making the splits seem really unmaintainable in practice is where I've found mailing list emails surprisingly hard to filter and made a compound helper for them.
than to have them automatically split along arbitrary structural dimensions into
Impacts of splittingBesides just making the list of gmail filters hard to directly skim through and understand, there are two aspects that get extra frustrating when there are too many splits:
|
I understand what you mean with "annoying splitting across arbitrary dimensions". Some more information to chew on:
After a certain size I found any interaction with the Gmail settings web UI just too hard. This is really why gmailctl was born. It's because understanding and managing filters that way was just a lost cause for me. I'm not really sure the changes you're proposing will make it a lot easier TBH. You will still end up with large filters and finding them in the UI will be hard. |
It's redundant, already implied as part of "to" per mbrt/gmailctl#372 (comment).
Thanks, that helps a good deal actually. Just removing the redundant It looks like the Still, I feel like avoiding frivolous splits based on some heuristics can't hurt much even if it doesn't help hugely either. Is the concern about adding complexity to the project or something about making user experience more complicated? |
Correct.
Yes, I believe this shouldn't be too hard to implement.
I wanted to make sure this wasn't an XY problem. I also would like to keep the behavior as consistent as possible, as any changes there will generate diffs for many existing users. I think it's fine not to split small filters, although I don't know what the right limit would be. I would set the limit small though. BTW, is there anything we could do to improve the visibility of the debug command, or perhaps a way to integrate it better with the diff? |
Absolutely, I didn't realize the debug command existed until you mentioned it, then saw there was a single mention of it in the README. In general just sprinkling around a few pointers to it in related commands/workflows might've helped, and I might also suggest renaming it (to something like For this issue on splitting, I'm happy to give it some time and decide later what to change if anything. The especially frivolous splits still very much annoy me but we probably wouldn't want to rush into any disruptive behavior change. |
Sounds good, thanks! If you have any concrete improvements on Not sure whether I would keep both for a few releases (+ warning) and then delete |
This issue is stale because it has been open for 30 days without activity. |
(I'm late to the party, but my 2c:) I recently ran up to the 1000-filters limit in Gmail, and I found that part of that was because of the kind of filter-splitting that this issue is describing. If my (Ack that I am almost definitely an extreme edge case.) |
@jameskoh oh that's interesting. I wasn't aware of limits in the number of filters. You're the first one I hear hitting that BTW. I guess we can reopen this, even though I don't know yet of a good heuristic for when to avoid splitting. Perhaps the only one is #372 (comment), i.e. avoid splitting tiny rules. |
I've noticed gmailctl likes to split some "or" conditions into separate filters where I would've expected a single Gmail filter. It's a cosmetic thing, but affects a lot of my filter rules and ends up bloating/obfuscating my Gmail filters list quite a bit in practice.
For example:
Will produce:
instead of a single query
list:list1.example.com OR cc:list1@example.com
.Is there a reason for that?
The text was updated successfully, but these errors were encountered: