fix(errors): name rea doctor only for providers it can check (#10565)

* fix(errors): name rea doctor only for providers it can check

An unclassified ProviderAdapterError, an unreadable result and the final
presentation fallback all told the caller to run rea doctor, although doctor
checks only hopper, ghidra, ida, jadx, kuna and desktop_build. The doctor
scope list moves into the domain so presentation can consult it: covered
providers get `rea doctor --provider ID`, others are told plainly that the
failure is unclassified and where its reason is reported.

Producers whose actionable reason lived only in details.diagnostics now
author it: Ghidra's committed-profile conflicts share one owner that says to
reopen the target, closed analysis clients share one owner, and a jadx-reported
request failure no longer points at provider readiness. The deep-analysis
profile rejection names doctor only for doctor-checkable providers. Dead
presentation branches for tags handled earlier are removed.

* fix(errors): make provider recovery actionable

* test(android): remove brittle recovery wording check

* test: wait for observed child exit before cancellation

* test(errors): check that doctor is not offered instead of matching recovery prose
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 18:09:40 +08:00
1 parent 428e006f66
commit 4aefe2daec
24 files changed
+257 -143

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ import type { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.j
import type { ClientRegistrationStatus } from "./ClientRegistrationStatus.js";
import type { DoctorCheck, DoctorHost, DoctorSkillState } from "./Doctor.js";
import { nodeCheck } from "./DoctorDiagnostics.js";
import { DESKTOP_BUILD_PROVIDER_ID } from "./DoctorProviderIds.js";
import { DESKTOP_BUILD_PROVIDER_ID } from "../domain/doctorProviderIds.js";
import type { DoctorScopeReport } from "./DoctorScope.js";
/** Free space agentenv's images need where Docker keeps them. */
+1 -1
View File
@@ -6,7 +6,7 @@ import {
import { hopperLauncherDiscovery } from "./HopperLauncherDiscovery.js";
import { macosMajorVersion } from "../domain/macosVersion.js";
import { LINUX_HOPPER_SETUP_HOSTS, supportsReaHost } from "./LinuxHopper.js";
import { isDesktopBuildCheck } from "./DoctorProviderIds.js";
import { isDesktopBuildCheck } from "../domain/doctorProviderIds.js";
import type {
DoctorCheck,
DoctorHost,
-16
View File
@@ -1,16 +0,0 @@
/** Doctor's id for the desktop build host scope. */
export const DESKTOP_BUILD_PROVIDER_ID = "desktop_build";
/** Deep-analysis providers and the desktop build host, whose readiness doctor can select explicitly. */
export const DOCTOR_PROVIDER_IDS = [
"hopper",
"ghidra",
"ida",
"jadx",
"kuna",
DESKTOP_BUILD_PROVIDER_ID,
] as const;
/** Whether a check belongs to the desktop build scope, which decides only its own health. */
export const isDesktopBuildCheck = (name: string): boolean =>
name.startsWith(`${DESKTOP_BUILD_PROVIDER_ID}-`);
+1 -1
View File
@@ -9,7 +9,7 @@ import { isDesktopBuildInformationalCheck } from "./DesktopBuildDoctor.js";
import {
DESKTOP_BUILD_PROVIDER_ID,
isDesktopBuildCheck,
} from "./DoctorProviderIds.js";
} from "../domain/doctorProviderIds.js";
import type {
DoctorCheck,
DoctorProviderInspection,
+1 -1
View File
@@ -41,7 +41,7 @@ import type {
SkillInstallResult,
} from "./SetupSkill.js";
import { planDesktopBuild } from "./SetupDesktopBuild.js";
import { DESKTOP_BUILD_PROVIDER_ID } from "./DoctorProviderIds.js";
import { DESKTOP_BUILD_PROVIDER_ID } from "../domain/doctorProviderIds.js";
import type {
SetupHopperInstallFailure,
SetupHopperInstallResult,
+1 -1
View File
@@ -1,6 +1,6 @@
import { DESKTOP_EXPORT_FRAMEWORK_VERSION } from "../domain/desktop/appExport.js";
import { AGENTENV_INSTALL_COMMAND } from "./DesktopBuildDoctor.js";
import { DESKTOP_BUILD_PROVIDER_ID } from "./DoctorProviderIds.js";
import { DESKTOP_BUILD_PROVIDER_ID } from "../domain/doctorProviderIds.js";
import { assertSetupActive } from "./SetupCancellation.js";
import type {
SetupAction,
@@ -18,6 +18,7 @@ import type {
import type { AnalysisProviderCandidateStatus } from "./AnalysisProviderRegistry.js";
import { withCandidateRejections } from "./AnalysisProviderCandidateDiagnostics.js";
import { ProviderAdapterError } from "../../domain/providerAdapterError.js";
import { isDoctorProviderId } from "../../domain/doctorProviderIds.js";
import {
providerReleaseVerificationSchema,
type ProviderReleaseVerification,
@@ -105,7 +106,7 @@ export const evaluateAnalysisProviderCandidate = async (
return ok(
rejectedProfile(candidate, status, {
reason: "Provider version or analysis profile could not be resolved",
remediation: PROFILE_REMEDIATION,
remediation: profileRemediation(candidate),
}),
);
const profile = analysisProfileSchema.parse(resolved.value.profile);
@@ -119,7 +120,7 @@ export const evaluateAnalysisProviderCandidate = async (
return ok(
rejectedProfile(candidate, status, {
reason: "Resolved analysis profile has mismatched provider identity",
remediation: PROFILE_REMEDIATION,
remediation: profileRemediation(candidate),
}),
);
const verification =
@@ -132,7 +133,7 @@ export const evaluateAnalysisProviderCandidate = async (
return ok(
rejectedProfile(candidate, status, {
reason: "Provider returned invalid release verification",
remediation: PROFILE_REMEDIATION,
remediation: profileRemediation(candidate),
}),
);
return ok({
@@ -157,7 +158,7 @@ export const evaluateAnalysisProviderCandidate = async (
return ok(
rejectedProfile(candidate, status, {
reason: "Provider returned an invalid analysis profile",
remediation: PROFILE_REMEDIATION,
remediation: profileRemediation(candidate),
}),
);
}
@@ -166,8 +167,13 @@ export const evaluateAnalysisProviderCandidate = async (
const signalIsAborted = (signal: AbortSignal | undefined): boolean =>
signal?.aborted === true;
const PROFILE_REMEDIATION =
"Run rea doctor to check this provider's installation and version, then reopen the target, or select another analysis provider.";
/** Name doctor only for a provider whose installation it can check. */
const profileRemediation = (candidate: AnalysisProviderCandidate): string => {
const providerId = candidate.identity().id;
return isDoctorProviderId(providerId)
? `Run rea doctor --provider ${providerId} to check this provider's installation and version, then reopen the target, or select another analysis provider.`
: `Check the ${providerId} provider's installation and version against its documented requirements, then reopen the target, or select another analysis provider.`;
};
const rejectedProfile = (
candidate: AnalysisProviderCandidate,
@@ -669,7 +669,10 @@ describe("analysis provider registry: rejection diagnostics", () => {
providerId: "alpha",
origin: "availability",
code: "version_unresolved",
remediation: expect.stringContaining("rea doctor") as unknown,
// doctor cannot check this provider, so it is not offered.
remediation: expect.not.stringContaining(
"rea doctor",
) as unknown,
},
],
},
+5 -6
View File
@@ -1,6 +1,9 @@
import { AnalysisCapabilityUnavailableError } from "../../domain/analysisErrorCore.js";
import { ProviderCleanupError } from "../../domain/providerCleanupError.js";
import { ProviderAdapterError } from "../../domain/providerAdapterError.js";
import {
closedAnalysisClientError,
ProviderAdapterError,
} from "../../domain/providerAdapterError.js";
import { projectAnalysisError } from "../../domain/analysisErrorProjection.js";
import { err, ok } from "../../domain/result.js";
import type { BinaryTarget } from "../../domain/binaryTargetTypes.js";
@@ -217,11 +220,7 @@ export class CompositeProvider implements AnalysisProvider {
},
execute: async (operation, parameters, options) => {
if (closed)
return err(
new ProviderAdapterError(this.#identity.id, operation, {
diagnostics: { reason: "client_closed" },
}),
);
return err(closedAnalysisClientError(this.#identity.id, operation));
if (operation === "health")
return executeCompositeHealth(this.#identity, clients, options);
const provider = this.#providerByOperation.get(operation);