Skip to content

feat(ci): add cargo-public-api checks for public API stability#2525

Merged
blackmwk merged 7 commits into
apache:mainfrom
xanderbailey:add-public-api-checks
May 29, 2026
Merged

feat(ci): add cargo-public-api checks for public API stability#2525
blackmwk merged 7 commits into
apache:mainfrom
xanderbailey:add-public-api-checks

Conversation

@xanderbailey
Copy link
Copy Markdown
Contributor

Add infrastructure to track and enforce the public API surface of all published crates. This catches unintentional breaking changes in PRs by diffing the current API against committed lock files.

  • Add public-api/ directory with lock files for 10 published crates
  • Add GitHub Actions workflow that runs on crate/dependency changes
  • Add make generate-public-api and make check-public-api targets
  • Exclude generated lock files from license header checks

Which issue does this PR close?

  • Closes #.

What changes are included in this PR?

Are these changes tested?

Add infrastructure to track and enforce the public API surface of all
published crates. This catches unintentional breaking changes in PRs by
diffing the current API against committed lock files.

- Add `public-api/` directory with lock files for 10 published crates
- Add GitHub Actions workflow that runs on crate/dependency changes
- Add `make generate-public-api` and `make check-public-api` targets
- Exclude generated lock files from license header checks
@xanderbailey xanderbailey force-pushed the add-public-api-checks branch from 5ee8c0c to f8f24b1 Compare May 28, 2026 21:23
@xanderbailey
Copy link
Copy Markdown
Contributor Author

@liurenjie1024 As discussed in the community sync, thought I'd put up a PR to get the conversation going. Let me know what you think

Copy link
Copy Markdown
Contributor

@Kurtiscwright Kurtiscwright left a comment

Choose a reason for hiding this comment

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

Thank you for finding this concept and getting this PR out so fast, very cool stuff.

# specific language governing permissions and limitations
# under the License.

name: Public API
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this make sense right now when making breaking changes is to some degree expected, though no desirable? I like the Makefile so its simple to get feedback about breaking changes, but to have this in CI seems premature especially with the CI rules around fast failing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the workflow is used to ensure that the public-api doc is in sync, so that when anything changes, the reviewers can be notified. It's not used to ensure api not changing.

Copy link
Copy Markdown
Contributor

@blackmwk blackmwk left a comment

Choose a reason for hiding this comment

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

Thanks @xanderbailey for this pr, I love this idea! Left some comments to address.

- main
pull_request:
paths:
- 'crates/**'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

bindings/python is missing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

do we need python bindings to trigger this? I'm not sure that can cause a public api break in the sense that we're only checking for rust api breaks with cargo-public-api

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make sense to me since currently we don't publish pyiceberg_core as public api.

Comment thread .github/workflows/public-api.yml Outdated
Comment on lines +27 to +28
- 'Cargo.toml'
- 'Cargo.lock'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why we need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah this was a copy paste from audit.yml, apologies, have removed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I prefer to put a public-api.txt file in each crate's root dir, similar to what we did for DEPENDENCIES

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I like that idea also. be7063a

Copy link
Copy Markdown
Contributor

@blackmwk blackmwk left a comment

Choose a reason for hiding this comment

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

Thanks @xanderbailey for this pr!

@blackmwk blackmwk merged commit 324f756 into apache:main May 29, 2026
22 checks passed
Copy link
Copy Markdown
Contributor

@dannycjones dannycjones left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for adding this, it will make API changes so much clearer.

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