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

Use cargo semver-checks for release testing #13665

Open
Tracked by #13648
crepererum opened this issue Dec 5, 2024 · 3 comments
Open
Tracked by #13648

Use cargo semver-checks for release testing #13665

crepererum opened this issue Dec 5, 2024 · 3 comments

Comments

@crepererum
Copy link
Contributor

What

We run cargo semver-checks before (pre-)releasing a new version. Maybe even for every PR (it's rather expensive though).

Why

Also see #13648.

While it doesn't necessarily prevent breaking changes, but it might make accidental ones more visible. For example, running this for 2ac8af8 (which compares against v43.0.0), we get the following things that I think could be avoided (this is a small subset of what the tool found):

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.37.0/src/lints/enum_variant_added.ron

Failed in:
  variant PlanType:PhysicalPlanError in /home/mneumann/src/arrow-datafusion/datafusion/common/src/display/mod.rs:66
--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.37.0/src/lints/struct_missing.ron

Failed in:
  struct datafusion_expr::DocumentationBuilder, previously in file /home/mneumann/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-expr-43.0.0/src/udf_docs.rs:95
  struct datafusion_expr::DocSection, previously in file /home/mneumann/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-expr-43.0.0/src/udf_docs.rs:67
  struct datafusion_expr::Documentation, previously in file /home/mneumann/.cargo/registry/src/index.crates.io-6f17d22bba15001f/datafusion-expr-43.0.0/src/udf_docs.rs:35

We could even add a config to the repo that defines what we accept, for example:

--- failure auto_trait_impl_removed: auto trait no longer implemented ---

Description:
A public type has stopped implementing one or more auto traits. This can break downstream code that depends on the traits being implemented.
        ref: https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.37.0/src/lints/auto_trait_impl_removed.ron

Failed in:
  type Max is no longer UnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:383
  type Max is no longer RefUnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:383
  type Min is no longer UnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:298
  type Min is no longer RefUnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:298
  type Count is no longer UnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:214
  type Count is no longer RefUnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:214
  type Sum is no longer UnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:101
  type Sum is no longer RefUnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:101
  type Statement is no longer UnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/logical_plan/statement.rs:33
  type Statement is no longer RefUnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/logical_plan/statement.rs:33
  type Statement is no longer UnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/logical_plan/statement.rs:33
  type Statement is no longer RefUnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/logical_plan/statement.rs:33
  type Avg is no longer UnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:456
  type Avg is no longer RefUnwindSafe, in /home/mneumann/src/arrow-datafusion/datafusion/expr/src/test/function_stub.rs:456

How

TBD

@findepi
Copy link
Member

findepi commented Dec 5, 2024

I like the checks but note that we need to be able to introduce breaking changes, because sometimes there is no practical other way. If we enable API check, we should have a suppression- / allow-list for it.
DataFusion is great but it also needs a way to innovate. New processes that considerably reduce our pace may turn out not to be good for the project in the long run.

also, i got the impression that the sentiment in #13525 was that compilation-level breakages are not necessarily a problem (#13525 (comment), seconded in #13525 (comment))

@crepererum
Copy link
Contributor Author

To clarify: I don't want the checks to totally prevent breaking changes. I just want to make sure that they are visible and we don't break stuff that can easily be prevented (e.g. removing a valid re-export during some refactoring).

@findepi
Copy link
Member

findepi commented Dec 5, 2024

I agree with this desire, but it's also important to make this goal clear.
A check along may nudge us into wrong direction. For example, in OSS contributions i've seen people deteriorating their contribution because they saw a failing test that simply needs an update.

(e.g. removing a valid re-export during some refactoring).

Agreed.
But we also should deliberately hide elements that are not meant to be API or have sort of "internal" modules to imply no guarantees.
The smaller the API surface the less blame there can be for breaking it.

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

No branches or pull requests

2 participants