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

Run the test suite with assertions off #4366

Closed
wants to merge 1 commit into from

Conversation

greg0ire
Copy link
Member

Q A
Type improvement
BC Break no
Fixed issues n/a

Summary

Enabling assertions to get more coverage was a bad idea, because these
are supposed to be disabled in production, which means you could have
code working in the CI, and not working in production. We do not want
that.

See #4359

Enabling assertions to get more coverage was a bad idea, because these
are supposed to be disabled in production, which means you could have
code working in the CI, and not working in production. We do not want
that.
@greg0ire greg0ire added the CI label Oct 20, 2020
@morozov
Copy link
Member

morozov commented Oct 20, 2020

Enabling assertions to get more coverage was a bad idea, because these are supposed to be disabled in production, which means you could have code working in the CI, and not working in production. We do not want that.

If not have assertions on CI and not have them in production, then where are they supposed to be enabled? We didn't enable them to increase code coverage (although this is how we learned that they are disabled), we enabled them to have them executed on CI.

@greg0ire
Copy link
Member Author

You're right I'm attempting to fix the issue with a wrong solution. Maybe the right solution would be to somehow find a way to limit calls to assert() to simple expressions that do not change anything.

@greg0ire greg0ire closed this Oct 20, 2020
@greg0ire greg0ire deleted the disable-assertions branch October 20, 2020 18:12
@simonwelsh
Copy link

If an INI setting can change what code gets run (and the use of assert() at all causes this) then CI should run with that setting on and with it off

@greg0ire
Copy link
Member Author

@simonwelsh I considered it, but if you want to use that to catch the bug we had with PG, then you will have to run it for the Pg job, so following that logic you might end up with twice as many CI jobs, and we already have ~ 50.

@morozov
Copy link
Member

morozov commented Oct 21, 2020

@greg0ire I believe this should be solved at the static analysis level. Maybe Psalm implements this at a higher level than 3 which we're currently at, or it could be an improvement request (UPD: vimeo/psalm#4392).

The idea is that if there is an assertion around a non-pure expression, it's a bug. As simple as that.

@greg0ire
Copy link
Member Author

I had the same idea but didn't connect it to the concept of pure expressions. Fully agree, this is the right solution, and I'm glad we live in a time where static analysis in PHP is advanced enough to make this a realistic feature request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants