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

sync lex: #account firehose event; account status errors; and getAccountStatus endpoint #2263

Merged
merged 13 commits into from
May 29, 2024

Conversation

bnewbold
Copy link
Collaborator

@bnewbold bnewbold commented Mar 2, 2024

As discussed earlier today. Did not include any changes to the #identity event as we don't have consensus on that yet.

Notes/details:

  • I wrote this somewhat quickly and should probably self-review
  • I'm not super opinionated about "Account" / "Repo" terminology
  • bummer that there are required fields on, eg, getLatestCommit. I wedged rev in to getAccountStatus and we could put the cid in there too, and just deprecate getLatestCommit. In that case maybe getRepoStatus is a better name, and clearer in the case of Relay (which doesn't really have an "account", just the repo)
  • I included one inconsistency between the event stream and error status codes: there is no distinction between "AccountDeleted" and "AccountNotFound". I think this sort of makes sense; if the account was deleted, it should look to the outside world the same as if it never existed (on a particular host), but there does need to be a "deleted" account status that goes out on the firehose. I'm not super opinionated about this and we could include an indefinite "account deleted" status if we want them to match one-to-one though

@bnewbold bnewbold requested review from dholms and devinivy March 2, 2024 01:46
"description": "Indicates that the account has a repository which can be fetched from the host that emitted this event."
},
"status": {
"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.

made a tweak here

with token values we normally just use a string type & list the token values in knownValues.

see com.atproto.moderation.defs for an example with report types

Copy link
Collaborator

@devinivy devinivy Mar 4, 2024

Choose a reason for hiding this comment

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

To be honest I am not even sure if we need tokens here— its possible it could be non-namespaced strings.

In my mind the value in tokens is that it allows extensibility by other namespaces, especially in cases where it's friendly for applications to be able to use values that will never make it into the lexicon's knownValues. I don't think that's necessarily needed or even desirable here in the sync endpoints. One reason we may not want that, is that it's nice to keep the values one-to-one with the error types on these sync endpoints, which are not namespaced. That allows you to understand the repo's status fully through the response of e.g. sync.getRepo.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's a good point - and I do tend to agree that this isn't a place that we're asking for extensibility on. Any changes should be part of the formal sync protocol 🤔

So maybe we just do hardcoded values?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would be my vote! I still support keeping it an open union as a little safety net.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it feels like a place "hardcoded" would make sense. agree on keeping it open-union semantics.

Copy link
Collaborator

@dholms dholms left a comment

Choose a reason for hiding this comment

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

besides the change I made, this all looks good 👍

@dholms dholms mentioned this pull request Mar 4, 2024
@dholms
Copy link
Collaborator

dholms commented Mar 4, 2024

Actually on second pass i think i like getRepoStatus better. com.atproto.sync routes generally speak in terms of "repos" and I agree that it probably makes sense for something like getRepoStatus to eventually supersede getLatestCommit

@dholms
Copy link
Collaborator

dholms commented Mar 5, 2024

Also - we should codegen in this PR before merging 👍

},
"deactivated": {
"type": "token",
"description": "Repo hosting status indicating that the repository has been pause and should not be re-distributed, usually on request of the account holder. This may be temporary or indefinite."
Copy link

Choose a reason for hiding this comment

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

s/pause/paused/ (though I'm not sure if "repository has been paused" is the best word here...)

@bnewbold bnewbold marked this pull request as draft April 10, 2024 00:44
@bnewbold bnewbold marked this pull request as ready for review May 21, 2024 01:48
Comment on lines +24 to +36
"properties": {
"did": { "type": "string", "format": "did" },
"active": { "type": "boolean" },
"status": {
"type": "string",
"description": "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.",
"knownValues": ["takendown", "suspended", "deactivated"]
},
"rev": {
"type": "string",
"description": "Optional field, the current rev of the repo, if active=true"
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should results in sync.listRepos also include the hosting status, and perhaps generally have the same shape as this?

Comment on lines +138 to +142
"active": {
"type": "boolean",
"description": "Indicates that the account has a repository which can be fetched from the host that emitted this event."
},
"status": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm alright with keeping active around, though I am not sure it is necessary. It allows a PDS to express some conflicting information, like setting a status with active=true.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just to expand on the reasoning there a bit, I wanted to future-proof a bit against us adding additional status strings in the future. If simple infra implementations match on the status string to either make the account visible or not make the account visible (who knows what kind of weird match/switch control flow they might have), then adding a status code could result in the incorrect behavior. Making it a boolean flag makes the "is account visible or not" behavior very clear, with the status being more of an end-user-visible context and less of a high-stakes "is content redistributed at all".

still agree with your point, just wanted to document that bit of thinking

@dholms dholms merged commit ee0e635 into main May 29, 2024
1 check passed
@dholms dholms deleted the bnewbold/account-event branch May 29, 2024 20:40
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