Is Object's `id` immutable?

Hello there,
I’m a Mastodon instance administrator who is interested in server migration (between domains, or even between different AP implementations).

What will happen if the instance serves at one id on its URL with another id on the response?

For example:
(Re)fetch:

GET https://old_domain/old/id HTTP/1.1

Returns: (by proxy or by HTTP 30x redirection)

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "id": "https://new_domain/new/id",
  …
}

Will there be two duplicate objects on the fediverse?

Hi misaka! Welcome to the SocialHub forum. Right now, the ActivityPub spec doesn’t specify one way or the other whether URIs should be immutable, so implementations may have different behavior in this area. Mastodon, for example, uses Webfinger to uniquely identify actors, so it doesn’t let you change the domain or username of an account after it’s been created, but (in theory!) should allow you to change the URI. Personally, I think implementations should do their best, within reason, to handle mutable @id values, but obviously that adds a lot of additional complexity so it’s understandable that some implementations avoid it.

2 Likes

ID is only as immutable as any other URI would be on the Web. URLs can and do change, although this change should be minimized.

In the example given, it would be up to the software to handle the 30x redirect as it sees fit. For example, if it were a permanent redirect, then it might be a good idea to update the ID in any local references to that object. If your software uses a database, then you should be making references to the internal database key, and the ActivityPub ID can just be updated with a simple update query.

2 Likes