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 031A41FF0AA for ; Tue, 22 Sep 2026 10:57:08 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 741CE214CD; Tue, 22 Sep 2026 10:57:07 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 22 Sep 2026 10:56:59 +0200 Message-Id: Subject: Re: [PATCH proxmox 01/29] add new proxmox-match-expression crate From: "Lukas Wagner" To: "Robert Obkircher" , X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260709115716.299836-1-l.wagner@proxmox.com> <20260709115716.299836-2-l.wagner@proxmox.com> <8541226a-c1de-49b0-8468-b623167cb5b1@proxmox.com> In-Reply-To: <8541226a-c1de-49b0-8468-b623167cb5b1@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1790067419140 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.464 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: 7ASFSAQ2V3N2CF3YO7Q5DRNA6TJY5ZMW X-Message-ID-Hash: 7ASFSAQ2V3N2CF3YO7Q5DRNA6TJY5ZMW 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 X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri Sep 4, 2026 at 2:25 PM CEST, Robert Obkircher wrote: > > On 04.09.26 11:48, Lukas Wagner wrote: >>>> [..] >>>> + pub fn evaluate(&self, data: &D) -> Result, E> { >>>> + let evaluated_expression =3D match self { >>>> + Expression::AllOf(expressions) =3D> { >>>> + if expressions.is_empty() { >>>> + // 'all-of' without any sub-expressions is *not* = a match >>>> + EvaluatedExpressionWithResult { >>>> + expression: EvaluatedExpression::AllOf(Vec::n= ew()), >>>> + matches: false, >>>> + } >>> this probaly does not matter too much as long as it's documented, but >>> intuitively (and based on implementations for all-expressions in=20 >>> other languages like rust and python) i would expect all([]) to evaluat= e to >>> true. >> Yeah, I see where you are coming from, but after some consideration I've >> decided that I'd like to keep it this way. >> >> For non-coders, all([]) being true is not very intuitive, and I'd prefer >> to just say "hey, all combinators eval to false if they have no >> children" in the docs. > > Even non-coders understand why all of my Ferraris are red :) > > Would it be possible to forbid the empty lists entirely? e.g. by > rewriting all([]) to true when someone saves an empty list. > I'm not sure if I'm a fan of automatically rewriting rules, I think this is counter-intuitive for users. But, giving this another thought: - since proxmox-match-expression is supposed to be generic, keep it 'math= matically' correct, so let all([]) eval to true - disallow creating empty all-of/any-of/one-of rules in the UI and API What do you think?