Skip to content

Check for changes to the public API#2713

Merged
apoelstra merged 3 commits intorust-bitcoin:masterfrom
tcharding:05-26-check-public-api
May 18, 2024
Merged

Check for changes to the public API#2713
apoelstra merged 3 commits intorust-bitcoin:masterfrom
tcharding:05-26-check-public-api

Conversation

@tcharding
Copy link
Copy Markdown
Member

This PR is #1880 re-opened.

Add a script that checks the public API of hashes and bitcoin. Document how to use it during development. Call it in CI. Do not add it to githooks because the githooks because its expected to be run per PR not per commit.

Includes a just command to run the script: just check-api

Implied workflow change

This PR imposes workflow changes.

Explicitly: all PRs that change the public API of bitcoin, base58, hashes, io, or units must contain changes to the api text files.

Suggestion: We add the patch updating api text files as a separate patch at the end of each PR so we can haggle over it separately from the actual code changes.

Fix: #1875

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 24, 2024

Pull Request Test Coverage Report for Build 8863062354

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 83.131%

Totals Coverage Status
Change from base Build 8849264030: 0.0%
Covered Lines: 19195
Relevant Lines: 23090

💛 - Coveralls

@tcharding tcharding force-pushed the 05-26-check-public-api branch from 42dad8b to d9656b9 Compare April 24, 2024 22:59
@github-actions github-actions bot added the test label Apr 24, 2024
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In eb1f4030afc0f40b7ba8df308fbfd1c11521d1c6:

trailing whitespace

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.

It is still pending this @tcharding.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My bad, thanks. Fixed now.

@apoelstra
Copy link
Copy Markdown
Member

Note that even though we agreed to just push forward on this, it may take a bit to get in because (a) we still need two ACKs, unless it sits open for 2 weeks without any comments, and (b) it will need to be rebased every time we merge something that changes the API.

apoelstra
apoelstra previously approved these changes Apr 25, 2024
Copy link
Copy Markdown
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 d9656b9630acf0ec99057b520a94e99470e83b59

@tcharding
Copy link
Copy Markdown
Member Author

After two months of being kind of stressed (as stressed as a bloke who works at home in tracksuit pants can be anyways) I found myself this last couple of days in a strange place of calm, just accepting that likely nothing is going to merge any time soon. Finally making some headway in hashes had me actually excited to start work this morning, first time in what seems like ages.

I kind of think we should do your idea of branching off and doing the hashes re-write then merging later when we have it nailed down. Although a bunch of my work is still so exploratory that I'm not sure which stuff is going to work. This week I already deleted a bunch of branches and started from scratch again.

api/README.md Outdated
Comment on lines 1 to 2
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 that documentation is consistent.
All .md files in the repo uses the GH flavor, e.g.

# Contributing to rust-bitcoin
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
The following is a set of guidelines for contributing to Rust Bitcoin

Suggested change
API text files
==============
# API text files

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah yeah, sure thing. Thanks!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tend to use ==== in my own stuff so I went to check that I hadn't introduced any other files and there are tons in this repo

gg '===='
base58/README.md:2:  =======================
bitcoin/tests/data/README.md:2:  ================
bitcoin/tests/data/serde/README.md:2:  ==========================
fuzz/README.md:103:=====================================================================
internals/README.md:2:  ======================
io/README.md:2:  =======================
units/README.md:2:  =============

We should probably make them all uniform.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gg is an alias to git grep -IPn --color=always

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.

Yes my

All .md files

was based on a sample from the root dir .mds. I should have been more specific :/

We should definitely normalize all of them.
I can work in a future PR to normalize markdown, I am quite used from an old gig that I was in charge of technical documentation in scientific software.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sweet, nice one.

api/README.md Outdated
Comment on lines 7 to 8
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.

Also this can be a bash fenced block no?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done, thanks.

@tcharding tcharding force-pushed the 05-26-check-public-api branch 2 times, most recently from 1aaf666 to f228f54 Compare April 26, 2024 22:44
@tcharding
Copy link
Copy Markdown
Member Author

Force push is the two suggested fixes.

apoelstra
apoelstra previously approved these changes Apr 27, 2024
Copy link
Copy Markdown
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 f228f54ff5f5e1c771617a5cd4247110eba66f23

Copy link
Copy Markdown
Contributor

@storopoli storopoli left a comment

Choose a reason for hiding this comment

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

ACK 7e5ff49702221c64e4960b72be979541b168a965

@tcharding tcharding force-pushed the 05-26-check-public-api branch from 7e5ff49 to 32e67a1 Compare May 17, 2024 23:51
@github-actions github-actions bot removed the test label May 17, 2024
@tcharding
Copy link
Copy Markdown
Member Author

Re-based on master, re-ran the script, updated the github action to use new style.

tcharding added 3 commits May 18, 2024 09:54
We would like to check for API changes during development and in CI so
that such changes can be discussed separately from the code.

Add tooling and documentation for creating API listings for the public
crates within the workspace (i.e., not `internals`).

Add API text files from an initial run of the script.
Add a job that runs the new script to check for changes to the public
APIs of `hashes` and `bitcoin`.
Add a `just` command to run the API checking script. Makes it more
discoverable.
@tcharding tcharding force-pushed the 05-26-check-public-api branch from 32e67a1 to 76331ae Compare May 17, 2024 23:55
@tcharding
Copy link
Copy Markdown
Member Author

shellcheck for the win! I had a failing job that found a bug because I'd forgotten to shellcheck the script, well done @storopoli for introducing the CI shellcheck job.

@storopoli
Copy link
Copy Markdown
Contributor

shellcheck for the win! I had a failing job that found a bug because I'd forgotten to shellcheck the script, well done @storopoli for introducing the CI shellcheck job.

Nice I was expecting it to payoff but not that fast ROI...
This probably bumps up the need to add shellcheck to other rust-bitcoin crates.
I'll see what I can cook up this weekend.

Copy link
Copy Markdown
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 76331ae normally would complain about the whitespace but I would like to ACK/merge this quickly since most other PR that gets merged will force it to be rebased. also will one-ACK merge as "no NACKs or comments from maintainers in 2 weeks"

@apoelstra apoelstra merged commit 13569b8 into rust-bitcoin:master May 18, 2024
@tcharding
Copy link
Copy Markdown
Member Author

I went looking for the whitespace issue but couldn't find it. Did #2780 though.

@apoelstra
Copy link
Copy Markdown
Member

@tcharding you introduced trailing whitespace in your first commit and removed it in the last one.

@tcharding
Copy link
Copy Markdown
Member Author

Ah, woops. Cheers.

@tcharding tcharding deleted the 05-26-check-public-api branch May 23, 2024 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check for API breaking changes in CI

4 participants