Check for changes to the public API#1880
Check for changes to the public API#1880tcharding wants to merge 3 commits intorust-bitcoin:masterfrom
Conversation
|
This is amazing. It even shows shit like
Only the last point needs to be addressed in this PR. |
Yeah, sick huh. I foresee a world of scripts that automagically tells us impls, derives, and just what code in general we need to write - chatGPT eat your heart out.
Its a win already! I love this tool.
ha! That is why I added the script as an initial patch, it kinda made testing during dev easy actually but I didn't think about future changes - I'll mess around with it, like you say, in a followup.
Yep nice. I'll throw that in this PR.
Ha! I didn't even read the date thinking this was to run in CI and nightly would be the latest one, @stevenroose is going to have a heart attack (\me chuckles to himself).
Epic, I'm on it. |
ae108a9 to
67837a7
Compare
|
Currently a bunch of warnings are generated when running the script, this is annoying. See #1884 |
67837a7 to
2a95237
Compare
|
Changes in force push:
|
|
In #1884 I suggested silencing the warnings with |
|
Might be polite to leave this one open for a week or two before merging so other folk can see it since it effects everyone's workflow. |
513d91f to
ac81dde
Compare
|
Force pushed to remove the attribute and allow broken intra doc links on the command line by setting |
ac81dde to
848c8ef
Compare
|
Noticed the commit brief log was stale (still mentioned api.txt), reworded and force pushed. |
|
Nice! But wouldn't be better to perform the API-break-check in a standard rust test instead, as suggested here? https://github.com/Enselic/cargo-public-api#-as-a-ci-check |
|
@RCasatta honestly I think for what we're doing (comparing two text files to each other) shell is way better. It doesn't require an extra |
848c8ef to
4c26073
Compare
|
Changes in force push:
|
|
Dang, this script might not be able to be run in CI without giving limiting the output using -impl<V, T> ppv_lite86::types::VZip<V> for bitcoin::bip152::PrefilledTransaction where V: ppv_lite86::types::MultiLane<T>
+impl<V, T> ppv_lite86::types::types::VZip<V> for bitcoin::bip152::PrefilledTransaction where V: ppv_lite86::types::types::MultiLane<T>
pub fn bitcoin::bip152::PrefilledTransaction::vzip(self) -> V
pub struct bitcoin::bip152::ShortId(_)
impl bitcoin::bip152::ShortId
@@ -1796,6 +1796,9 @@ impl core::marker::Sync for bitcoin::bip152::ShortId
impl core::marker::Unpin for bitcoin::bip152::ShortId
impl core::panic::unwind_safe::RefUnwindSafe for bitcoin::bip152::ShortId
impl core::panic::unwind_safe::UnwindSafe for bitcoin::bip152::ShortId
+impl<'f, T> bech32::CheckBase32<alloc::vec::Vec<bech32::u5, alloc::alloc::Global>> for bitcoin::bip152::ShortId where T: core::convert::AsRef<[>
+pub type bitcoin::bip152::ShortId::Err = bech32::Error
+pub fn bitcoin::bip152::ShortId::check_base32(self) -> core::result::Result<alloc::vec::Vec<bech32::u5, alloc::alloc::Global>, <T as bech32::Ch>
impl<T, U> core::convert::Into<U> for bitcoin::bip152::ShortId where U: core::convert::From<T>
pub fn bitcoin::bip152::ShortId::into(self) -> U
impl<T, U> core::convert::TryFrom<U> for bitcoin::bip152::ShortId where U: core::convert::Into<T>
@@ -1812,9 +1815,6 @@ impl<T> alloc::string::ToString for bitcoin::bip152::ShortId where T: core::fmt:
pub fn bitcoin::bip152::ShortId::to_string(&self) -> alloc::string::String
impl<T> bech32::Base32Len for bitcoin::bip152::ShortId where T: core::convert::AsRef<[u8]>
pub fn bitcoin::bip152::ShortId::base32_len(&self) -> usize
-impl<T> bech32::CheckBase32<alloc::vec::Vec<bech32::u5, alloc::alloc::Global>> for bitcoin::bip152::ShortId where T: core::convert::AsRef<[u8]>
-pub type bitcoin::bip152::ShortId::Err = bech32::Error
-pub fn bitcoin::bip152::ShortId::check_base32(self) -> core::result::Result<alloc::vec::Vec<bech32::u5, alloc::alloc::Global>, <T as bech32::Ch>
impl<T> bech32::ToBase32 for bitcoin::bip152::ShortId where T: core::convert::AsRef<[u8]>
pub fn bitcoin::bip152::ShortId::write_base32<W>(&self, writer: &mut W) -> core::result::Result<(), <W as bech32::WriteBase32>::Err> where W: b>
impl<T> core::any::Any for bitcoin::bip152::ShortId where T: 'static + core::marker::Sized |
4c26073 to
43cca34
Compare
|
Changes in force push:
We might have a few teething problems with this one but I rekon we will be able to work them out within a few PRs after this merges - its worth it. |
|
Looks good! We may want to revisit |
apoelstra
left a comment
There was a problem hiding this comment.
ACK 43cca341afc089a389dd93e713623af03375ca1e
Yep, agree. Did you see that one can pass this flag multiple times also? If we get too much grief from CI we could play with hard fails vs soft warnings for different combinations of features (i.e., I'm guessing |
yancyribbens
left a comment
There was a problem hiding this comment.
Interesting idea, but the txt files are huge. Do the .txt files that document the API actually need to be checked into git?
I think we only care about what changed, not where in the txt file items are listed (what order). It looks like some of the lines show as changed when in reality they are now on a different line of the txt file? |
Pull Request Test Coverage Report for Build 7749810170
💛 - Coveralls |
2775fc0 to
a9a3a0d
Compare
|
Looks like the script needs to be rerun. |
|
Ah you solved it here: rust-bitcoin/rust-bech32#141 (comment) Legend |
cf4ae5e to
6c84a5e
Compare
|
Ouch - damn sort order is still different! |
4e6580a to
884cfd2
Compare
|
Updated to mirror those done in |
|
I guess this conflicts with #2353 let's get that one in first. Also I'm not very happy about having to run another foreign binary. Note that binary uses nightly which @stevenroose doesn't want. |
|
Yes, this PR will prevent @stevenroose from changing the API (without copy/pasting stuff out of the diff in the CI failure). But even moreso than clippy, I want/expect issues from this job to be rare, so I think the nightly dependence (and the dependence on a mystery-meat cargo-install crate) is okay. |
We would like to check for API changes during development and in CI so that such changes can be discussed separately from the code. We have API listings already. 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.
884cfd2 to
944583d
Compare
|
Rebase only, no other changes. |
I don't. This includes minor changes and ignores the fact that we do a lot of breaking changes lately anyway. I definitely do. |
|
This one effects devs heavily, if Kix is not into it lets leave for a later release. |
|
I think we should just do this (though we should open a new PR) and tag Kix, saying that we'll revert it (or at least, remove it from CI and/or move it to a weekly "update the API files" job) when he returns. |
|
Lets do it. I've tickled the script a little in the first patch and updated all the api files.
|
|
The UI doesn't seem to want me to re-open, perhaps i should have re-opended before force pushing. Anyway, I'll open a new PR. |
76331ae Add a just cmd to check for API changes (Tobin C. Harding) b222f40 CI: Add job to check for API changes (Tobin C. Harding) 9e7cd97 Add a script to check the public API (Tobin C. Harding) Pull request description: 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 ACKs for top commit: apoelstra: 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" Tree-SHA512: 67b20e2ce0c22aa67be931c4da0b591bc351ccb1aa620003c60bfb4b10d5c292edceca929bf6318993f2d16f9f58374aac336adf0f8234c5e2f16e3857b7901b
Add a script that checks the public API of
hashesandbitcoin. 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.Now includes a
justcommand to run the script:just check-apiImplied workflow change
This PR imposes workflow changes, it may trigger your anti-authoritarian side.
Explicitly: all PRs that change the public API of
bitcoin,hashes,io, orunitsmust 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