mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 19:53:50 +00:00
refactor(browser): build browser cancellations with a required reason (#10581)
* refactor(errors): require a reason for every analysis cancellation Add cancelledBy, the one constructor for AnalysisCancelledError. Its reason argument is required: an aborted signal, an earlier cancellation, a reason carried from an inner failure, or an OwnerCancellation when REA closed the work's owner itself. Closed adb, apktool, firmware, sqlite, gdb, web-bundle analyzer and binary-session record owners now report OwnerCancellation.ownerClosed instead of an absent reason. Firmware's predecessor wait returns its cancellation as a Result, removing an unreachable reason-less fallback. An architecture guard rejects new direct constructions, with a counted per-file baseline that can only shrink. * refactor(errors): share one aborted-signal predicate with cancelledBy * refactor(process): return a departing caller's reason from a shared startup wait * refactor(browser): build browser cancellations with a required reason Migrate every AnalysisCancelledError construction under src/browser, src/javascript, src/electron, src/inspector and src/captures to cancelledBy and lower the guard baseline from 671 to 572. Service-worker setup aborts with OwnerCancellation.ownerClosed on close. * refactor(providers): build decompiler-provider cancellations with a required reason (#10587) Migrate every AnalysisCancelledError construction under src/ghidra, src/ida, src/cutter, src/jeb and src/kuna to cancelledBy and lower the guard baseline from 671 to 572. Closed Kuna target commands report OwnerCancellation.ownerClosed instead of an absent reason, and Kuna and JEB close abort their lifetimes with that typed reason. * fix(errors): read the reason of any signal-shaped cancellation source * test(ci): cover the counted-baseline comparison behind the architecture guard * refactor(electron): drop an unused error import from the fuse failure mapper
This commit is contained in:
1 parent
a761efda70
commit
b3cdbb92ee
41 files changed
+298
-425
No files matched your search
@@ -40,6 +40,7 @@ import {
|
||||
AnalysisTimeoutError,
|
||||
AnalysisOutputError,
|
||||
AnalysisResourceConstraintError,
|
||||
cancelledBy,
|
||||
} from "../../domain/analysisErrorCore.js";
|
||||
import { ProviderAdapterError } from "../../domain/providerAdapterError.js";
|
||||
import { ProviderCleanupError } from "../../domain/providerCleanupError.js";
|
||||
@@ -332,8 +333,7 @@ export class JavaScriptAnalysisWorker {
|
||||
JavaScriptSourceAnalysisFailure
|
||||
>;
|
||||
try {
|
||||
if (signal?.aborted === true)
|
||||
throw new AnalysisCancelledError(OPERATION, { cause: signal.reason });
|
||||
if (signal?.aborted === true) throw cancelledBy(OPERATION, signal);
|
||||
if (!file.text.included || file.kind !== "javascript")
|
||||
throw new TypeError(
|
||||
"JavaScript analysis worker requires included JavaScript text",
|
||||
@@ -566,8 +566,7 @@ export class JavaScriptAnalysisWorker {
|
||||
if (deadline?.interruption === "cancelled")
|
||||
analysisErrorWithCancellation(
|
||||
error,
|
||||
new AnalysisCancelledError(OPERATION, {
|
||||
cause: deadline.signal.reason,
|
||||
cancelledBy(OPERATION, deadline.signal, {
|
||||
capturedOutput: this.#captured(),
|
||||
}),
|
||||
);
|
||||
@@ -616,8 +615,7 @@ export class JavaScriptAnalysisWorker {
|
||||
const primary = signal?.aborted
|
||||
? analysisErrorWithCancellation(
|
||||
previous,
|
||||
new AnalysisCancelledError(OPERATION, {
|
||||
cause: signal.reason,
|
||||
cancelledBy(OPERATION, signal, {
|
||||
capturedOutput: this.#captured(),
|
||||
}),
|
||||
)
|
||||
@@ -635,10 +633,7 @@ export class JavaScriptAnalysisWorker {
|
||||
if (signal?.aborted === true) {
|
||||
const error = analysisErrorWithCancellation(
|
||||
result.ok ? undefined : result.error.error,
|
||||
new AnalysisCancelledError(OPERATION, {
|
||||
cause: signal.reason,
|
||||
capturedOutput: this.#captured(),
|
||||
}),
|
||||
cancelledBy(OPERATION, signal, { capturedOutput: this.#captured() }),
|
||||
);
|
||||
if (result.ok) this.#lastFailure = error;
|
||||
result = err({ error, javascript, module, projection });
|
||||
@@ -1221,8 +1216,7 @@ export class JavaScriptAnalysisWorker {
|
||||
remediationAction:
|
||||
"Reuse accessible partial_observation Evidence to avoid recomputation; reading it is not a prerequisite for a corrected retry. Increase analysis_timeout_ms through MCP, or use rea analyze-javascript-application <input_path> --analysis-timeout-ms <milliseconds> on the CLI. Alternatively, reduce semantic limits or select exact inventoried source_paths (CLI: --source-path on that command). Omit source_paths to analyze all sources; an empty array is invalid. detail: summary reduces response size, not analysis work. Allow execution, cleanup and delivery headroom in the MCP client tool deadline; increasing that client deadline alone does not change this server budget. Resolve any reported incomplete cleanup before retrying.",
|
||||
})
|
||||
: new AnalysisCancelledError(OPERATION, {
|
||||
cause: deadline.signal.reason,
|
||||
: cancelledBy(OPERATION, deadline.signal, {
|
||||
capturedOutput: this.#captured(),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user