Interop with a real GoToSocial server, and the fixes it found (phase 2, step 8)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 10s
CI / test (push) Successful in 2m16s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s

scripts/interop/run.sh brings up Scrobbler (API, worker, UI behind a
throwaway-TLS Caddy) and GoToSocial 0.22.1 on a private .test network,
creates a GoToSocial user, drives its sign-in/OAuth screens for a token,
and checks: lookup by handle, follow accepted, unfollow, manual approval
and approve, remove, block and unblock, and decline.

Found and fixed along the way:
- Keys whose id is a path serving the actor (GoToSocial's
  <actor>/main-key) weren't resolved; now all three publishing styles
  are handled
- An Undo of an older Follow arriving after a newer Follow removed the
  new follower; an Undo now only removes the Follow it names (and Undo
  referencing a Follow by id is understood)
- Rejects embedded the Follow, which some servers (GoToSocial) match by
  account pair, so a late Reject could cancel a newer request; Rejects
  now reference the Follow by id
- Unblocking didn't tell the other server; it now sends Undo(Block)
- Actors publish an (empty) featured collection, which Mastodon and
  GoToSocial fetch

GoToSocial 0.22.1 ignores Reject for already-accepted follows (a TODO
in its code, fixed on its main branch); the removal check on its side
is skipped until a release has it (GTS_REJECT_ENDS_FOLLOWS=1 enables).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
mattandClaude Opus 5.5 committed 2026-09-25 22:11:39 +01:00
1 parent ec658a7751
commit b93cfea5b3
16 files changed
+694 -17

No files matched your search

+23 -2
View File
@@ -16,6 +16,7 @@ ACTOR_CONTEXT = [
"toot": "http://joinmastodon.org/ns#",
"discoverable": "toot:discoverable",
"indexable": "toot:indexable",
"featured": {"@id": "toot:featured", "@type": "@id"},
"schema": "http://schema.org#",
"PropertyValue": "schema:PropertyValue",
"value": "schema:value",
@@ -30,6 +31,7 @@ class ActorUrls:
outbox: str
followers: str
following: str
featured: str
shared_inbox: str
key_id: str
profile_page: str
@@ -43,6 +45,7 @@ def actor_urls(base_url: str, username: str, profile_page: str) -> ActorUrls:
outbox=f"{actor}/outbox",
followers=f"{actor}/followers",
following=f"{actor}/following",
featured=f"{actor}/collections/featured",
shared_inbox=f"{base_url}/inbox",
key_id=f"{actor}#main-key",
profile_page=profile_page,
@@ -90,6 +93,7 @@ def person(
"outbox": urls.outbox,
"followers": urls.followers,
"following": urls.following,
"featured": urls.featured,
"endpoints": {"sharedInbox": urls.shared_inbox},
"publicKey": public_key(urls, public_key_pem),
"manuallyApprovesFollowers": manually_approves_followers,
@@ -164,14 +168,31 @@ def accept(activity_id: str, actor_id: str, follow: dict) -> dict:
def reject(activity_id: str, actor_id: str, follow: dict) -> dict:
"""Decline a follow request, or end an existing follow."""
return _response("Reject", activity_id, actor_id, follow, follow["actor"])
"""Decline a follow request, or end an existing follow.
The Follow is referenced by id rather than embedded: some servers match an embedded
Follow by the pair of accounts, so a late Reject of an old Follow would cancel a
newer request between the same accounts. An id matches exactly that Follow."""
return _response("Reject", activity_id, actor_id, follow["id"], follow["actor"])
def block(activity_id: str, actor_id: str, blocked_actor: str) -> dict:
return _response("Block", activity_id, actor_id, blocked_actor, blocked_actor)
def undo(activity_id: str, actor_id: str, undone: dict) -> dict:
"""Withdraw one of our earlier activities (e.g. a Block when unblocking)."""
to = undone.get("to") or []
return {
"@context": AS_CONTEXT,
"id": activity_id,
"type": "Undo",
"actor": actor_id,
"object": undone,
"to": list(to),
}
def object_id(value) -> str | None:
"""An object's id, whether it's given inline (a dict) or as a bare URI."""
if isinstance(value, dict):