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
add back invalid cache reporting #9925
Conversation
which was removed in vimeo#9889 - now we won't report for every error but if there are at least 10 errors (chosen arbitrarily) Cherry picked from vimeo#9914
@orklah this restores psalm's current behavior for the cache (5.12.0 and before), except the failure limit is 10 instead of 1. If we really want to ignore errors in cache reads/writes, someone who wants this needs to create a PR for that to make it consistent in all locations where cache data is used (and either add a configuration option to enable/disable this behavior OR report a single message at the end of psalm's run to stderr that invalid cache data was found/writes failed) But for the time being, I think it's a bad idea that some cache errors are ignored while many (most?) are not. |
IMHO cache should be disposable |
Why then ignore 10 arbitrary errors...? After reading through the discussion in the original PR, I felt like there are four things important for the ppl discussing (in no particular order):
(Not sure if I do understand 'disposable' in this context correctly, but I assume it is smth along the lines of 'if not there / corrupted do not fail execution') I 100% agree with 1 and 4.
For 3: Well optimal case would be that. But require that every little possibility is handled in a consistent manner before accepting / merging that bit of code is overkill. Every little step will help and step-by-step we will get there. For 2: Yes, but not 100% silent (see my points about 1&4) |
This PR is not to discuss about whether cache should be disposable or not. I totally agree that it's fine to make the cache disposable, please create a PR for that. This PR just adds back consistent behavior as it has been
As a compromise. It was 1 error originally, then it was PRed that it inconsistently ignores some errors but others not. This is just a preliminary compromise.
I wouldn't necessarily report only when --debug is set, but generally report these (in stderr?), as otherwise you might not be aware that there is an issue with cache at all.
I don't think so. Either it's disposable or not; otherwise we will end up in a discussion on what is "serious" and what is not? e.g. is a
Making it consistent is just removing all the "throw" where cache data is used explicitly. This is not a big task/PR, so shouldn't be an issue to PR this as one. Why this is important that it's done as one: otherwise the origin of the issue is hidden. E.g. it will throw at a place X, but the issue already happened 5 steps prior when reading from cache, but you don't know that (since that is ignored/not thrown) |
@ro0NL yes, but it is not disposable now. It is only disposable in a random number of cases if you look at the code base, e.g. https://github.com/vimeo/psalm/blob/master/src/Psalm/Internal/Provider/FileReferenceCacheProvider.php#LL355C1-L357C88 Everybody has understood that cache should be disposable at this point. It only needs somebody to ACTUALLY make it disposable. It's really not that hard to remove all the "throw" where cache data is used, perhaps a good first issue for you? |
so it was intendted to be disposable, and this pr reverts that? why not focus on fixing the remaning cases here? instead of saying others should do it.
@ygottschalk yes, and it's a core semantic of cache IMHO @kkmuffme sorry if i annoy you 🥺 im just invested in psalm/GHA and cache :) |
The intent of #9889 was to make the cache not absurdly large and, while doing so, a sizeable refactor was required and #8679 was fixed in the refactor. The intent of the latter was to uniformly make it forgiving / self healing and that might have been missed in some specific cases which you've noticed. The direction here should be to fix those remaining inconsistencies, not to undo the #8679 fix. @orklah made a good call to separate these two discussions in #9914 because now the intent of this PR is more clearly visible and I can say 👎 on it without dismissing the compression configuration I had no issues with. |
Exactly. |
Good we're on the same page, it seems we needed to have a sizeable discussion involving 5 people to get here. 👍
Unfortunately I don't have the time to work on Psalm currently, sorry. Feel free to fix any issues you noticed or at least list them in an issue so I (or somebody) will work on them when we get the time. Thanks! |
Sorry for making this a discussion....
My thoughts were focused around a clean output but having the option to investigate when someone notices a problem. My vote would go to having the issues hidden unless But while we are at adding some warnings: I would like to have some warnings to show up (not errors failing execution and in this case show them always regardless of |
I agree output shouldn't be swamped with cache-related output by default, they're transitive and should be there only if I requested them. Focus of Psalm is not to debug its cache, it's to warn the user about errors in their code. Having Psalm spew out what's basically infrastructural notifications in the same stream actual error messages which the user is actually interested in (which is exactly the reason why they're using it to begin with) is like you're working as maintenance in a hotel and then run around yelling at guests a lightbulb in lobby #2 burnt out. They don't care, it's not why they're here, you should care because that's your job, fix it and move on. |
My two cents on that:
So, while it's not my first preference, I'd be inclined to merge this, unless someone tells me he wants to work on the opposite direction. It's fine, we can always change it later if it still an itch we want to scratch, but at least in the meantime, it will be consistent Any disagreement? |
@orklah the current solution as proposed in this PR will actually increase the possible number of crashes than the current master, as I'm reading it. |
Yeah, more than current master but not more than the last release if I understood correctly. And cache corruption doesn't happen in the wild that often so it doesn't seem that big a deal for now |
@orklah that's incorrect, the changes done in the cache.gz PR reduced / disabled the errors thrown, this PR is trying to undo that. 😃 |
yeah, that's what I was saying, your PR was not yet released so it would make no difference with the current stable release. As I said above, I'm okay with reducing errors, but only if we're consistent |
But this PR doesn't increase consistency. 🤔 It's up to you, if you merge here, make sure to reopen #8679 because this PR re-breaks that. |
@kkmuffme just for clarity, could you put here examples of where a corrupted cache will make Psalm crash on current master? |
Here, take this.
It was caused by swapping src to phar, and solved by wiping previous cache 🙄 aka manual labor. (edit: i assume this was fixed on current master) |
I do not have a lot of time but I put #9932 out there. It is just a small starting point, but I think that is the direction to go. Can fix (if wanted) the case given here #9925 (comment), just leave some feedback or a👍 on the relevant comment in PR. Would be nice if someone can confirm I did not miss anything relevant.... |
Thanks @ygottschalk, with the PR #9932 I think we can get the consistency needed. I'll leave this PR open until the other one gets merged. |
which was removed in #9889 - now we won't report for every error but if there are at least 10 errors (chosen arbitrarily)
Cherry picked from #9914