fix(targets): remove path advice for format refusals

Readable executable format refusals report their source format reason and an unsupported-target category instead of misleading missing-path advice. Preserve actual path/permission errors, WASM static recovery, and native target source inspection.

Verified on Linux x64 through actual CLI/fresh stdio MCP: three NE/LE/LX controls, exact canonical projection parity, unchanged bytes, responsiveness and a missing-path control. 103 focused tests across nine files, full static gate and generated documentation passed.

Fixes #1979
Refs #1852

Co-authored-by: Ha1baraA11 <243105435+Ha1baraA11@users.noreply.github.com>
Co-authored-by: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
Ha1baraA1
2026-10-12 08:08:16 +08:00
committed by GitHub
co-authored by Ysopwnable factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Kaoru0822
parent e9fe6437a7
commit f28f338283
4 changed files with 91 additions and 9 deletions
+10 -2
View File
@@ -76,6 +76,11 @@ export const analysisErrorRemediationAction = (
error.constraint === "directory_requires_file"
)
return "For a JavaScript/Electron application directory, call analyze_javascript_application with input_path or run `rea analyze <directory>`. For binary analysis, select its executable file.";
if (
error instanceof BinaryTargetError &&
error.constraint === "file_format_rejected"
)
return "Review the reported file-format reason and select a supported, well-formed target.";
if (
error instanceof BinaryTargetError &&
error.constraint === "wasm_requires_static_inspection"
@@ -102,7 +107,8 @@ export const analysisErrorCategory = (
): AnalysisErrorProjection["category"] => {
if (
error instanceof BinaryTargetError &&
error.constraint === "wasm_requires_static_inspection"
(error.constraint === "wasm_requires_static_inspection" ||
error.constraint === "file_format_rejected")
)
return "unsupported_target";
if (
@@ -231,7 +237,9 @@ export const analysisErrorUserMessage = (error: AnalysisError): string => {
if (error instanceof BinaryTargetError)
return error.constraint === "directory_requires_file"
? "open_binary accepts files and macOS app bundles. This target is a directory; JavaScript/Electron application directories can be analyzed directly with analyze_javascript_application or `rea analyze <directory>`."
: `${error.message}. Check that the path exists, is readable, and points to a supported file.`;
: error.constraint === "file_format_rejected"
? `${error.message}.`
: `${error.message}. Check that the path exists, is readable, and points to a supported file.`;
if (error._tag === "ProcessCaptureError")
return (
error.userMessage ??
+2 -1
View File
@@ -40,7 +40,8 @@ export class NoBinaryOpenError extends AnalysisError {
export interface BinaryTargetErrorOptions extends AnalysisErrorOptions {
readonly constraint?:
| "directory_requires_file"
| "wasm_requires_static_inspection";
| "wasm_requires_static_inspection"
| "file_format_rejected";
}
/** A supplied target path could not be safely opened as a supported app or binary. */