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

Cleanup the core messages now that v0 is gone #652

Merged
merged 1 commit into from
Jun 20, 2022

Conversation

josephschorr
Copy link
Member

  • 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

@josephschorr josephschorr added area/datastore Affects the storage system kind/tech debt Addresses legacy code/decisions area/dispatch Affects dispatching of requests labels Jun 10, 2022
@josephschorr josephschorr requested a review from jakedt June 10, 2022 20:17
@josephschorr josephschorr requested a review from vroldanbet as a code owner June 10, 2022 20:17
@josephschorr josephschorr requested a review from a team June 10, 2022 20:17
@github-actions github-actions bot added area/api v0 Affects the v0 API area/api v1 Affects the v1 API area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Jun 10, 2022
Copy link
Contributor

@vroldanbet vroldanbet left a 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{
Copy link
Contributor

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?

Copy link
Member Author

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

Comment on lines +72 to +73
var foundNonTerminalUsersets []*core.ObjectAndRelation
var foundTerminalUsersets []*core.ObjectAndRelation
Copy link
Contributor

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?

Copy link
Member Author

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 ];
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Referenced below

Comment on lines +250 to +251
ResourceAndRelation: &core.ObjectAndRelation{},
Subject: &core.ObjectAndRelation{},
Copy link
Contributor

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?

Copy link
Member Author

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

@josephschorr
Copy link
Member Author

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?

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"

@vroldanbet
Copy link
Contributor

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 kuberesolver could be improved to differentiate also on deployments. Depending on whoch the rolling upgrade strategy is configured, it could lead to multiple hashring reconfigurations and thus inefficient usage of the caches during the rollout.

- 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
@jakedt jakedt merged commit c6f3b29 into authzed:main Jun 20, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/api v0 Affects the v0 API area/api v1 Affects the v1 API area/datastore Affects the storage system area/dispatch Affects dispatching of requests area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) kind/tech debt Addresses legacy code/decisions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants