Repository navigation
PHPStan Pro: survive unreadable watched files, watch current config, report worker failures - #6935
Merged
Merged
Conversation
The file monitor hashed every watched file and threw when one could not be read. A config file, baseline or bootstrap file missing for a moment, like during a git checkout, ended PHPStan Pro. Such a file is now missing: deleted while it is gone and new once it is back. Amp-Thread-ID: https://ampcode.com/threads/T-01a1a31a-13cc-766a-8581-5c4eb5a12a01
The file monitor watched the config files PHPStan Pro started with. A file included since then, like a newly generated baseline, was read by every analysis, but its changes were not noticed and nothing was analysed again. Each fixer:worker reads the config again and now tells FixerApplication its config files, which the file monitor watches from then on. Amp-Thread-ID: https://ampcode.com/threads/T-01a1a31a-13cc-766a-8581-5c4eb5a12a01
An exception in the fixer:worker, like a scanned file that cannot be read, rejected a promise nobody handled. The worker kept its connection open and waited forever, the UI showed an analysis in progress, and FixerApplication did not analyse any later change until PHPStan Pro was restarted. The worker now reports the exception as an internal error and ends the analysis. Amp-Thread-ID: https://ampcode.com/threads/T-01a1a31a-13cc-766a-8581-5c4eb5a12a01
FixerApplication validated the ignoreErrors of the config PHPStan Pro started with. For an invalid entry added later, the fixer:worker threw a bare ShouldNotHappenException and the UI showed "Analysis crashed" with "Internal error." The worker now reports the same messages the analyse command shows, like "Ignored error ... is missing a message or an identifier." Amp-Thread-ID: https://ampcode.com/threads/T-01a1a31a-13cc-766a-8581-5c4eb5a12a01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes for PHPStan Pro's long-running process, found by new visual tests in phpstan/phpstan-fixer#298.
phpstan.neonfor a moment, a baseline removed bygit checkout, or a dangling symlink threwCouldNotReadFileExceptionfrom the FileMonitor timer and shut down all of PHPStan Pro.watchedConfigFilesand FixerApplication passes them to the monitor, so config files included after the start are watched.processInProgressstayed set and file monitoring stopped for good. It is now reported asanalysisCrashfollowed byanalysisEnd.Each change has a phpstan-fixer visual test that fails without it (
file-changes.spec.ts: config file missing for a moment, config file included after the start, scanned file that cannot be read, invalid entry in ignoreErrors).