Repository navigation
Object metadata serialization - #320
Merged
Merged
Conversation
aaronjae22
added this pull request to stack #321
October 5, 2026 18:55
aaronjae22
marked this pull request as ready for review
October 5, 2026 18:56
lisad
approved these changes
Oct 6, 2026
| "actor": build_actor_id(activity.actor.id, request), | ||
| "published": activity.timestamp.isoformat(), | ||
| "visibility": activity.visibility, | ||
| **_non_empty(activity, {"previously": "previously"}), |
Member
There was a problem hiding this comment.
this is nice
I also like the idiom
**if_not_empty(activity)
**if_not_empty({"previously": previously})
because it makes the template very readable with one item per line in a clear order
Collaborator
Author
There was a problem hiding this comment.
I'll switch the helper in the in the follow-up PR, I like it
aaronjae22
force-pushed
the
object-metadata-serialization
branch
from
October 9, 2026 16:07
8db9312 to
d2c66ce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #295 we added to
Noteseven metadata columns (summary,to,cc,in_reply_to,url,sourceandpreviously) but they were not being served.This is a Note today with all seven populated served by the content collection to a bound token:
{ "@context": "<https://www.w3.org/ns/activitystreams>", "type": "Note", "id": "<http://testserver/api/notes/1/>", "actor": "<http://testserver/api/actors/1/>", "content": "<p>copied</p>", "published": "2016-05-01T12:00:00+00:00", "visibility": "public" }The destination is not able to keep the metadata the source never sends. LOLA asks the source to send it (§6.3) and the destination to preserve it (§7.1.5–§7.1.8). We are not able to properly test the transfer work that follows until the source serves it.
There are a few more stuff going on in the same payloads:
Create,LikeandFollowall store previously and none of them serves it.liked_collectionalready says attributedTo for the same Note so basically today one Note comes out under two different keys depending on which endpoint serves it.previouslyhas no usable JSON-LD definition. The Actor lists the LOLA spec's web address as a context but that address serves an HTML page. A JSON-LD processor must load every entry in @context and stops at the first one that fails which means today the whole Actor fails to processAs served:
I was doubting about including this change (it has been on my backlog for quite some time) and its importance right now but since I was working on
previouslyI decided to add it.Most fediverse servers read our JSON as plain JSON and never notice. A destination developer who checks our payloads in a JSON-LD tool gets an error from the reference implementation.
Current
previouslyAfter this PR
attributedTo, plus each metadata field that has a value. An empty field is left out entirely and it's never sent asnullor[]previouslywhen they have breadcrumbspreviouslyis defined inline in@context, and only on objects that carry it. The Actor carries it always, because the Actor always serves previously.⠀Expected output for the same Note after the change:
{ "@context": [ "<https://www.w3.org/ns/activitystreams>", {"previously": {"@id": "<https://swicg.github.io/activitypub-data-portability/lola#previously>", "@type": "@id", "@container": "@list"}} ], "type": "Note", "id": "<http://testserver/api/notes/1/>", "attributedTo": "<http://testserver/api/actors/1/>", "content": "<p>copied</p>", "published": "2016-05-01T12:00:00+00:00", "visibility": "public", "summary": "CW: a copied note", "to": ["<https://lemongrove.example/followers>"], "cc": ["<https://oakfrost.example/brock>"], "inReplyTo": "<https://lemongrove.example/notes/parent>", "url": "<https://lemongrove.example/@aurora/1>", "source": {"content": "copied", "mediaType": "text/markdown"}, "previously": [{"actor": "<https://lemongrove.example/>", "id": "<https://lemongrove.example/notes/1>"}] }