-
Notifications
You must be signed in to change notification settings - Fork 18k
x/exp/apidiff: support diffing entire modules #60213
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
Comments
Thanks for wanting to improve apidiff! I'm happy that it continues to be useful to your team. I'd be glad to review your CLs, but I no have bandwidth now to work on this myself. However, it might be simpler to, say, do 5 packages per "job". (I'm not familiar with GitHub Actions, so I don't know how feasible this is.) I should point out that comparing modules is more than just comparing each package in the modules:
I feel like there are more subtleties but I can't think of them now. Final nit: |
No problem, I was hoping to contribute this with your guidance :)
For sure, I thought about "fixing" this in our GitHub CI itself, but also felt like this tool and others would benefit from the feature. And I wanted to give back to this tool in some way.
Yep, and it should be reported when not running in
Yeah I was hoping to implement this in a way that would leverage the existing logic for ignoring
Great point, and I agree it would be best to add this later on for the reasons you mention.
Good call.
😄 Yep, you got it! My current PoC heavily relies on extending logic in Question: Do you think it would be better to implement that "module comparison" logic in the |
I've got these figured out (sans nested module creation edge case) with a solution based entirely on fancy/hacky (depends on your perspective) logic in |
All sounds good. I'd prefer if ModuleChanges was in |
CL is here: https://go-review.git.corp.google.com/c/exp/+/495635 First time contributing so feel free to over communicate about best practices here :) |
Looks great! Commented on the CL. |
Maybe automation hasn't gotten around to closing this but the CL was submitted so we can close this. Thanks for all of the help @jba |
Proposal
The documentation in the README indicates the following:
It would be great if it did support module diffing.
I've done some hacking locally and I have a basic, green-path approach working. Before I go any further, I want to make sure this is a desirable change and that my approach is reasonable.
Basic idea
The basic approach is to add a flag
-module-mode
that converts the interpretation of the positional command line arguments into a module path instead of a package path, then take on the/...
wildcard when loading all of the packages underneath it e.g../...
for current dir orcloud.google.com/go/batch/...
for a specific submodule. From there, compare the set of packages in each module. For the export data file workflow, we can utilize thegcexportdata
WriteBundle and ReadBundle APIs.My motivation
In google-cloud-go, we have 100+ nested modules with multiple packages in each. Most of the code is autogenerated. We get massive PRs with all of the generated code. We use
apidiff
to detect breaking changes in the generated code our current implementation aroundapidiff
checks each package that changed using an individual "job", even if multiple of the packages belong to the same module. As a result, we have occasionally hit the maximum "job" limit of 256 (see googleapis/google-cloud-go#7939). Ideally, we would be able toapidiff
entire modules instead of each individual package, saving us jobs to spawn, and reducing the likelihood of missing a backwards incompatible change.cc @jba
The text was updated successfully, but these errors were encountered: