From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 10F8C1FF0AB for ; Wed, 07 Oct 2026 11:32:58 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 9CF24213C7; Wed, 07 Oct 2026 11:32:53 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Wed, 07 Oct 2026 11:32:45 +0200 Message-Id: From: =?utf-8?q?Michael_K=C3=B6ppl?= To: "Lukas Wagner" , , Subject: Re: [PATCH proxmox-widget-toolkit v2 19/34] notifications: matcher: add support for match expressions Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 X-Mailer: aerc 0.22.0 References: <20261001083706.144246-1-l.wagner@proxmox.com> <20261001083706.144246-20-l.wagner@proxmox.com> In-Reply-To: <20261001083706.144246-20-l.wagner@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791365565971 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.152 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) POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes 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: AIH57XSEELQFMRQ6OOPNRBBLM3ZW7WIO X-Message-ID-Hash: AIH57XSEELQFMRQ6OOPNRBBLM3ZW7WIO X-MailFrom: m.koeppl@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 Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu Oct 1, 2026 at 10:36 AM CEST, Lukas Wagner wrote: [snip] > + case 'one-of': > + { > + let children =3D []; > + for (let child of value) { > + children.push(visit(child)); > + } > + ret =3D { > + type: key, > + data: {}, > + children, > + leaf: false, > + }; > + } > + break; > + case 'not': > + { > + let child =3D visit(value); > + ret =3D { > + ...child, > + invert: true, Shouldn't this be `invert: !child.invert`? Because right now, this will remove any negations already in an expression. If I add an expression as follows: pvesh create /cluster/notifications/matchers \ --name double-not \ --target mail-to-root \ --disable 1 --expression '{"not":{"not":{"match":{"type":"severity","severities":["in= fo"]}}}}' the PVE UI displays this as "Severity: all except info". When I then edit e.g. the comment and save it, the expression does not match what I originally created anymore. The result is then: pvesh get /cluster/notifications/matchers/test-double-not --output-format j= son-pretty { "comment" : "test", "digest" : "1d9913fd302f057e7749d88bad0dd3c8f567e5e6315e2e1e885d532102c6= 93ab", "disable" : 1, "expression" : "{\"not\":{\"match\":{\"type\":\"severity\",\"severities\= ":[\"info\"]}}}", "name" : "test-double-not", "origin" : "user-created", "target" : [ "mail-to-root" ] } Similarly, `{"not":{"constant":false}}` becomes `{"constant":false}`. > + }; > + } > + break; > + case 'constant': { > + ret =3D { > + type: 'match-always', > + data: {}, > + invert: !value, > + leaf: true, > + }; > + } > + } > + > + let iconCls =3D me.getNodeIcon( > + ret.type, > + ret.data, > + ret.invert, > + !!ret.children?.length, > + ); > + > + ret.iconCls =3D iconCls; > + if (!ret.leaf) { > + ret.expanded =3D true; [snip]