Migrate actor IDs from permalink to query-param format - #2766
Conversation
2bb8436 to
bc5509d
Compare
|
I checked how the biggest platforms really handle The problemThe migration sends a What I read in Mastodon
The account also stays flagged as moved to itself. That blocks new follows and hides it from search. Mastodon does this correctly without a MoveThere is a path built exactly for our case: # Allow accounts to change URIs if they keep the same handle
# (typically, losing database or switching ActivityPub server implementation)
@account ||= Account.find_remote(@username, @domain) if @webfinger_verifiedIt rewrites the uri and re-follows cleanly, because Good news for that path: we already answer the re-issued But just dropping the Move does not fix everythingThis is the part I like least. An id change under the same handle behaves differently everywhere:
Misskey is the worst one. No ActivityPub path ever writes a new For Pleroma, Akkoma and Mitra it is the opposite: they create a second actor anyway, and the So there is no way to change an actor id that is safe everywhere. We can only pick who pays. Two more things I found while looking:
What I am not sure aboutStep 4 above depends on a race between the SuggestionI think we should not send the The smaller version would be to use the query param id only for new actors and leave existing ones alone, so nobody pays for a migration they did not ask for. |
Stacked on #3585 (the account-move fixes), which it depends on. Review and merge that one first; this PR's base is set to it so the diff shows only the migration.
Proposed changes:
A permalink-based actor id embeds the handle (
/@handlefor the blog, the author-archive URL for a user), so changing the handle changes the id and strands followers. This moves every actor that used a permalink id to the stable?author=IDform, which does not contain the handle.Blog::get_id()/User::get_id(), so ids are always the query-param form.Movefor every permalink-id actor, from the old id to the new one, and keeps the old id resolving with amovedTo.Move::internally_by_actor()from Fix account move verification and notify followers #3585, so each move also records the target'salsoKnownAsand sends the follow-up profileUpdate.Movethat re-identifies a local actor (a same-domain target) is broadcast to all known inboxes, not just followers, so every server that cached the old id updates. AMoveto a remote account stays followers-only per FEP-7628.The old id keeps resolving without the model ever inspecting the request:
Query::is_permalink_actor_request()recognizes the old-URL request from its query vars (actorfor/@handle,author_namefor/author/handle, neither for?author=ID), and a construct-hook handler serves a stored snapshot, exactly as the domain-move path already does.Other information:
Testing instructions:
activitypub_use_permalink_as_id_for_blogoption (blog) or theactivitypub_use_permalink_as_iduser option (user) to1.activitypub_db_versionto force the migration (e.g.wp option update activitypub_db_version 9.1.0) and load the site.?author=ID, the outbox has aMovefrom the old id, and fetching the old/@handle(or/author/handle) URL returns the old id withmovedTopointing at the new one.Changelog entry
Included in the branch (
.github/changelog/migrate-permalink-ids-to-query-param).Changelog Entry Details
Significance
Type
Message
Use a stable Fediverse profile ID that no longer breaks your followers when you change your handle, and migrate existing profiles to it automatically.