How do you use `context` (if at all)?
from julian@community.nodebb.org to swicg-threadiverse-wg@community.nodebb.org on 16 May 2024 19:47
https://community.nodebb.org/post/99733

My post from a couple weeks back indicated that NodeBB started following part of FEP-7888: Demystifying the context property.

Our implementation is an endorsement of @trwnh@mastodon.social's proposal that the context property be given additional formalization.

During the last ForumWG call, they intentionally (or perhaps unintentionally) summarized their desire that implementors should "just use collections", and that that would be a good starting point for future iteration.

With the current state of context being "there is no coordinated usage of context", this topic aims to provide a snapshot of implementors' use of that property (or lack thereof), and to stimulate further discussion on potential use cases.

Note that this is not the first time the question has been raised. trwnh's discussion topic contained one such summary of current implementations.

As per that topic:

My hope is that a provided context resolving to a Collection (or subtype thereof) would allow for proactive topic backfill, instead of relying on reply chain traversal, which while workable, has some rather specific downsides.

As mentioned per the above linked announcement that NodeBB was following FEP-7888:

#activitypub #context #forumwg #swicg-threadiverse-wg

threaded - newest

silverpill@mitra.social on 16 May 2024 23:16 next collapse

@julian I'm not using context, but I think FEP-7888 is great and I want to implement it in the future. Haven't decided yet on what exactly this collection should contain. Slightly in favor of collection of activities (as in Streams / Conversation Containers).

@trwnh @mikedev

julian@community.nodebb.org on 16 May 2024 23:29 collapse

@silverpill@mitra.social @trwnh@socialhub.activitypub.rocks if the collection contains the entire activity log pertaining to the context, then it makes it harder to determine whether a given object is contained in the collection (as @jenniferplusplus@hachyderm.io mentioned in another thread). If you see a Create(Note) you can't be certain it doesn't get Delete(Note)'d later on in the collection!

mikedev@fediversity.site on 17 May 2024 21:03 collapse

I would expect that if there's a Delete/Note, the corresponding Create would instantly become a Tombstone, and cease to exist completely after some initial notification period.

julian@community.nodebb.org on 17 May 2024 15:51 next collapse

I have created a spreadsheet with open editing permissions (for now) and invite implementors to add their implementations if applicable.

One thing I am noticing now (and should've expected) is that not every software has the concept of a discrete context, nor can you expect one from remote activities. In those scenarios, the fallback seems to be to point to the root-node Object and iterate via replies collection.

For example:

  • @mariusor@metalhead.club's FedBOX defines context as the root-node Object.
  • @mikedev@fediversity.site's (streams) has a concept of conversation containers, and if context is received, inherits it, but otherwise, context becomes the root-node Object.

@trwnh@mastodon.social does FEP-7888 account for this use-case?

rimu@mastodon.nzoss.nz on 17 May 2024 23:07 collapse

@julian @mariusor @mikedev @trwnh At first I thought you were talking about the "@context", used for JSON-LD...

chris-moser@community.nodebb.org on 17 May 2024 06:45 next collapse

Hi, I've been working on something a little similar to FEP-7888 which uses the context field as a grouping of a subjective context but more for discovery purposes than anything. For example, followers of a Service (I called it Topic in my doc, which I realize could be a little confusing now) used as the context field can use that to discover other instances that create content with the same context. Optionally, this can be decentralized by appending a nonauthoritative ID to the context, so the authoritative ID would be used for discovery only, and as a way to bootstrap federation.

Having context be completely authoritative (and thus, forcing an authoritative Collection as its representation) could be useful too, but it'd be great to have solution that allows it to be more ephemeral as well.

julian@community.nodebb.org on 17 May 2024 18:33 collapse

@Chris-Moser Thanks for sharing your implementation of context in Yuforium!

That's definitely an interest use-case, although I am curious why you did not consider using the as:tag property instead, given that it seems to be a rough parallel to your Topics.

In that scenario, then you could limit context to what you would call Communities, though depending on how it is used, maybe audience could be a better fit (as per FEP-1b12)

chris-moser@community.nodebb.org on 17 May 2024 23:24 next collapse

@Julian yeah that's a good point - I think tag would work but I always got the impression that they were more of a micro-level part of a specific piece of content vs. macro-level (being the place they're being discussed in). context would be set at the forum level (whatever the forum's owner specified) whereas tags might be decided by the user. So in that sense, context would more about origination of a post.

Example might be something like this -

{
  id: "https://yuforium.com/forums/cars",
  type: "Service",
  name: "Example Forum About Cars",
  context: "https://another-instance.org/topic/cars"
}

Where a POST to that forum's outbox with a Note would result in that note's context defaulting to the one set to the forum. Posting with another context would result in an error. This makes things a little different than a tag which is what would be user specified. In that sense, context is more about where the post was created, vs. what it was created about. In a federated system, where could be an authoritative entity that encompasses multiple instances and is dereferenceable, or where could be defined as a UUID and be completely unauthoritative and ephemeral.

Given that it's more about the origination of the post, I would agree that the term "Community" is better in this case to define what context relates (instead of "Topic") so in the example, context could be switched to https://another-instance.org/community/cars.

It's been a while since I wrote that up, and at the time I was considering using "Community" as the terminology for a context so I might update that soon (especially with "Topic" being a frequently used convention in forums meaning something totally different).

In the Activity Streams docs, the one part about context that got my attention was this - "An example could be all activities relating to a common project or event", meaning that context exists outside of the scope of what a thread would be, and is more indicative of a forum level or federation setting vs. the contents (objects, activities, etc.) of a single thread.

angus@socialhub.activitypub.rocks on 18 Jun 16:31 collapse

One context-related issue I've encountered which hasn't been canvased yet, is that context could be used to set the canonical url of a forum topic. When I say I've encountered this issue, it's some feedback we've received on the plugin. See further

https://meta.discourse.org/t/activitypub-plugin/266794/213?u=angus

And the subsequent discussion.

What I'm currently thinking is the following:

  1. When working with a topic (thread etc)
  2. If a Note in that topic has a resolvable context
  3. If the context resolves to a Collection.
  4. Use a resolvable URL for the Collection as the canonical url
    • My current candidate for a "resolvable url" is the url property of the Collection as the Discourse plugin already serializes the topic url as the url of Topic Collections.

Interested in thoughts on any of the above.

julian@community.nodebb.org on 25 Jun 15:14 collapse

re:

Use a resolvable URL for the Collection as the canonical url

Angus, it's a little more complicated than that I think. Two concerns:

  1. It depends on where the topic first started. If a topic started on i.e. SocialHub then it makes sense that the canonical URL should be SocialHub. If it started on the NodeBB community it should be that. This might've been implied in your post, but I wanted to make sure!
  2. Secondly, it would not be correct to set a resolvable context as the canonical URL if that context resolves to an AP implementer following FEP 400e, unless you also keep track of whether all items in that context were Add'd and can confirm that all items are in that collection.
    • Short of that it's easier to just maintain your own context and canonical URL. That's this line in 7888:
      • You MAY set your own context, if you wish for your object to be in a separate context owned by you.

cc @trwnh@mastodon.social

Also sorry for the delay, it turns out I introduced a regression that caused replies to not make it into NodeBB for the past 12 days. Yikes.

julian@community.nodebb.org on 25 Jun 15:20 next collapse

So until that second point is considered — maybe we should discuss at next ForumWG meeting... — I might just maintain my own set of known contexts local context, and send additional <link rel="alternate" type="application/activity+json" href="//..."> instead

In AP, I was considering sending an Array in context if applicable, with my context first, and all others afterwards.

Happy to do it your way, but would need to resolve that 400e problem first.

trwnh@socialhub.activitypub.rocks on 25 Jun 23:30 next collapse

julian:

    • Short of that it's easier to just maintain your own context and canonical URL. That's this line in 7888:
    • You MAY set your own context, if you wish for your object to be in a separate context owned by you.

cc @trwnh@mastodon.social

I might have not phrased that clearly enough -- there is a soft assumption in 7888 that there is only one context set, especially when reading those bullet points. In other words, you would be overwriting the one context with another. This is the same as "starting a new thread" or "forking the topic".

At the same time, it should be possible for context collections to have multiple identifiers -- id being "canonical" and aliases being present in alsoKnownAs. I feel like having multiple collections for the same topic is not a good way forward; it's better to look at it as a state synchronization problem instead, with one collection at the origin being the source of truth. You maintain a local cache of that collection.

julian@community.nodebb.org on 25 Jun 23:40 collapse

@trwnh@socialhub.activitypub.rocks said in How do you use &#x60;context&#x60; (if at all)?:

I feel like having multiple collections for the same topic is not a good way forward; it's better to look at it as a state synchronization problem instead

That's a good point. I'm okay with that sort of assignment of context in theory, although I have concerns about how to handle that "local cache" situation where replies sent to a remote context aren't considered part of the context until an Add is received. Might be a sensible default to set the context for those items to the local context until confirmation is received...

angus@socialhub.activitypub.rocks on 27 Jun 08:09 collapse

julian:

It depends on where the topic first started. If a topic started on i.e. SocialHub then it makes sense that the canonical URL should be SocialHub. If it started on the NodeBB community it should be that. This might've been implied in your post, but I wanted to make sure!

Yes, that is my understanding. For example, the canonical url of this topic would be

https://community.nodebb.org/topic/18050/how-do-you-use-context-if-at-all julian:

Secondly, it would not be correct to set a resolvable context as the canonical URL if that context resolves to an AP implementer following FEP 400e, unless you also keep track of whether all items in that context were Add'd and can confirm that all items are in that collection.

I'm not sure I quite agree here, albeit I may be misunderstanding your meaning. I don't think the "canonical" nature of the context should be dependent on the fidelity of the context's object (e.g. the context's collection) to all activities made with respect to it, or dependent on the context owner following a particular approach (beyond the necessities I've laid out below).

I feel like requiring activity fidelity makes the use of the context a bit too circumspect as there will always be a possibility that some actor interacting with it does not consider the context to have treated its activities appropriately.

Consider the following

  • Discourse and NodeBB both consider the context of this topic (i.e. the one we're in right now) to be the canonical context, as represented in the canonical url

    https://community.nodebb.org/topic/18050/how-do-you-use-context-if-at-all
  • Another platform, let's call it "SEOmaster" has also published some activities in this context, however for whatever reason they are not winding up in the context's collection, and not appearing in the topic representations on nodebb and socialhub. There could be many reasons for this, ranging from an issue with their activity formatting, to connection issues, to an issue with the actor etc.

  • NodeBB has implemented FEP 400e compatibility, in addition to 1b12 support, in some form.

  • SEOmaster, as its name implies, has amazing SEO. Because it doesn't consider its rejected activities to be treated appropriately. It feels justified in setting the canonical URL as a URL with its domain and points out that NodeBB is compatible with FEP 400e.

Now, the above could well happen anyway, without any justification, if SEOmaster were to ignore any convention we devise here. However I think the convention we set should be as robust as possible. Making it subject to the specific implementation of the context feels like a hostage to fortune to me.

That said, I do think that, to be considered a "canonical" context for the purposes of a forum the following needs to be true:

  1. context is resolvable.
  2. It resolves to a Collection.
  3. The Collection has a resolvable url.

For a forum I think we need to at least require the context to be a Collection, otherwise it can't be a canonical context for a topic.

julian@community.nodebb.org on 27 Jun 18:48 collapse

@angus@socialhub.activitypub.rocks said in How do you use &#x60;context&#x60; (if at all)?:

That said, I do think that, to be considered a "canonical" context for the purposes of a forum the following needs to be true:

  1. context is resolvable.
  2. It resolves to a Collection.
  3. The Collection has a resolvable url.

Agreed on that. I think I am over-complicating things by thinking that individual objects in a forum topic could have different contexts when queried via ActivityPub.

However, what if after iterating through the resolved context, the top-level item identifies itself as having a context that differs from the one you queried? Do you start over with the new context (if resolvable? lol.)