Skip to content

Special cases

Here, we document activities that have caused special behavior to be implemented. We note that code blocks involving >>> are run as doctests.

Mastodon

Mastodon like

Mastodon sends like activities without recipients, i.e. no to property. This leads would lead to the following behavior

>>> from muck_out.process import normalize_activity
>>> mastodon_like = {
...     "@context": "https://www.w3.org/ns/activitystreams",
...     "id": "https://mastodon.social/users/the_milkman#likes/251507741",
...     "type": "Like",
...     "actor": "https://mastodon.social/users/the_milkman",
...     "object": "https://dev.bovine.social/html_display/object/019"
... }
>>> normalize_activity(mastodon_like)
Traceback (most recent call last):
...
pydantic_core._pydantic_core.ValidationError: 1 validation error for Activity
to
  List should have at least 1 item after validation, not 0 [type=too_short, input_value=[], input_type=list]
    For further information visit https://errors.pydantic.dev/2.11/v/too_short

In order to work around this, the actor id processing the activity can be passed:

>>> from muck_out.process import normalize_activity
>>> mastodon_like = {
...     "@context": "https://www.w3.org/ns/activitystreams",
...     "id": "https://mastodon.social/users/the_milkman#likes/251507741",
...     "type": "Like",
...     "actor": "https://mastodon.social/users/the_milkman",
...     "object": "https://dev.bovine.social/html_display/object/019"
... }
>>> result = normalize_activity(mastodon_like,
...      actor_id="https://dev.bovine.social/actor/ABC")
>>> print(result.model_dump_json(indent=2, exclude_none=True))
{
  "@context": [
    "https://www.w3.org/ns/activitystreams"
  ],
  "id": "https://mastodon.social/users/the_milkman#likes/251507741",
  "to": [
    "https://dev.bovine.social/actor/ABC"
  ],
  "cc": [],
  "type": "Like",
  "actor": "https://mastodon.social/users/the_milkman",
  "object": "https://dev.bovine.social/html_display/object/019"
}

Hubzilla

Hubzilla Add

the activity
{
    "@context": [
        "https://www.w3.org/ns/activitystreams",
        "https://w3id.org/security/v1",
        "https://purl.archive.org/socialweb/webfinger",
        {
            "Bookmark": "zot:Bookmark",
            "Category": "zot:Category",
            "Emoji": "toot:Emoji",
            "Hashtag": "as:Hashtag",
            "PropertyValue": "schema:PropertyValue",
            "commentPolicy": "zot:commentPolicy",
            "contextHistory": "https://w3id.org/fep/171b/contextHistory",
            "conversation": "ostatus:conversation",
            "diaspora": "https://diasporafoundation.org/ns/",
            "directMessage": "litepub:directMessage",
            "guid": "diaspora:guid",
            "litepub": "http://litepub.social/ns#",
            "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
            "ostatus": "http://ostatus.org#",
            "schema": "http://schema.org#",
            "toot": "http://joinmastodon.org/ns#",
            "uuid": "schema:identifier",
            "value": "schema:value",
            "zot": "https://zotum.net/apschema#"
        }
    ],
    "actor": "https://zotum.net/channel/fentiger",
    "cc": [],
    "context": "https://zotum.net/conversation/0c47b0fa-4495-4c22-8a1b-508e32300ee9",
    "contextHistory": "https://zotum.net/conversation/0c47b0fa-4495-4c22-8a1b-508e32300ee9",
    "diaspora:guid": "72598b50-025c-46fc-ba62-3896a86b7fd0",
    "id": "https://zotum.net/activity/72598b50-025c-46fc-ba62-3896a86b7fd0",
    "object": {
        "@context": "https://www.w3.org/ns/activitystreams",
        "actor": "https://macaw.social/users/andypiper",
        "id": "https://macaw.social/users/andypiper#likes/464620",
        "object": "https://zotum.net/item/0c47b0fa-4495-4c22-8a1b-508e32300ee9",
        "type": "Like"
    },
    "proof": {
        "created": "2025-10-02T08:55:16Z",
        "cryptosuite": "eddsa-jcs-2022",
        "proofPurpose": "assertionMethod",
        "proofValue": "z5LtePhraLrztZwijvT7wPb6Vc3KB7NMBsdHx1zCK7yH3CkeusUU1um3MCL9kBv72CixMgeQsoFTKD95Jh9J8vdab",
        "type": "DataIntegrityProof",
        "verificationMethod": "https://zotum.net/channel/fentiger#z6MkrrfV3uVEiBCyL7dHgu7XiqQLTMZ6SUjtJiset1ou2NAE"
    },
    "published": "2025-10-02T08:49:49Z",
    "signature": {
        "@context": [
            "https://www.w3.org/ns/activitystreams",
            "https://w3id.org/security/v1"
        ],
        "created": "2025-10-02T08:55:16Z",
        "creator": "https://zotum.net/channel/fentiger",
        "nonce": "a2f6d5d99b5b4166123177a001d44ef3e9993d127baae58d5765c0fe01e8d5fb",
        "signatureValue": "p8lGJj+lw+JuXSorUPgsQlN43pvArwmc8GOv4zxnz8vg3KjHnxPIWtOEpMsdo8zD4INf6VubEYLoJ8l2/9FRf6DuO+DtFvOqzWrpM34yZJmQLG/W4lSqUzAe8hNIKLSp1b2RApJD6AHzOFVET0BbngTarxgGwOzAlWqulbgKI/Uk/6uoX5LlmBOj/7BS5OJRF574D9z+QMR3vehXf0v0qfUFbkwImPKuI9wmPhFZ3zYZ7MqyVQLGrwlZnBANhRTb4QzfEXo/ip0vevgW+RCxblGLMKIZSs/cmUcT/WoAIvatgat+CIF9oKzgVFd+AqeROU8jg2XzJBb6vBjHJcinowyYb35HIp/qJBn2XLIFLYCKAf0AKS6COaf5ay5dL8GwxztxVQfsd1Rjjx9vWitrBGN3oMwUsvckFP1ZYPNz/pDZ+LuPwl0g7WsWcNTLZrY7jqbnWPWGTlgkVN4iLdfSpaodt1H83/IIea2tAGcdAR6bfjusyysXSJxHxEhWeRqTldmmAc8gjGDEZU9UDMtipD6TW3Te3JK7unFZ1lw9DMfqJSauJEqfltLtOPJF7HI6fjmC9xIS3HOgUui6dLAGwiGgeKvtcIqkPNm7OJsqT7wKGaKDUvsZ59tVhcWvEMCCh5GaEqaZQsAGF9mqcZCNKg4NNy7rtbnXedN5QDW6NF4=",
        "type": "RsaSignature2017"
    },
    "target": {
        "attributedTo": "https://zotum.net/channel/fentiger",
        "id": "https://zotum.net/conversation/0c47b0fa-4495-4c22-8a1b-508e32300ee9",
        "type": "Collection"
    },
    "to": [],
    "type": "Add"
}
>>> import json
>>> with open("docs/assets/hubzilla_add.json") as fp:
...     hubzilla_add = json.load(fp)
>>> result = normalize_activity(hubzilla_add,
...      actor_id="https://dev.bovine.social/actor/ABC")
>>> result.field_context = []
>>> print(result.model_dump_json(indent=2, exclude_none=True))
{
  "@context": [],
  "id": "https://zotum.net/activity/72598b50-025c-46fc-ba62-3896a86b7fd0",
  "to": [
    "https://dev.bovine.social/actor/ABC"
  ],
  "cc": [],
  "published": "2025-10-02T08:49:49Z",
  "type": "Add",
  "actor": "https://zotum.net/channel/fentiger",
  "object": "https://macaw.social/users/andypiper#likes/464620",
  "target": "https://zotum.net/conversation/0c47b0fa-4495-4c22-8a1b-508e32300ee9"
}