From a27d85782965d3935e113dd9ca405f25085f2bfb Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Sat, 28 Nov 2026 22:32:49 +0400 Subject: [PATCH 1/2] fix(openide): say why the Xdebug/PCOV check before a Coverage run failed PHP for OpenIDE 0.9.7+ reports why a module probe failed, already worded and localized, so the warning carries that message instead of a generic one. A PHP that cannot start for the probe refuses the run: the run itself is started by the same command and would fail the same way. Assisted-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + .../coverage/TestoCoverageProgramRunner.kt | 36 ++++++++++++------- .../testo/openide/FakeLaunchEnvironment.kt | 10 ++++-- .../testo/openide/TestoCoverageRunnerTest.kt | 36 +++++++++++++++++-- 4 files changed, 65 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11bfb0bd..fb61bd88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Fixed - Starting a mutation run no longer reads the coverage report on the UI thread. +- OpenIDE: a Coverage run says why it could not check for Xdebug or PCOV, and refuses to start when PHP cannot be started at all. ## [2026.18] - 2026-11-27 diff --git a/src/openide/kotlin/com/github/xepozz/testo/openide/coverage/TestoCoverageProgramRunner.kt b/src/openide/kotlin/com/github/xepozz/testo/openide/coverage/TestoCoverageProgramRunner.kt index 3b4772cc..8d8129df 100644 --- a/src/openide/kotlin/com/github/xepozz/testo/openide/coverage/TestoCoverageProgramRunner.kt +++ b/src/openide/kotlin/com/github/xepozz/testo/openide/coverage/TestoCoverageProgramRunner.kt @@ -33,6 +33,8 @@ import com.intellij.execution.ui.RunContentDescriptor import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.fileEditor.FileDocumentManager import org.jetbrains.concurrency.Promise +import ru.openide.openphp.settings.launch.PhpModuleProbeFailureKind +import ru.openide.openphp.settings.launch.PhpModuleProbeResult import java.io.File import java.nio.file.Path @@ -139,26 +141,36 @@ open class TestoCoverageProgramRunner : AsyncProgramRunner() { if (driver == TestoCoverageDriver.XDEBUG) mapOf("XDEBUG_MODE" to "coverage") else emptyMap() /** - * Whether the driver's extension is loaded where the process runs: refuses when the module list says it is - * not, answers a warning when there is no module list — the probe failed, which says nothing either way. + * Whether the driver's extension is loaded where the process runs: refuses when the probe lists the modules + * without it, or when PHP did not start for the probe — the run would not start either. Any other failed + * probe says nothing either way and answers a warning naming why. */ private fun checkExtension(driver: TestoCoverageDriver, launch: TestoLaunch): String? { val (extension, name) = when (driver) { TestoCoverageDriver.PCOV -> "pcov" to "PCOV" else -> "xdebug" to "Xdebug" } - val modules = launch.environment.modules(File(launch.workingDirectory)) - if (modules.isEmpty()) { - return "Testo: could not tell whether $name is loaded in ${launch.environment.displayName}; " + - "without it the run writes no coverage." + val environment = launch.environment.displayName + val failure = when (val probe = launch.environment.probeModules(File(launch.workingDirectory))) { + is PhpModuleProbeResult.Known -> { + if (extension in probe.modules) return null + throw ExecutionException( + "Cannot collect coverage: $name is not loaded in the PHP of $environment. " + + "Enable the $extension extension there, or choose the other engine in the configuration.", + ) + } + is PhpModuleProbeResult.Unknown -> probe.failure } - if (extension !in modules) { - throw ExecutionException( - "Cannot collect coverage: $name is not loaded in the PHP of ${launch.environment.displayName}. " + - "Enable the $extension extension there, or choose the other engine in the configuration.", - ) + if (failure.kind == PhpModuleProbeFailureKind.START_FAILURE) { + throw ExecutionException(sentences("Cannot collect coverage: the PHP of $environment did not start.", failure.message)) } - return null + return sentences( + "Testo: could not check whether $name is loaded in $environment.", + failure.message, + "Without it the run writes no coverage.", + ) } + + private fun sentences(vararg parts: String): String = parts.filter { it.isNotBlank() }.joinToString(" ") } } diff --git a/src/openideTest/kotlin/com/github/xepozz/testo/openide/FakeLaunchEnvironment.kt b/src/openideTest/kotlin/com/github/xepozz/testo/openide/FakeLaunchEnvironment.kt index 9b09de72..352e537e 100644 --- a/src/openideTest/kotlin/com/github/xepozz/testo/openide/FakeLaunchEnvironment.kt +++ b/src/openideTest/kotlin/com/github/xepozz/testo/openide/FakeLaunchEnvironment.kt @@ -5,19 +5,21 @@ import com.intellij.openapi.util.io.FileUtil import ru.openide.openphp.settings.launch.PhpExposedPath import ru.openide.openphp.settings.launch.PhpLaunchEnvironment import ru.openide.openphp.settings.launch.PhpLaunchLocality +import ru.openide.openphp.settings.launch.PhpModuleProbeResult import java.io.File /** * A launch environment with rules a test states outright: [mappings] from a host directory to the one the process sees, - * [exposed] for what a report path turns into, [modules] for what the module probe finds. Its command shows plainly - * what the plugin passed: a local one runs `php`, any other runs `env ` with the mounts, the working - * directory and then `php`. + * [exposed] for what a report path turns into, [modules] for what the module probe finds, [probe] for a probe that + * fails. Its command shows plainly what the plugin passed: a local one runs `php`, any other runs `env ` + * with the mounts, the working directory and then `php`. */ class FakeLaunchEnvironment( override val locality: PhpLaunchLocality = PhpLaunchLocality.SameHost, private val mappings: Map = emptyMap(), private val exposed: (String) -> PhpExposedPath = { PhpExposedPath.Visible(it) }, private val modules: Set = emptySet(), + private val probe: PhpModuleProbeResult = PhpModuleProbeResult.Known(modules), override val projectRoot: String = "", override val displayName: String = "fake", ) : PhpLaunchEnvironment { @@ -54,4 +56,6 @@ class FakeLaunchEnvironment( override fun exposeFile(hostFile: String, mountAt: String?): PhpExposedPath = exposed(hostFile) override fun modules(workDir: File?): Set = modules + + override fun probeModules(workDir: File?): PhpModuleProbeResult = probe } diff --git a/src/openideTest/kotlin/com/github/xepozz/testo/openide/TestoCoverageRunnerTest.kt b/src/openideTest/kotlin/com/github/xepozz/testo/openide/TestoCoverageRunnerTest.kt index d3ef12be..3a66e601 100644 --- a/src/openideTest/kotlin/com/github/xepozz/testo/openide/TestoCoverageRunnerTest.kt +++ b/src/openideTest/kotlin/com/github/xepozz/testo/openide/TestoCoverageRunnerTest.kt @@ -13,6 +13,9 @@ import com.intellij.testFramework.fixtures.BasePlatformTestCase import ru.openide.openphp.settings.launch.PhpExposedPath import ru.openide.openphp.settings.launch.PhpLaunchEnvironment import ru.openide.openphp.settings.launch.PhpLaunchLocality +import ru.openide.openphp.settings.launch.PhpModuleProbeFailure +import ru.openide.openphp.settings.launch.PhpModuleProbeFailureKind +import ru.openide.openphp.settings.launch.PhpModuleProbeResult import java.io.File import java.nio.file.Path @@ -94,12 +97,39 @@ class TestoCoverageRunnerTest : BasePlatformTestCase() { assertTrue(refusal.message, refusal.message!!.contains("Xdebug is not loaded")) } - fun testAnUnknownModuleListRunsWithAWarning() { - val covered = covered(TestoCoverageDriver.PCOV, FakeLaunchEnvironment(modules = emptySet())) + fun testAProbeThatTimedOutRunsWithItsReason() { + val probe = failedProbe(PhpModuleProbeFailureKind.TIMEOUT, "The PHP module check timed out after 5000 ms.", timeoutMillis = 5000) - assertTrue(covered.unverifiedExtension, covered.unverifiedExtension!!.contains("could not tell whether PCOV is loaded")) + assertEquals( + "Testo: could not check whether PCOV is loaded in fake. The PHP module check timed out after 5000 ms. " + + "Without it the run writes no coverage.", + covered(TestoCoverageDriver.PCOV, probe).unverifiedExtension, + ) + } + + fun testEveryInconclusiveProbeRunsWithItsReason() { + val failures = mapOf( + PhpModuleProbeFailureKind.NON_ZERO_EXIT to "The PHP module check exited with code 255.", + PhpModuleProbeFailureKind.INVALID_RESPONSE to "The PHP module check returned an empty or invalid module list.", + PhpModuleProbeFailureKind.NO_INFORMATION to "The interpreter did not return module information.", + ) + for ((kind, message) in failures) { + val warning = covered(TestoCoverageDriver.XDEBUG, failedProbe(kind, message)).unverifiedExtension!! + assertTrue(warning, warning.contains(" $message Without it")) + } } + fun testAPhpThatDidNotStartForTheProbeRefusesTheRun() { + val message = "The PHP module check could not start: Cannot run program \"php\": CreateProcess error=2." + val refusal = thrown { + covered(TestoCoverageDriver.XDEBUG, failedProbe(PhpModuleProbeFailureKind.START_FAILURE, message)) + } + assertEquals("Cannot collect coverage: the PHP of fake did not start. $message", refusal.message) + } + + private fun failedProbe(kind: PhpModuleProbeFailureKind, message: String, exitCode: Int? = null, timeoutMillis: Int? = null) = + FakeLaunchEnvironment(probe = PhpModuleProbeResult.Unknown(PhpModuleProbeFailure(kind, message, exitCode, timeoutMillis))) + fun testPhpdbgIsRefusedBeforeStart() { val refusal = thrown { covered(TestoCoverageDriver.PHPDBG) } assertTrue(refusal.message, refusal.message!!.contains("PHPDBG")) From 3f157464d76880f3ef1c48da6e8c455ec6575484 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Sat, 28 Nov 2026 23:12:01 +0400 Subject: [PATCH 2/2] ci: retry dependency downloads longer when Maven Central rate-limits Assisted-By: Claude Opus 5.5 --- gradle.properties | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gradle.properties b/gradle.properties index 7de8fa02..2a66e804 100644 --- a/gradle.properties +++ b/gradle.properties @@ -70,3 +70,7 @@ org.gradle.configuration-cache = true # Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html org.gradle.caching = true + +# Maven Central answers bursts of CI requests with 429; Gradle retries it only 3 times over 3 s by default +systemProp.org.gradle.internal.network.retry.max.attempts = 6 +systemProp.org.gradle.internal.network.retry.initial.backOff = 5000