Skip to content

Support the deliveredto operator natively - #469

Merged
mbrt merged 1 commit into
masterfrom
feature/377
Sep 26, 2026
Merged

mbrt merged 1 commit into
masterfrom
feature/377

Conversation

@mbrt

@mbrt mbrt commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Gmail's deliveredto: operator matches the Delivered-To header, which makes it possible to filter on + aliases (me+tag@gmail.com) and on mail coming from forwarding services such as SimpleLogin, regardless of the recipients in To. Until now it was only reachable through query, e.g.:

{ query: 'deliveredto:%s' % std.escapeStringJson(alias) }

A native deliveredto field, which works like replyto and list, does better than a query in three ways:

  • Multiple addresses are grouped into a single operator.
  • Rules using it can be covered by gmailctl test, which rejects query because it can't know what an arbitrary query matches.
  • Values are quoted by the same logic as all the other operators, instead of relying on JSON escaping.

Gmail's filter UI has no field for deliveredto, but the same is true for cc, bcc, replyto and list, which are already supported natively for the same reasons.

The new function is placed right after replyto, which doesn't change the relative order of the existing functions, so the generated queries for existing configs stay the same.

Close #377.

Gmail's `deliveredto:` operator matches the Delivered-To header, which
makes it possible to filter on `+` aliases (me+tag@gmail.com) and on
mail coming from forwarding services such as SimpleLogin, regardless of
the recipients in To. Until now it was only reachable through `query`,
e.g.:

    { query: 'deliveredto:%s' % std.escapeStringJson(alias) }

A native `deliveredto` field, which works like `replyto` and `list`,
does better than a `query` in three ways:

- Multiple addresses are grouped into a single operator.
- Rules using it can be covered by `gmailctl test`, which rejects
  `query` because it can't know what an arbitrary query matches.
- Values are quoted by the same logic as all the other operators,
  instead of relying on JSON escaping.

Gmail's filter UI has no field for `deliveredto`, but the same is true
for cc, bcc, replyto and list, which are already supported natively
for the same reasons.

The new function is placed right after replyto, which doesn't change
the relative order of the existing functions, so the generated queries
for existing configs stay the same.

Close #377.
@mbrt mbrt added the kind/feature New feature or request label Sep 26, 2026
@codecov

codecov Bot commented Sep 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.94%. Comparing base (87e72a5) to head (dfbf915).

Files with missing lines Patch % Lines
internal/engine/parser/ast.go 0.00% 2 Missing ⚠️
internal/engine/parser/parser.go 0.00% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (69.23%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #469      +/-   ##
==========================================
+ Coverage   41.86%   41.94%   +0.08%     
==========================================
  Files          54       54              
  Lines        3698     3710      +12     
==========================================
+ Hits         1548     1556       +8     
- Misses       2049     2053       +4     
  Partials      101      101              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mbrt
mbrt merged commit 9cf4f0b into master Sep 26, 2026
4 of 5 checks passed
@mbrt
mbrt deleted the feature/377 branch September 26, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support deliveredto rule

1 participant