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

feat: Restructure AIPs 213 and 215, with more common proto details #1117

Merged
merged 8 commits into from
Jun 27, 2023

Conversation

jskeet
Copy link
Contributor

@jskeet jskeet commented May 23, 2023

This is a second attempt, which keeps API-specific protos separate from common protos.

@jskeet
Copy link
Contributor Author

jskeet commented May 24, 2023

This is an alternative to #1107.

Copy link
Collaborator

@noahdietz noahdietz left a comment

Choose a reason for hiding this comment

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

Love it!

Copy link
Contributor

@toumorokoshi toumorokoshi left a comment

Choose a reason for hiding this comment

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

Overall LGTM. The only blocker I have is the should on being aware - doesn't feel actionable.

organization-wide common proto package.
- Organizations **must not** define generic protos in organization-specific
common protos, instead preferring global common protos.
- Common protos **must not** be "moved" from an organization-specific common
Copy link
Contributor

Choose a reason for hiding this comment

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

what if what was originally thought to be an organization-specific concept ends up being more globally applicable? e.g. other organizations would like to use it. Would each organization duplicate the original organization-specific proto?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Either each org could duplicate it, or we could add it to the global common protos, but with the original organization having to stick with their own copy - at least for existing fields. (Perhaps use the new global proto for new APIs, but stick with the org-specific one for all existing APIs using it? Both options are a bit messy.)

Given that this isn't a great experience either way, we should try to avoid getting into this mess - suggestions for processes to help on that front would be welcome!

Copy link
Contributor

Choose a reason for hiding this comment

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

If the type "graduates" to google.type, and remains wire-compatible (serialized proto and JSON), what's the problem with switching to the new copy of the type in google.type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a breaking change for API libraries in statically-typed languages, because the type would be different. Removing it from the org-specific common library would also be a breaking change, as removing public types always is.

The latter breaking change is the big problem, as a new major version of the org-specific common library requires a new major version of all API libraries depending on it.

Basically there are ways this could just about be done, but it's a lot of work - much better to really take the time to work out global/org-specific first. (The DateRange one earlier is a good example of a gray area... we may have got that wrong, but it's unclear. It's not obviously org-specific in that date ranges themselves are quite general - but the detailed requirements of the type around precision, inclusivity etc are org-specific.)

Copy link
Contributor

@rofrankel rofrankel Jun 1, 2023

Choose a reason for hiding this comment

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

If I have an API client that expects google.shoe.type.ShoeSize and the server is updated to use a graduated google.type.ShoeSize...why would my client break?

I agree that a generated GAPIC in a statically typed language would contain a breaking change when regenerated after the switch to the graduated type, but that seems distinct from a breaking change in the API itself. Client code that isn't updated at all would keep working, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that a generated GAPIC in a statically typed language would contain a breaking change when regenerated after the switch to the graduated type

And that's what I'm talking about.

that seems distinct from a breaking change in the API itself.

We've always included "that would cause a breaking change in client libraries" as a breaking change, and I'd want to keep doing so. AIP-180 explicitly calls that out with 3 kinds of compatibility - this would be compatible with item 2 and 3 there, but not with item 1.

Client code that isn't updated at all would keep working, right?

Yes, unless the type is used as an "Any". But there's more to compatibility than "existing code against existing libraries keeps working".

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah fair enough - since AIP-180's item 1 is explicitly includes newer versions of client libraries, that's that I suppose.

Copy link
Contributor

Choose a reason for hiding this comment

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

(Not resolving this thread since I didn't start it, but FWIW, it's resolved as far as I'm concerned.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@toumorokoshi: Are you happy to resolve this now?

@toumorokoshi
Copy link
Contributor

FYI also to @rofrankel who's been looking into common protos for more general AIPs.

Comment on lines 37 to 38
- Organizations **must not** define generic protos in organization-specific
common protos, instead preferring global common protos.
Copy link
Contributor

Choose a reason for hiding this comment

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

...must not define...protos...in...protos

Something about this wording feels off. Maybe "organization-specific packages" rather than "organization-specific protos"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will go over that at the same time as looking at protos/components.

organization-wide common proto package.
- Organizations **must not** define generic protos in organization-specific
common protos, instead preferring global common protos.
- Common protos **must not** be "moved" from an organization-specific common
Copy link
Contributor

Choose a reason for hiding this comment

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

If the type "graduates" to google.type, and remains wire-compatible (serialized proto and JSON), what's the problem with switching to the new copy of the type in google.type?

@jskeet jskeet force-pushed the common-protos-2 branch 2 times, most recently from e7e5248 to fc6fc33 Compare June 2, 2023 13:59
Copy link
Contributor Author

@jskeet jskeet left a comment

Choose a reason for hiding this comment

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

@rofrankel: I've taken another pass at this - PTAL. AIP-215 is still more "proto-oriented" than "component-oriented" as it's describing the API protos themselves; I'm hoping that's okay.

Feedback on any of the changes is welcome.

organization-wide common proto package.
- Organizations **must not** define generic protos in organization-specific
common protos, instead preferring global common protos.
- Common protos **must not** be "moved" from an organization-specific common
Copy link
Contributor

Choose a reason for hiding this comment

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

(Not resolving this thread since I didn't start it, but FWIW, it's resolved as far as I'm concerned.)

Copy link
Contributor

@rofrankel rofrankel left a comment

Choose a reason for hiding this comment

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

Approving in order not to block any longer on the one remaining open thread - any resolution to it works for me. In general this seems like a good PR and it should get merged.

@jskeet jskeet added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 7, 2023
@jskeet
Copy link
Contributor Author

jskeet commented Jun 7, 2023

Added "do not merge" so that client libraries folks can take a look before we merge.

@jskeet
Copy link
Contributor Author

jskeet commented Jun 15, 2023

@toumorokoshi: Please could you reapprove? (You requested changes about "should be aware" - I took your suggestion.)

@jskeet jskeet force-pushed the common-protos-2 branch from a03b099 to da0b5f4 Compare June 15, 2023 07:27
resource names ([AIP-122][]), rather than using the resource messages.
- When two versions of an API use effectively the same (API-specific) proto
that proto **must** be duplicated in each version. (In other words, APIs
**must not** create their own "API-specific common comonent" packages.)
Copy link
Contributor

Choose a reason for hiding this comment

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

s/comonent/component/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Darn, again? Sorry, will fix. (I'm going to look at the more significant comment tomorrow.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@jskeet jskeet force-pushed the common-protos-2 branch from da0b5f4 to 5bf4949 Compare June 16, 2023 08:19
@jskeet jskeet removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 20, 2023
@jskeet
Copy link
Contributor Author

jskeet commented Jun 20, 2023

@toumorokoshi: Ping for reapproval? Will squash and merge if so - I think everyone from Client Libraries is happy now (or at least has had ample chance to raise objections).

"generic" and "organization-specific" is a gray area; some generic *concepts*
have organization-specific use cases which surface through the components.

## Existing global common components
Copy link
Contributor

@bshaffer bshaffer Jun 20, 2023

Choose a reason for hiding this comment

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

I'd love to see a section for ## Existing organization-wide common components as well. I understand that this runs the risk of going out of date, but it would still be very helpful to categorize the ones that exist today for reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay - I'm basically on vacation now until next week, and I'd like to get this merged before then if possible, but I can definitely take this as an action item for next week.

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM! Added an issue to follow up #1142

organization-wide common component package.
- Organizations **must not** define generic components in organization-specific
common component packages, instead preferring global common components.
- Common components **must not** be "moved" from an organization-specific common
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be nice to define "move" a bit more here - is completely copying the proto not allowed? if not, what happens when a concept does become common across multiple protos?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added clarification, and a "may" for copy-without-removal.

Copy link
Contributor

@toumorokoshi toumorokoshi left a comment

Choose a reason for hiding this comment

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

A couple nits but nothing blocking. Thanks!

Copy link
Contributor Author

@jskeet jskeet left a comment

Choose a reason for hiding this comment

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

Addressed review comments in a new commit - @toumorokoshi if you could review just the last commit to check that it works for you, that would be great.

organization-wide common component package.
- Organizations **must not** define generic components in organization-specific
common component packages, instead preferring global common components.
- Common components **must not** be "moved" from an organization-specific common
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added clarification, and a "may" for copy-without-removal.

@jskeet jskeet force-pushed the common-protos-2 branch from 5bf4949 to f696aac Compare June 26, 2023 14:57
This is a second attempt, which keeps API-specific protos separate
from common protos.
@jskeet jskeet force-pushed the common-protos-2 branch from f696aac to 9a490ee Compare June 27, 2023 15:30
@jskeet jskeet enabled auto-merge (squash) June 27, 2023 15:31
@jskeet jskeet merged commit 7a3a67a into aip-dev:master Jun 27, 2023
@jskeet jskeet deleted the common-protos-2 branch June 27, 2023 15:31
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.

7 participants