From 77e106c0f36490163d36b7b5415517b7fa865b50 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Mon, 16 Nov 2026 03:09:51 +0800 Subject: [PATCH] fix(services): name the refused field instead of a CLI option in service input issues (#11315) inspect_analysis_view and inspect_il2cpp_metadata wrote "--evidence-bundle" and "--ghidra-seeds needs --binary" into their own input issues, copying the CLI's option spelling into the service. They now name the field (binary_path) or the input ("An Evidence bundle"), and the CLI's field binding keeps owning option spellings. A counted architecture guard records the 41 remaining REA CLI option spellings outside src/cli (mostly "(CLI: --flag)" remediation hints) so the list can only shrink. --- scripts/verify/architecture-guards.mjs | 15 +++++++++++ .../cli-option-text-outside-cli.json | 25 +++++++++++++++++++ .../analysisView/AnalysisViewService.ts | 2 +- .../il2cpp/Il2cppMetadataService.ts | 2 +- tests/acceptance/il2cppMetadataCli.test.ts | 3 ++- tests/boundary/cli/analysisViewCli.test.ts | 13 ++++++++++ 6 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 scripts/verify/baselines/cli-option-text-outside-cli.json diff --git a/scripts/verify/architecture-guards.mjs b/scripts/verify/architecture-guards.mjs index 64f206074a..e1093b50b5 100644 --- a/scripts/verify/architecture-guards.mjs +++ b/scripts/verify/architecture-guards.mjs @@ -452,6 +452,21 @@ checkCounted( ["src/gdb/GdbMiRecord.ts"], ); +// Services name the contract field they refuse or ask the caller to change; +// the CLI layer owns option spellings (each command's field binding renames +// issue paths to CLI keys). A `--flag` written outside src/cli copies that +// mapping and goes stale when the command renames the option. +checkCounted( + "REA CLI option named outside the CLI layer (name the contract field; src/cli owns option spellings)", + "cli-option-text-outside-cli", + files.filter( + ({ path }) => + !path.startsWith("src/cli/") && !/^src\/cli[^/]*\.ts$/u.test(path), + ), + /\(CLI:? [^)\n]*--[a-z]|--[a-z][a-z0-9-]* on the CLI|or (?:use|pass) --[a-z]|\bcli(?:Flag|Total|PerFile)?:\s*"--[a-z]|(?:message|userMessage):\s*["`]--[a-z]/gu, + [], +); + // A runtime setting view throws the ConfigurationError of a malformed launch // seed; readRuntimeSetting in src/config/runtimeAnalysisSettings.ts returns it // as a Result. Catching it by hand mixes it into each site's own failures. diff --git a/scripts/verify/baselines/cli-option-text-outside-cli.json b/scripts/verify/baselines/cli-option-text-outside-cli.json new file mode 100644 index 0000000000..6bf50555ac --- /dev/null +++ b/scripts/verify/baselines/cli-option-text-outside-cli.json @@ -0,0 +1,25 @@ +{ + "src/application/Doctor.ts": 1, + "src/application/EvidenceBundleFiles.ts": 1, + "src/application/decompileDirectory/decompileAll.ts": 1, + "src/application/reverse/ReverseEngineeringService.ts": 2, + "src/application/wasm/WasmArtifactService.ts": 1, + "src/domain/analysisErrorPresentation.ts": 2, + "src/domain/javascript/javascriptAnalysisResourceControls.ts": 5, + "src/domain/javascript/javascriptSemanticResourceLimits.ts": 1, + "src/domain/webBundleAnalysis.ts": 1, + "src/dotnet/ManagedDecodeBudget.ts": 1, + "src/dotnet/ManagedMemberRecovery.ts": 1, + "src/dotnet/ManagedSnapshot.ts": 1, + "src/ghidra/GhidraFileOffsetFailure.ts": 1, + "src/ghidra/GhidraProviderClient.ts": 2, + "src/javascript/analysis/JavaScriptAnalysisWorker.ts": 1, + "src/native/AppleDispatchMetadata.ts": 1, + "src/native/NativeCommandAnalysisError.ts": 2, + "src/native/NativePlistSource.ts": 1, + "src/native/NativeUiInterruptionControl.ts": 1, + "src/native/pwntools/PwntoolsDecoder.ts": 2, + "src/native/pwntools/PwntoolsFailures.ts": 5, + "src/rust/RustBinaryProvider.ts": 6, + "src/sqlite/SqliteDatabaseWorkerExecution.ts": 1 +} diff --git a/src/application/analysisView/AnalysisViewService.ts b/src/application/analysisView/AnalysisViewService.ts index 6016797a6e..8890206c08 100644 --- a/src/application/analysisView/AnalysisViewService.ts +++ b/src/application/analysisView/AnalysisViewService.ts @@ -131,7 +131,7 @@ const inspectBundleView = async ( path: ["source", "kind"], reason: "invalid_value", message: - "--evidence-bundle requires a retained-evidence source with the exact parent evidence_id; inline Evidence already supplies its source", + "An Evidence bundle needs a retained-evidence source with the exact parent evidence_id; inline Evidence already supplies its source", }, ]), ); diff --git a/src/application/il2cpp/Il2cppMetadataService.ts b/src/application/il2cpp/Il2cppMetadataService.ts index 00e745a155..be548db8c4 100644 --- a/src/application/il2cpp/Il2cppMetadataService.ts +++ b/src/application/il2cpp/Il2cppMetadataService.ts @@ -111,7 +111,7 @@ export class Il2cppMetadataService { path: ["ghidra_seeds"], reason: "invalid_value", message: - "--ghidra-seeds needs --binary to link method addresses.", + "Ghidra seed output links method addresses in binary_path.", }, ]), ); diff --git a/tests/acceptance/il2cppMetadataCli.test.ts b/tests/acceptance/il2cppMetadataCli.test.ts index eb6e4ba0e3..edfab70f36 100644 --- a/tests/acceptance/il2cppMetadataCli.test.ts +++ b/tests/acceptance/il2cppMetadataCli.test.ts @@ -1416,7 +1416,8 @@ cliTest( issues: [ { path: ["ghidra_seeds"], - message: expect.stringContaining("needs --binary"), + message: + "Ghidra seed output links method addresses in binary_path.", }, ], }, diff --git a/tests/boundary/cli/analysisViewCli.test.ts b/tests/boundary/cli/analysisViewCli.test.ts index 65918f5ad5..5942341bf4 100644 --- a/tests/boundary/cli/analysisViewCli.test.ts +++ b/tests/boundary/cli/analysisViewCli.test.ts @@ -223,6 +223,19 @@ cliTest( expect(rejected.exitCode).toBe(1); expect(rejected.json).toMatchObject({ code: expectedCode }); expect(rejected.json).not.toHaveProperty("evidence_id"); + // The service names the field it refuses; option spellings belong to + // the CLI layer. + if (source.kind === "inline") + expect(rejected.json).toMatchObject({ + details: { + issues: [ + { + path: ["source", "kind"], + message: expect.not.stringContaining("--"), + }, + ], + }, + }); } for (const [contents, expectedCode, freshProcess] of [ [JSON.stringify(parent), "invalid_request", false],