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
ping/rust: remove the master dependency #45
Conversation
a8d306f
to
07ed00d
Compare
07ed00d
to
4d15703
Compare
4d15703
to
fae0ea9
Compare
This issue got me thinking about the need for a more permanent fix, notes in #35 (comment) |
#[cfg(all(feature = "libp2pv0480",))] | ||
pub use libp2pv0480::*; | ||
#[cfg(all(feature = "libp2pmaster",))] | ||
pub use libp2pmaster::*; | ||
|
||
#[cfg(all(feature = "libp2pv0470",))] | ||
pub use libp2pv0470::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(creating here to get a thread)
@mxinden, I'm trying to catch other cases where the build might break after a push to master
.
- If
rust-libp2p
remove a feature flag in master, I guess thelibmaster
line inCargo.toml
will become invalid, and it will break the build. Even for old versions, Correct? - if
rust-libp2p
publishes an API breaking change inmaster
, could it break the build of previous versions? I assume the decoration#[cfg(all(feature = "libp2pmaster",))]
completely removes the code and we're safe here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
rust-libp2p
remove a feature flag in master, I guess thelibmaster
line inCargo.toml
will become invalid, and it will break the build. Even for old versions, Correct?
Correct. Though this will change soon where we can replace all the features with a single full
. See libp2p/rust-libp2p#2918.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if
rust-libp2p
publishes an API breaking change inmaster
, could it break the build of previous versions? I assume the decoration#[cfg(all(feature = "libp2pmaster",))]
completely removes the code and we're safe here.
I am not sure I follow. Once a crate is published to crates.io it can never be changed again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I mixed versions and packages which is unclear,
I'm wondering if there are other cases where a push to rust-libp2p master branch can break the build for previous versions of the ping test (cargo build --feature libp2pv0470
, for example).
- We fixed one case with this PR (when we push a version bump),
- We know another case (when we change feature flags),
- Do you see other cases?
Trying to play around with macro it looks like it's enough, but I might miss some rust's edge cases.
// cargo build --features libp2pmaster (FAIL)
// cargo build --features libp2pv2 (OK)
fn main() {
println!("got: {}", s() + 1)
}
#[cfg(all(feature = "libp2pmaster",))]
fn s() -> String {
return String::from("new master API that breaks the current helloworld test");
}
#[cfg(all(feature = "libp2pv2",))]
fn s() -> i32 {
return 2;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell this looks good to me. I hope we can find a more elegant fix in the future, though I think going with this is worth it given that it unblocks the status quo.
@@ -13,7 +13,7 @@ rand = "0.8" | |||
serde = {version = "1", features = ["derive"]} | |||
serde_json = "1" | |||
soketto = "0.7.1" | |||
testground = {git = "https://github.com/testground/sdk-rust", branch = "master", version = "0.4.0"} | |||
testground = {git = "https://github.com/testground/sdk-rust", rev = "94a9a72796f94cc7ca786a5f019d07f328c76d4b", version = "0.4.0"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just released testground
v0.4.0
. How about using that instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #43
Problem definition:
rust-libp2p
repository the ability to build and test theirmaster
branch (which is also used when testing fork and PRs).go-libp2p
) from failure due to unchecked changes in therust-libp2p
repository.The case we've seen with #43:
rust-libp2p
,master
branchlibp2pv0480 = { git= ... branch = master, version = 0.48.0}
breaks because the version cannot be found.This is a valid change (the
rust-libp2p
didn't break the interop contract, they "just" updated versions) which broke thego-libp2p
repository.Root cause
The way we implement compatibility/features flags with rust has two constraints:
rust-1
andrust-2
, theCargo.toml
, which contains every version, includingmaster
, has to be valid.