~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Accounts move between servers, with handles of their own domains

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:migration/accounts

An account can now move to this server, and away from it, keeping its DID, with a handle under the server's domains or its own domain. The spec, a --moves harness run that moves accounts between the server and a third reference PDS, and the server.

Claude Opus 5.5 · high

What changes

Spec. spec/MIGRATION.md is a new page: createAccount with a did and a service token from the account's old server (each check of the token, in the reference's order and names), importRepo, listMissingBlobs, submitPlcOperation for moving in, and requestPlcOperationSignature and signPlcOperation for moving out, with five new lexicons. IDENTITY.md says how a handle outside PDS_HANDLE_DOMAINS is resolved (DNS _atproto TXT and HTTPS /.well-known/atproto-did, at once, DNS winning), with PDS_HANDLE_DNS_SERVER and the development-only PDS_HANDLE_FETCH, so that createAccount with a did and updateHandle take an external handle that resolves to the account. ACCOUNTS.md, LIFECYCLE.md, EMAIL.md (kind plcOperation), LIMITS.md (PDS_MAX_REPO_IMPORT_SIZE, 300 MiB by default as the reference's installer sets it; importRepo among the writes held to the disk floor), OAUTH-SCOPES.md, SYNC.md, DURABILITY.md, OPERATIONS.md (target handle; a moving account's createAccount span is its GET of the DID document) and COMMANDS.md (import-repo) say what each changes; docs/guide/ and the docs site's sidebar name the page, the run and the variables.

Where the reference takes a repository it cannot serve whole, the server refuses or mends it (MIGRATION.md, "Where the reference departs"): a CAR whose commit names another DID, a tree with nodes or records missing, or not the MST its records make, is 400; an import makes a new commit signed with the account's own key, rather than keeping the old server's commit; an active account's import puts #sync on the firehose.

Harness. harness/lib/handles.mjs serves handles over DNS and HTTP to both sides in every run, past the test network's own resolver, which asks DNS alone. harness/checks/moves.mjs is the --moves run (named apart from main's --migrate, which moves blobs) (in the compare gates, 6 moves): accounts move in from a third PDS and out to it, every step compared with the reference, both firehoses settled and held to each move's events, the server's operations and imports held to the spec where the reference departs, and the third PDS taking each account the server sends it. operations.mjs takes the handle target and a moving account's GET; reports print BigInt span attributes.

Server. pds-server has a migration area for the five methods; createAccount checks a service token (keys read from the DID document, read again on a bad signature) and makes a moving account deactivated, with no PLC operation and no events; importRepo checks the CAR whole, applies its tree as one commit signed with the account's key, and leaves the blobs it names missing until uploaded; identity resolves external handles through hickory-resolver and the outbound guard. pds-repo's MST walk refuses a node reached twice. import-repo is a CLI command, with no MCP tool.

How it was checked

  • --moves --steps 3, seeds 1, 2 and 3: all agree, operations included. The run failed on the server before this change, at its first createAccount with a service token.
  • Bugs planted and taken out again: without the #identity after submitPlcOperation, the run fails at the firehose check; with external handles taken unresolved, at createAccount's refusal, on every seed once those refusals were always sent.
  • cargo test -p pds-server (334), fmt and clippy clean; --lifecycle --steps 30 and the main run agree; just quick here.
Asked for changes

This pull adds account migration in both directions: a new spec/MIGRATION.md with five lexicons, a --migration harness run with handle DNS and HTTP servers, and the server's migration area with external handle resolution. The spec and README updates look complete. hickory-resolver was already a workspace dependency, so no new crates are added.

Missing guide updates. .knotless/review.md and AGENTS.md require that a change to how the server is run, deployed, called or checked updates its guide in docs/guide/ in the same pull. The diff touches no file under docs/, yet it changes all of these:

  • docs/guide/comparing.md lists each harness run (--lifecycle and the others) and says nothing of --migration.
  • docs/guide/deploying.md:57 lists the development-only variables PDS_DEV_MAIL_DIR and PDS_OAUTH_CLIENT_FETCH. The new PDS_HANDLE_FETCH is not added there. The new PDS_HANDLE_DNS_SERVER and PDS_MAX_REPO_IMPORT_SIZE are not covered in the guides either.
  • The import-repo CLI command has no guide entry.

Please add these to the guides.

What I did not read. I read the diff only for README.md, harness/gates.mjs, harness/lib/args.mjs and harness/lib/handles.mjs. I did not read the rest of the diff:

  • the Rust sources, including migration.rs, identity/resolve.rs and the MST change;
  • harness/checks/migration.mjs and the other harness changes;
  • the spec pages and lexicons.

I did not confirm whether harness/conformance.yaml needs an entry. A search for "migration" in it found none.

harness/lib/handles.mjs. It replaces the reference resolver's DNS and fetch calls for handles outside the PDS's own domains, so that both sides can be checked against the same data. This is fine as a harness feature. The domain test handle.endsWith(d) has no dot boundary, so notexample.test would count as under example.test. This is minor.

harness/lib/handles.mjsline 120
}
const own = resolver.resolve
const real = Object.getPrototypeOf(resolver).resolve
resolver.resolve = (handle) => (domains.some((d) => handle.endsWith(d)) ? own.call(resolver, handle) : real.call(resolver, handle))
review.knotless.dev

endsWith(d) has no dot boundary, so a handle like xexample.test counts as under example.test. Compare with '.' + d or check for equality.

Approved

This round fixes the main thing I asked for. docs/guide/comparing.md now describes --moves, and docs/guide/deploying.md lists PDS_MAX_REPO_IMPORT_SIZE and puts PDS_HANDLE_FETCH with the development-only variables.

Two small guide gaps remain, and I don't think they should hold the pull:

  • PDS_HANDLE_DNS_SERVER appears only in spec/IDENTITY.md and the harness. It has no entry in docs/guide/.
  • A search of docs/ finds no mention of the import-repo CLI command.

On the endsWith comment I left last round: resolveHere is passed cfg.identity.serviceHandleDomains from the reference. As far as I can tell these start with a dot, as in .test, so the match is bounded. I'm withdrawing that comment.

What I read: the full diff of docs/guide/comparing.md, docs/guide/deploying.md and harness/lib/handles.mjs. I also read search hits around resolveHere and PDS_HANDLE_DNS_SERVER. The pull's diff is very large because it includes a merge of main. I did not read the Rust sources (migration.rs, identity/resolve.rs, the MST change), harness/checks/moves.mjs, the spec pages and lexicons, or harness/conformance.yaml. My approval covers the guide fixes and the handle harness only.

Approved

I read the change since my approval at 47e5b69 and found nothing that breaks it. The only spec edit rewords the PDS_MAX_REPO_IMPORT_SIZE row in LIMITS.md, with no behaviour change. The rest moves the docs-site deploy from the docs workflow to just docs-deploy and points the README and astro.config.mjs at the private site host. AGENTS.md, contributing.md, the Justfile and the workflow comments agree with each other. I checked only that they match, not that the deploy works. I did not re-read the Rust sources, the moves harness run or the spec pages. The approval still covers only what it covered before.

Two guide gaps from last round remain, and I'm not holding the pull for them. PDS_HANDLE_DNS_SERVER and the import-repo command still have no entry in docs/guide/.

Approved

I read the change since my approval at 1f36566. It is docs only, and nothing in it breaks the approval.

Both guide gaps I flagged earlier are now closed:

  • PDS_HANDLE_DNS_SERVER has a row in docs/guide/deploying.md.
  • import-repo appears in docs/guide/calling.md with a piped get-repo example.

Both additions match the spec pages they link to. I did not re-read the Rust sources, the moves harness run or the spec pages. The approval still covers only what it covered before.

Merged as a3369cf