From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 0C6951FF0AB for ; Wed, 23 Sep 2026 14:40:51 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7D4BB21487; Wed, 23 Sep 2026 14:40:50 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 23 Sep 2026 14:40:46 +0200 Message-Id: Subject: Re: [PATCH proxmox 11/29] notify: matcher: add expression support From: "Lukas Wagner" To: "Arthur Bied-Charreton" , "Lukas Wagner" X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260709115716.299836-1-l.wagner@proxmox.com> <20260709115716.299836-12-l.wagner@proxmox.com> In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1790167246971 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.457 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 6FMF366KZJY2OYZLV4NE7YDS36I63N4I X-Message-ID-Hash: 6FMF366KZJY2OYZLV4NE7YDS36I63N4I X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pbs-devel@lists.proxmox.com, pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri Jul 24, 2026 at 8:59 AM CEST, Arthur Bied-Charreton wrote: > On Thu, Jul 09, 2026 at 01:56:58PM +0200, Lukas Wagner wrote: >> This commit adds support for the new 'expression' parameter in the >> matcher configuration. It contains a JSON-serialized match expression >> (based on the new proxmox-match-expression crate). It is intended as a >> replacement for the existing match-field, match-calendar, >> match-severity, mode and invert-match keys. >>=20 >> The match expression implements a strict superset of the existing >> configuration keys, any existing configuration can be converted into >> an expression. >>=20 >> Expressions lift some of limitations of the old approach, namely they >> allow arbitrary nesting of match rules and combinators. >>=20 >> The following expressions are supported >> - all-of (corresponds to the former mode 'all') >> - any-of (corresponds to the former mode 'any') >> - one-of (new) >> - not (corresponds to former 'invert-match') >> - match-calendar (unchanged) >> - match-field (unchanged) >> - match-severity (unchanged) >>=20 >> The combinators all-of, any-of and one-of support an arbitrary number of >> child expressions (where each child can be a combinator, not, or a >> match-* expression). >>=20 >> Internally, existing, 'old-style' matchers are converted on the fly to >> expressions, meaning there is only a single code path for the matching >> logic. If any matcher has any of the old configuration keys and the new >> expression set, the old keys will be ignored and a warning will be >> logged. >>=20 >> Signed-off-by: Lukas Wagner > one general thing i noticed while testing: it would be really useful to > know which matchers matched a notification. right now the only log > message you get is "notified via target {target}". such a change might > be a better fit in the notification history you have planned though. Good idea; this is simple and useful enough to add right away. I will include a patch in v2. > another idea (bit more involved ^^): being able to construct test > notifications in the UI and showing a list of matching matchers.=20 Yeah, I've had the idea of having more sophisticated test notifications before, but this is quite a big task I'm afraid, so this would better be suited for a future series. > > (not particularly relevant to this specific patch, just thought about > this while reading it) >> --- >> Cargo.toml | 1 + >> proxmox-notify/Cargo.toml | 2 + >> proxmox-notify/src/matcher/expression.rs | 84 ++++++++++++++ >> proxmox-notify/src/matcher/field.rs | 31 +++-- >> proxmox-notify/src/matcher/mod.rs | 142 +++++++++++++---------- >> proxmox-notify/src/matcher/severity.rs | 6 +- >> 6 files changed, 185 insertions(+), 81 deletions(-) >> create mode 100644 proxmox-notify/src/matcher/expression.rs >>=20 > [...]