Skip to content

feat(pds): implement account migration endpoints for PDS#16

Merged
ascorbic merged 4 commits into
mainfrom
claude/implement-account-migration-IZsKx
Dec 28, 2025
Merged

feat(pds): implement account migration endpoints for PDS#16
ascorbic merged 4 commits into
mainfrom
claude/implement-account-migration-IZsKx

Conversation

@ascorbic
Copy link
Copy Markdown
Owner

No description provided.

Add support for migrating accounts between PDS instances using CAR file
import/export.

Changes:
- Add com.atproto.repo.importRepo endpoint for importing repository from
  CAR file (authenticated, 100MB limit)
- Add com.atproto.server.getAccountStatus endpoint for migration planning
- Add rpcImportRepo method to AccountDurableObject with DID validation
- Add @ipld/car to dependencies for CAR file parsing
- Add comprehensive migration tests (9 tests covering auth, validation,
  and import/export workflow)
- Update EDGE_PDS_PLAN.md to document Phase 9 (Account Migration)

The implementation validates that:
- CAR files have valid structure (single root, non-empty blocks)
- DID in imported repo matches the target PDS DID
- Import is prevented if repository already exists
- Proper error handling for oversized files and malformed CAR data

This enables users to migrate their accounts from other PDS instances
while maintaining data integrity and preventing migration errors.
Replace direct @ipld/car usage with official @atproto/repo utilities
for better alignment with AT Protocol standards.

Changes:
- Use readCarWithRoot() instead of CarReader.fromBytes()
  - Automatically validates single root requirement
  - Returns BlockMap directly for efficient storage
- Use putMany() instead of individual putBlock() calls
  - More efficient bulk import operation
  - Leverages existing BlockMap support
- Move @ipld/car from dependencies to devDependencies
  - Only needed for test validation
  - Reduces runtime dependencies

Benefits:
- Cleaner, more maintainable code (removed ~30 lines)
- Better alignment with AT Protocol standards
- More efficient block import (single putMany vs loop)
- Consistent with export (blocksToCarFile)
- Automatic validation built into readCarWithRoot

All 93 tests passing, including 9 migration tests.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Dec 28, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
atproto-pds 31aae3d Dec 28 2025, 07:41 AM

claude and others added 2 commits December 28, 2025 07:32
Merge latest changes from main including Lexicon validation feature.

Changes:
- Resolved conflicts in EDGE_PDS_PLAN.md to include both features
- Updated migration tests to include $type field in post records
  (required by new validation from main)
- Updated lockfile after merge

Both features now work together:
- Lexicon Validation validates record schemas
- Account Migration imports/exports repositories

All 112 tests passing:
- 16 storage tests
- 32 XRPC tests
- 8 firehose tests
- 10 blob tests
- 15 session tests
- 8 validation tests
- 9 migration tests
- 3 Bluesky validation tests
- 11 additional validation tests
@ascorbic ascorbic merged commit 74b60a4 into main Dec 28, 2025
2 of 3 checks passed
@ascorbic ascorbic deleted the claude/implement-account-migration-IZsKx branch December 28, 2025 07:41
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