Skip to content

Conversation

@acoulton
Copy link
Contributor

@acoulton acoulton commented Dec 8, 2025

Added a github action using roave/backward-compatibility-check to highlight potential breaking changes in PRs.

Added a github action using roave/backward-compatibility-check to
highlight potential breaking changes in PRs.
We have generally considered it acceptable for BC to add strict
parameter types that match the pre-existing phpdoc types.

Roave reports all of these since it doesn't read the phpdoc at all.
Rather than having a large and potentially hard to follow baseline I
think it's better we suppress that whole class of errors.

Maintainers will continue to manually review parameter type additions,
as we have previously.
@acoulton
Copy link
Contributor Author

acoulton commented Dec 8, 2025

@carlos-granados while this won't necessarily cover everything (and from experimenting so far it produces a few false positives) I think worth having an extra layer of safety checking in our build as we start working towards 4.x - particularly because I want to start making some backwards-compatible changes in 3.x first to minimise the diff between the two versions.

Copy link
Contributor

@carlos-granados carlos-granados left a comment

Choose a reason for hiding this comment

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

Wouldn't it be useful to add this dependency as a regular dev dependency, not only in CI? In this way we could run a BC check locally before submitting a PR

@acoulton
Copy link
Contributor Author

acoulton commented Dec 8, 2025

Wouldn't it be useful to add this dependency as a regular dev dependency, not only in CI? In this way we could run a BC check locally before submitting a PR

The problem is it has quite a few dependencies, including some that it shares with us in stricter versions - e.g. it requires symfony/console:^7.4.0 so it would then constrain the dependencies we can install for all other jobs. There's no shim package available that I can see - their recommended way to avoid that is to run as a docker image but I ran into a couple of issues with that including the check for file/directory ownership in recent git versions, and the docker images also don't appear to be up to date with the latest releases.

It doesn't have to be installed within the project context - once installed it runs against any project directory - so installing it standalone alongside felt like a neater/safer solution.

It's possible to use the same shell steps as the actions job to install it locally in a subdirectory (or any directory) and run it from there assuming the environment has the required tools e.g. git.

I could commit that as a shell script instead of having it just in the actions job, but I actually wonder if it's easier to let people work that out for themselves / tweak it for their preferences rather than trying to have an officially-supported-way of doing it especially given the variations in shells / composer installations / etc?

At some point I might try to look at whether there's anything I can do to get the docker-based flow working neatly (and possibly look at a couple of other issues/enhancements that I've already spotted with it) but I don't want to get too sidetracked from our own 4.x at the moment.

@carlos-granados
Copy link
Contributor

Wouldn't it be useful to add this dependency as a regular dev dependency, not only in CI? In this way we could run a BC check locally before submitting a PR

The problem is it has quite a few dependencies, including some that it shares with us in stricter versions - e.g. it requires symfony/console:^7.4.0 so it would then constrain the dependencies we can install for all other jobs. There's no shim package available that I can see - their recommended way to avoid that is to run as a docker image but I ran into a couple of issues with that including the check for file/directory ownership in recent git versions, and the docker images also don't appear to be up to date with the latest releases.

It doesn't have to be installed within the project context - once installed it runs against any project directory - so installing it standalone alongside felt like a neater/safer solution.

It's possible to use the same shell steps as the actions job to install it locally in a subdirectory (or any directory) and run it from there assuming the environment has the required tools e.g. git.

I could commit that as a shell script instead of having it just in the actions job, but I actually wonder if it's easier to let people work that out for themselves / tweak it for their preferences rather than trying to have an officially-supported-way of doing it especially given the variations in shells / composer installations / etc?

At some point I might try to look at whether there's anything I can do to get the docker-based flow working neatly (and possibly look at a couple of other issues/enhancements that I've already spotted with it) but I don't want to get too sidetracked from our own 4.x at the moment.

Understood. Could we at least add some instructions/pointers explaining how to set this up locally? I myself would like to use this tool

@acoulton
Copy link
Contributor Author

acoulton commented Dec 8, 2025

Understood. Could we at least add some instructions/pointers explaining how to set this up locally? I myself would like to use this tool

Good idea - added to the BC section of the contributing docs.

Copy link
Contributor

@carlos-granados carlos-granados left a comment

Choose a reason for hiding this comment

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

Great addition @acoulton

@acoulton acoulton merged commit 5178a7a into Behat:3.x Dec 8, 2025
22 checks passed
@acoulton acoulton deleted the 3.x-add-bc-check-action branch December 8, 2025 11:53
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.

3 participants