mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 13:12:26 +00:00
refactor(application): build application cancellations with a required reason (#10574)
* refactor(application): build application cancellations with a required reason Migrate every AnalysisCancelledError construction under src/application to cancelledBy and lower the guard baseline from 671 to 442. Shutdown refusals in BinarySession report OwnerCancellation.ownerClosed when the caller did not abort, instead of an undefined reason. ReverseEngineeringService and DesktopBuildOwnedWork close their work with the typed owner reason. SharedStartupAttempt returns the departing caller's reason with a cancelled wait. One shared isAborted predicate replaces eleven local copies and narrows a checked signal for cancelledBy. * refactor(desktop): drop an unused cancellation import from desktop capture state
This commit is contained in:
1 parent
0ddc732c69
commit
2826592759
86 files changed
+554
-1012
No files matched your search
@@ -7,9 +7,9 @@ import type {
|
||||
ListElectronTargetsInput,
|
||||
} from "../../domain/javascript/electronObservation.js";
|
||||
import {
|
||||
AnalysisCancelledError,
|
||||
AnalysisCapabilityUnavailableError,
|
||||
AnalysisOutputError,
|
||||
cancelledBy,
|
||||
} from "../../domain/analysisErrorCore.js";
|
||||
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
|
||||
import { err, ok, type Result } from "../../domain/result.js";
|
||||
@@ -33,11 +33,7 @@ export const listElectronTargets = async (
|
||||
const ready = requireProvider(provider, "list_electron_targets");
|
||||
if (!ready.ok) return ready;
|
||||
if (options.signal?.aborted)
|
||||
return err(
|
||||
new AnalysisCancelledError("list_electron_targets", {
|
||||
cause: options.signal.reason,
|
||||
}),
|
||||
);
|
||||
return err(cancelledBy("list_electron_targets", options.signal));
|
||||
const result = await ready.value.listTargets(input, options);
|
||||
if (!result.ok) return result;
|
||||
const json = jsonValueSchema.safeParse(result.value);
|
||||
@@ -78,11 +74,7 @@ export const inspectElectronPage = async (
|
||||
const ready = requireProvider(provider, "inspect_electron_page");
|
||||
if (!ready.ok) return ready;
|
||||
if (options.signal?.aborted)
|
||||
return err(
|
||||
new AnalysisCancelledError("inspect_electron_page", {
|
||||
cause: options.signal.reason,
|
||||
}),
|
||||
);
|
||||
return err(cancelledBy("inspect_electron_page", options.signal));
|
||||
const result = await ready.value.inspectPage(input, options);
|
||||
if (!result.ok) {
|
||||
const partial = jsonObjectSchema.safeParse(result.error.partialObservation);
|
||||
|
||||
Reference in new issue
Block a user