feat(pds): implement account migration endpoints for PDS#16
Merged
Conversation
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.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
atproto-pds | 31aae3d | Dec 28 2025, 07:41 AM |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.