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

Check for changes to the public API #141

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented Oct 17, 2023

We would like to get to a stage where we can commit to the public API. To help us achieve this add a script that generates the public API and checks it against three committed files, one for each feature set: no features, alloc, std.

The idea is that with this applied any PR that changes the public API should include a final patch that is just the changes to the api/*.txt files, that way reviewers can discuss the changes without even needing to look at the code, quickly giving concept ACK/NACKs. We also run the script in CI to make sure we have not accidentally changed the public API so that we can be confident that don't break semver during releases. The script can also be used to diff between two release versions to get a complete list of API changes, useful for writing release notes and for users upgrading.

There is a development burden involved if we apply this patch.

@tcharding
Copy link
Member Author

This is the same idea as rust-bitcoin/rust-bitcoin#1880

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 62a188d

@apoelstra
Copy link
Member

Definitely need @clarkmoody to weigh in before we can move forward on this :)

@tcharding
Copy link
Member Author

There is a fair bit of context in the PR I link to above @clarkmoody, no rush on this one. Thanks

@tcharding
Copy link
Member Author

tcharding commented Oct 27, 2023

Rebased and added changelog section so this conforms to mkchlog (introduced in #155), please do not merge until after #155.

@apoelstra
Copy link
Member

cc @clarkmoody can you take a look at this?

@tcharding
Copy link
Member Author

Rebased and improved to use functions. Also removed the mkchlog stuff in the commit message.

@tcharding
Copy link
Member Author

I can split this up like rust-bitcoin/rust-bitcoin#1880 if its easy for you guys to review.

@tcharding tcharding force-pushed the 10-17-check-public-api branch 3 times, most recently from 119b9f2 to c82b303 Compare January 25, 2024 01:21
@tcharding
Copy link
Member Author

I can't work out why this is failing. Its giving a different sort order than what is in the PR (ie., I'm getting a different order locally to what the VM in CI is getting)?

@apoelstra
Copy link
Member

See discussion on rust-bitcoin/hex-conservative#34 (looks like we didn't do this for rust-secp; surprised we haven't had problems there). I think we want sort -n which seems to be more consistent between implementations, and then --unique doesn't work properly so we want to pipe into | uniq?

Regardless of reasoning, we should cargo-cult sort -n | uniq from the hex-conservative crate and see if that fixes things.

@tcharding tcharding force-pushed the 10-17-check-public-api branch 7 times, most recently from 8fccd49 to 099b1f8 Compare January 27, 2024 03:59
@tcharding
Copy link
Member Author

OMG finally, this sort command got us there SORT="sort --numeric-sort --ignore-case --stable --unique".

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 099b1f8

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

Rescinding ACK. This produces nearly-empty API .txt files.

@tcharding
Copy link
Member Author

Ugh, bollocks.

@tcharding tcharding marked this pull request as draft January 29, 2024 22:34
@tcharding
Copy link
Member Author

I'm going to debug this in hex-conservative, sorry for all the noise, I had no idea it would be such a PITA.

We would like to get to a stage where we can commit to the public API.
To help us achieve this add a script that generates the public API and
checks it against three committed files, one for each feature set: no
features, alloc, std.

The idea is that with this applied any PR that changes the public API
should include a final patch that is just the changes to the api/*.txt
files, that way reviewers can discuss the changes without even needing
to look at the code, quickly giving concept ACK/NACKs. We also run the
script in CI to make sure we have not accidentally changed the public
API so that we can be confident that don't break semver during releases.
The script can also be used to diff between two release versions to get
a complete list of API changes, useful for writing release notes and for
users upgrading.
@tcharding tcharding marked this pull request as ready for review January 31, 2024 03:17
@tcharding
Copy link
Member Author

@clarkmoody are you ok if we merge this? It adds additional burden to contributors with the stated aim of improving our ability to commit to a stable API.

@tcharding
Copy link
Member Author

Gentle bump please @clarkmoody, really don't want to merge this without your consent and I'd love to release a non-beta version of this crate v0.10.0.

Copy link
Member

@clarkmoody clarkmoody left a comment

Choose a reason for hiding this comment

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

ACK 8241316

:shipit:

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 8241316

@apoelstra apoelstra merged commit ea5385e into rust-bitcoin:master Feb 13, 2024
13 checks passed
@tcharding tcharding deleted the 10-17-check-public-api branch February 22, 2024 02:36
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.

None yet

3 participants