# social.colibri.beta.polyfill.completeMigration

> Asks the AppView to verify one repo the client copied to its PDS. The AppView syncs the repo from the PDS and compares it with its own copy. On a match the PDS becomes the source of truth. On a mismatch the repo stays hosted by the AppView, and the client may try again.

- Kind: procedure
- Authority: polyfill.beta.colibri.social
- Lexicon: 1
- Published by [colibri.social](https://lexicon.garden/identity/did:plc:mprdjqjluoswa7awzggaggj3), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.polyfill.completeMigration)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.polyfill.completeMigration/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.polyfill.completeMigration/analytics)

## Procedure (`social.colibri.beta.polyfill.completeMigration`)

Type: procedure · POST

### Input (application/json)

- `space` (string · space-ref, required): The space holding the repo.

### Output (application/json)

- `missing` (array): Records the AppView holds that the PDS copy lacks or differs on, when verification fails.
  - `items` (string · at-uri)
- `mode` (ref, required): Where the user's repos live after this call.
  - Reference: `social.colibri.beta.polyfill.defs#hostMode`

### Errors

- `AuthRequired`: The request has no valid service auth.
- `InvalidRequest`: The arguments are inconsistent or malformed beyond schema validation.
- `SpaceNotFound`: No space matches the given space reference.
- `NotAuthorized`: The caller may not write to or read from this repo in the space.
- `RepoNotHosted`: The AppView does not host the caller's repo in this space, because it lives on the caller's PDS. Write to the PDS instead.
- `MigrationNotStarted`: The repo is not in the migrating state.
- `VerificationFailed`: The PDS copy could not be read or did not match.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Asks the AppView to verify one repo the client copied to its PDS. The AppView syncs the repo from the PDS and compares it with its own copy. On a match the PDS becomes the source of truth. On a mismatch the repo stays hosted by the AppView, and the client may try again.",
      "errors": [
        {
          "description": "The request has no valid service auth.",
          "name": "AuthRequired"
        },
        {
          "description": "The arguments are inconsistent or malformed beyond schema validation.",
          "name": "InvalidRequest"
        },
        {
          "description": "No space matches the given space reference.",
          "name": "SpaceNotFound"
        },
        {
          "description": "The caller may not write to or read from this repo in the space.",
          "name": "NotAuthorized"
        },
        {
          "description": "The AppView does not host the caller's repo in this space, because it lives on the caller's PDS. Write to the PDS instead.",
          "name": "RepoNotHosted"
        },
        {
          "description": "The repo is not in the migrating state.",
          "name": "MigrationNotStarted"
        },
        {
          "description": "The PDS copy could not be read or did not match.",
          "name": "VerificationFailed"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "space": {
              "description": "The space holding the repo.",
              "format": "space-ref",
              "type": "string"
            }
          },
          "required": [
            "space"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "missing": {
              "description": "Records the AppView holds that the PDS copy lacks or differs on, when verification fails.",
              "items": {
                "format": "at-uri",
                "type": "string"
              },
              "type": "array"
            },
            "mode": {
              "description": "Where the user's repos live after this call.",
              "ref": "social.colibri.beta.polyfill.defs#hostMode",
              "type": "ref"
            }
          },
          "required": [
            "mode"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.colibri.beta.polyfill.completeMigration",
  "lexicon": 1
}
```
