SpamTag objects cannot be updated via cli

Issue Description

When updating SpamTags objects, it requires an id field (top level id). Moreover, the matchOn only allows object, id, scope or value. This makes it impossible to easily update scores of specific tags without destroying it first.

Expected Behavior

- "@type": update
  object: SpamTag
  matchOn: [tag]
  value:
    spoofReplyTo:
      "@type": Score
      tag: SPOOF_REPLYTO
      score: 3.0 # From the default of 6 as many legitimate mails set a different reply-to

Should work

Actual Behavior

error: invalid plan NDJSON on line 23: unknown field matchOn, expected one of object, id, scope, value

or when not setting matchOn you get

error: update operation #23 on SpamTag is missing the top-level id field (required for non-singletons; id is a sibling of value, not a key inside it)

Reproduction Steps

  1. Default stalwart install
  2. Update via CLI a SpamTag object by setting the score (as shown in expected behavior)

Stalwart Version

v0.16.x

Installation Method

Docker

Database Backend

PostgreSQL

Blob Storage

PostgreSQL

Search Engine

PostgreSQL

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

The update operation always requires an explicit top-level id, it does not support matchOn at all, that option is only accepted by upsert and reconcile. To update a SpamTag’s score by tag name without knowing its id, use upsert instead of update, and include the @type in the value since SpamTag is multi-variant (matching happens within that variant):

{"@type":"upsert","object":"SpamTag","matchOn":["tag"],"value":{"spoofReplyTo":{"@type":"Score","tag":"SPOOF_REPLYTO","score":3.0}}}

This matches the existing SpamTag with tag: SPOOF_REPLYTO and updates its score in place instead of erroring or requiring the id, and it’s idempotent on re-apply.

Details on matchOn and multi-variant matching are in the apply reference, and the SpamTag schema (fields, variants) is documented at SpamTag object reference.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Great @helpbot, completely missed that!