Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account migration schemas #2170

Merged
merged 16 commits into from
Feb 21, 2024
Merged

Account migration schemas #2170

merged 16 commits into from
Feb 21, 2024

Conversation

dholms
Copy link
Collaborator

@dholms dholms commented Feb 12, 2024

Think there's a good question around how these schemas are grouped. Should they all live under a com.atproto.migration interface? Or spread out as they are to their relevant category?

@@ -0,0 +1,36 @@
{
"lexicon": 1,
"id": "com.atproto.repo.listMissingBlobs",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After seeing this, I could imagine moving migration-specific endpoints like this into their own segment, e.g. com.atproto.migrate.listMissingBlobs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think this is a useful route in it's own right fwiw. There are some repos now that are missing blobs and this could be useful to figure out what

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this let external folks discover which blobs have been purged for an account? or do purged blobs not show up in this output?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(dholms replied below; I think the reason the github reply box didn't show in my review is that this comment was on the same line that divy commented on previously?)

"didMigrated": { "type": "boolean" },
"uploadedRepo": { "type": "boolean" },
"importedRepo": { "type": "boolean" },
"importRepoError": { "type": "string" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be nice to make room for an error message and a code/name here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had a change of heart and decided against processing the repo async, that way we can just report the error directly in the request

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm! that is a big change (not being async). it does feel like async would be more general and reliable than keeping a long HTTP request open, and enable a nice dynamic progress bar UI.

but we could add that as an alternative endpoint later.

Copy link
Collaborator

@bnewbold bnewbold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a whole lot of comments. mostly just sharing thoughts.

overall pretty excited, this is looking great!

"schema": {
"type": "object",
"properties": {
"rotationKeys": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a tiny bit weird having rotationKeys here. it matches the PLC operation syntax/fields, but the other fields here match DID document fields but this one doesn't. I guess it's fine? plcRotationKeys is tempting but probably not worth breaking consistency.

a description on this field (in the Lexicon schema) would be good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree :/ But I think it makes most sense to return them here & keep it consistent with the other routes.

One thing we can do that may make it go down a bit easier is not return rotationKeys when this route is requested by a did:web. If we add some additional method that requires another field, we can add another property to the response this would be undefined for plc & web dids

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! that is a good way to handle it.

lexicons/com/atproto/identity/sendPlcOp.json Outdated Show resolved Hide resolved
"defs": {
"main": {
"type": "procedure",
"description": "Signs a PLC operation to update some value(s) in the requesting DID's document.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this endpoint also the same safety checks as sendPlcOp, or nah?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't, because it's used to sign an operation for a possibly different service. Though that reminds me, I do intend to put it behind email verification 👍

"encoding": "application/json",
"schema": {
"type": "object",
"required": ["op"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably expand all these "op" to "operation". eg the plc directory APIs have full "operation".

but not a strong feeling.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh yeah probably a good idea. generally we don't shoot for brevity in lexicon 😛

"defs": {
"main": {
"type": "procedure",
"description": "Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we allow a param to skip validation, like we do for lexicons?

I'd be fine not making the validation optional to start, but maybe add it in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my view, if you want to do that, you should just send the operation to PLC yourself. But yeah we can always add it later if we decide we want it 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! good call

"defs": {
"main": {
"type": "procedure",
"description": "Deactivates a currently active account. Used to finalize account migration with the old host after the account has been activated on the new host.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will we open this up to be the way for folks to temporarily deactivate/reactivate accounts as an account status thing? not sure if described the way it is to set near-term or long-term expectations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think yes, but we shouldn't advertise it as a feature just yet

"parameters": {
"type": "params",
"required": ["aud"],
"properties": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about expiration (exp)? should client be allowed to request longer/shorter tokens within some range?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes me a bit uneasy honestly - I don't think we want to offer long versions of these tokens. If you request one, you should really only be using it once

Copy link
Collaborator

@bnewbold bnewbold Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely think the returned token should have some exp; I guess we can just set it to 5-10min in the future or something like that? Single-use in addition is good, I just don't like the idea of a token floating around that could be used (for the first time) the next day or something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh to clarify - the returned token does have an exp and it's set to 60s 👍

We just don't provide optionality around requesting a longer one

"properties": {
"aud": {
"type": "string",
"format": "did",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we make this format: uri it would work with DIDs and leave the door open to other audience URIs/values... but probably best to keep it DID-only.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like just leaving it DID for now until we see the need for that. I think we can upgrade into format: uri without much trouble

@@ -0,0 +1,36 @@
{
"lexicon": 1,
"id": "com.atproto.repo.listMissingBlobs",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this let external folks discover which blobs have been purged for an account? or do purged blobs not show up in this output?

"cursor": { "type": "string" },
"cids": {
"type": "array",
"items": { "type": "string", "format": "cid" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it is easy or worth it, but if this returned blob objects (eg, with size, mimetype, etc, in addition to CID), might be more ergonomic and helpful for humans. and machines could do things like compute total size of missing objects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm that's not a bad idea 🤔 down to take a stab at it

And to answer the prev question (which GH isn't letting me respond to for some reason), this is not accessible to external accounts, but purged blobs would not show up in the output

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated it to the blob type (similar to output of uploadBlob) which contains all that info 👍

@bnewbold
Copy link
Collaborator

all looking good! I left follow-up comments on importRepo and authtoken sections.

@dholms dholms mentioned this pull request Feb 15, 2024
@@ -9,7 +9,7 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["availableUserDomains"],
"required": ["did", "availableUserDomains"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh this is a sneaky little breaking change we need to be a little careful with for rollout.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup yup - just need to ensure we update all our PDSs before publishing this new agent library

thought it was important to get in before there are other PDSs out in the wild

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

funny, this bit me too, only just now realized I needed to add it. bsky.app was unhappy with my PDS just now until I did. 😆

@dholms dholms merged commit 4c511b3 into main Feb 21, 2024
10 checks passed
@dholms dholms deleted the account-migration-lexicons branch February 21, 2024 01:23
@github-actions github-actions bot mentioned this pull request Feb 21, 2024
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.

4 participants