Error when patching MtaDeliverySchedule.retry.intervals.duration

Issue Description

The Stalwart CLI doesn’t seem to like the MtaDeliverySchedule.retry.intervals.duration values I gave it:

{
    "@type": "upsert",
    "object": "MtaDeliverySchedule",
    "value": {
        "relay": {
            "expiry": {
                "@type": "Ttl"
            },
            "name": "relay",
            "notify": {
                "@type": "Default"
            },
            "queueId": "remote",
            "retry": {
                "@type": "Custom",
                "intervals": [
                    {
                        "duration": "2m"
                    },
                    {
                        "duration": "5m"
                    },
                    {
                        "duration": "10m"
                    },
                    {
                        "duration": "15m"
                    },
                    {
                        "duration": "30m"
                    },
                    {
                        "duration": "1h"
                    },
                    {
                        "duration": "2h"
                    }
                ]
            }
        }
    },
    "matchOn": [
        "name"
    ]
}

which was rendered to JSON from:

              relay:
                name: relay
                queueId: "remote"
                expiry:
                  "@type": Ttl
                notify:
                  "@type": Default
                retry:
                  "@type": Custom
                  intervals:
                    - duration: "2m"
                    - duration: "5m"
                    - duration: "10m"
                    - duration: "15m"
                    - duration: "30m"
                    - duration: "1h"
                    - duration: "2h"

self-hosted-services/charts/services/templates/stalwart.yaml at b2848aab7e081f3691ed7dea48a54d3c3a449d16 · arch-anes/self-hosted-services · GitHub . Am I mistyping them?

Expected Behavior

Patch should succeed per MtaDeliverySchedule | Stalwart or Scheduling | Stalwart

Actual Behavior

error: MtaDeliverySchedule: create failed for `relay` (operation #15): error: invalidPatch |   Invalid value for object property |   Properties: retry/intervals

Stalwart Version

v0.16.x

Installation Method

Docker

Database Backend

PostgreSQL

Blob Storage

S3-compatible

Search Engine

PostgreSQL

Directory Backend

LDAP

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

Not your typo, and our docs are wrong. There are two things about the wire format that page doesn’t tell you. Over the API a list is a JSON object keyed by index rather than an array, and Duration is an integer number of milliseconds rather than a string like “2m”. Your expiry and notify blocks are already correct.

"retry": {
  "@type": "Custom",
  "intervals": {
    "0": {"duration": 120000},
    "1": {"duration": 300000},
    "2": {"duration": 600000},
    "3": {"duration": 900000},
    "4": {"duration": 1800000},
    "5": {"duration": 3600000},
    "6": {"duration": 7200000}
  }
}

That’s your 2m/5m/10m/15m/30m/1h/2h. In the Helm template the keys need quoting so YAML doesn’t turn them back into integers.

General trick for this sort of thing: stalwart-cli snapshot MtaDeliverySchedule prints the canonical encoding of what’s currently configured, which is a more reliable starting point for an apply plan than the reference page.