-
Notifications
You must be signed in to change notification settings - Fork 286
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
Cleanup the core messages now that v0 is gone #652
Conversation
josephschorr
commented
Jun 10, 2022
- Renames object_and_relation on the RelationTuple to resource_and_relation
- Renames user on the RelationTuple to subject
- Removes the user_oneof, as it is no longer needed
- Changes DirectUsersets into DirectSubjects
- Various small test fixes
- Remove unneeded conversion methods and change to manually written for the remaining
a6540fa
to
094713d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice cleanup, thank you! ✨ Left some comments about naming.
What's not clear to me is the impact to the proto backward compatibility. Because the type of a field is changed it would look like a breaking change - which seems corroborated by a CI error. What is the plan around that? How can we help folks transition to the newer version without downtime?
@@ -113,19 +113,15 @@ func (cds *crdbDatastore) Watch(ctx context.Context, afterRevision datastore.Rev | |||
|
|||
oneChange := &core.RelationTupleUpdate{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit / For a follow up: the direct proto instantiation tends to be rather verbose, would it make sense to create helper methods to help with readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have some helper methods defined in various places, so we could in theory grab one, but I like that everything is explicitly named here
var foundNonTerminalUsersets []*core.ObjectAndRelation | ||
var foundTerminalUsersets []*core.ObjectAndRelation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intended to continue using the Usersets
nomenclature in these variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The datastores still do, so I'm unsure whether we should change it (we probably should)
ObjectAndRelation resource_and_relation = 1 [ (validate.rules).message.required = true ]; | ||
|
||
/** subject is the subject for the tuple */ | ||
ObjectAndRelation subject = 2 [ (validate.rules).message.required = true ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would seem like a deliberate API breakage, and presumably we are OK with that? Would this cause downtime to clients as the server with the new proto definition is rolled out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referenced below
ResourceAndRelation: &core.ObjectAndRelation{}, | ||
Subject: &core.ObjectAndRelation{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a Subject
does also have a Relation
, which isn't it named SubjectAndRelation
, or perhaps why not naming ResourceAndRelation
just Relation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The real change would be to break the relation out from both, but that is a major refactor, so I left it using ObjectAndRelation. Since I did so, I wanted to be clear that the relation for the operation is in the first ONR
We don't store these protos; they are only used for internal dispatching, so the only real issue with compatibility is during deployment, where dispatches might (briefly) fail. We could back-compat support for that case, or just say "yes, this will have an issue for a short period of time" |
As discussed in standup: understood! I somehow thought those protos where part of the public API. The problem you described perhaps warrants a different conversation on how can we make rolling upgrades that are isolated from each other? Pperhaps |
- Renames object_and_relation on the RelationTuple to resource_and_relation - Renames user on the RelationTuple to subject - Removes the user_oneof, as it is no longer needed - Changes DirectUsersets into DirectSubjects - Various small test fixes - Remove unneeded conversion methods and change to manually written for the remaining