Skip to content

Fix domain migration: persist movedTo field for old domain actors#99

Closed
jlelse with Copilot wants to merge 9 commits into
masterfrom
copilot/add-domain-move-activity
Closed

Fix domain migration: persist movedTo field for old domain actors#99
jlelse with Copilot wants to merge 9 commits into
masterfrom
copilot/add-domain-move-activity

Conversation

Copilot AI commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Plan: Create Domain Move Integration Test

  • Examine existing integration test patterns
  • Create activityPub_domain_integration_test.go
  • Follow the correct test workflow:
    • Start GoBlog with OLD domain only
    • Follow old domain from GoToSocial
    • Stop server, update config with alternate domain
    • Restart GoBlog
    • Run domain move
    • Verify movedTo is set
    • Verify followers migrate to new domain
  • Build and run the test
  • Verify test passes
  • Commit working test

This will properly test the domain migration workflow.

Original prompt

While GoBlog already supports moving Fediverse/ActivityPub accounts to external accounts, it should also support the Move activity for domain changes. So when the user wants to change the domain from goblog.example to newgoblog.example, the user should be able to send a Move activity for that. GoBlog should then handle the webfinger and ActivityPub actor requests correctly (maybe by looking at the host header?).
That scenario should be tested with the GoToSocial integration tests. In that test the GoBlog instance should be reachable on two example domains (goblog.example and newgoblog.example).

I envision the procedure for a domain change like this:

  1. Update reverse proxy two serve both (old and new) domains, config for new domain etc.
  2. User restarts GoBlog
  3. User uses a command like "activitypub domainmove goblog.example newgoblog.example" (if you have a better suggestion, use that)
  4. GoBlog sends a Move activity for every blog from the old-domain ActivityPub actor
  5. Followers receive the Move and follow the new domain

Figure out when GoBlog needs to send what and from which actor to the followers (profile update, move activity, etc.).

When implementing this, check the ActivityPub spec (https://www.w3.org/TR/activitypub/), the GoToSocial source code (clone it locally when needed, https://codeberg.org/superseriousbusiness/gotosocial) and the Mastodon source code (https://github.com/mastodon/mastodon/).

The whole flow should be tested in the integration tests with GoToSocial.

Keep the code readable, simple and document the usage in the readme.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 3, 2026 09:43
- Add database migration for alternate domains table
- Add database functions for managing alternate domains
- Modify webfinger to support multiple domains via Host header
- Add helper function to generate IRIs for specific domains
- Update actor generation to include alternate domains in alsoKnownAs
- Add toApPersonForDomain to generate actors for specific domains
- Update serveActivityStreams to use Host header for domain-specific responses
- Add CLI command for domain moves (activitypub domainmove)
- Implement apDomainMove function to handle domain migrations

Co-authored-by: jlelse <8822316+jlelse@users.noreply.github.com>
- Add comprehensive integration test for domain migration
- Test verifies both domains are accessible
- Test checks webfinger works for both domains
- Test validates actor endpoints return domain-specific IRIs
- Update README with domain move procedure
- Add CLI command documentation for domain moves
- Document the complete workflow for domain changes

Co-authored-by: jlelse <8822316+jlelse@users.noreply.github.com>
- Remove trailing whitespace from main.go, activityStreams.go, activityPub.go
- Address code review feedback

Co-authored-by: jlelse <8822316+jlelse@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for Move activity in domain changes Add ActivityPub domain migration support for same-instance moves Feb 3, 2026
Copilot AI requested a review from jlelse February 3, 2026 09:57
Copilot AI and others added 2 commits February 3, 2026 10:11
Major refactoring based on feedback:
- Move alternateDomains from ActivityPub config to Server config (whole GoBlog)
- Remove database storage for alternate domains (now config-based)
- Update domain move command to work on ALL blogs (no blog parameter)
- Add redirect logic for non-AP requests to old domains
- Update integration test to follow OLD domain first and verify Move works
- Remove remove-alternate-domain CLI command (config-based now)
- Update all documentation for new approach

Key changes:
- server.alternateDomains replaces activityPub.alternateDomains
- domainmove command: "domainmove <old> <new>" (no blog param)
- Alternate domains work for whole GoBlog, not just ActivityPub
- Redirects work correctly with reverse proxy configuration

Co-authored-by: jlelse <8822316+jlelse@users.noreply.github.com>
- Fix goBlogAcctOld → goBlogAcctOldWebfinger in test
- Address code review feedback

Co-authored-by: jlelse <8822316+jlelse@users.noreply.github.com>
Copilot AI changed the title Add ActivityPub domain migration support for same-instance moves Refactor domain migration to use config-based alternate domains with redirect support Feb 3, 2026
Copilot AI and others added 3 commits February 3, 2026 10:35
**Fixed Issues:**
1. apDomainMove now calls setApMovedTo() for each blog
2. Rewrote integration test to match requirements:
   - Starts GoBlog without alternate domain (old domain only)
   - Follows old domain account
   - Stops server, updates config to add alternate domain
   - Restarts with new domain configuration
   - Runs domain move and verifies movedTo is set
   - Verifies follower automatically migrates to new domain

**publicHttps:** Already correctly implemented in apIriForDomain

**Test Flow:**
- Phase 1: Start with OLD domain only
- Phase 2: Follow old domain
- Phase 3: Stop, update config, restart with new domain + alternate
- Phase 4: Run domain move, verify movedTo is set
- Phase 5: Verify follower migrated to new domain

The test now properly simulates real-world domain migration workflow.

Co-authored-by: jlelse <8822316+jlelse@users.noreply.github.com>
- Added setApMovedTo() call in apDomainMove for each blog
- movedTo field now properly set to new domain actor IRI
- publicHttps already correctly implemented in apIriForDomain

Note: Integration test needs rewrite (removed temp files).
The test should:
1. Start GoBlog with OLD domain only
2. Follow old domain
3. Stop, update config with alternate domain, restart
4. Run domain move
5. Verify movedTo is set and followers migrate

This matches real-world domain migration workflow.

Co-authored-by: jlelse <8822316+jlelse@users.noreply.github.com>
Copilot AI changed the title Refactor domain migration to use config-based alternate domains with redirect support Fix domain migration: persist movedTo field for old domain actors Feb 3, 2026
@jlelse jlelse closed this Feb 3, 2026
@jlelse jlelse deleted the copilot/add-domain-move-activity branch February 10, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants