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:
morluto authored and GitHub committed 2026-11-15 18:38:24 +08:00
1 parent 0ddc732c69
commit 2826592759
86 files changed
+554 -1012

No files matched your search

+2 -6
View File
@@ -7,10 +7,10 @@ import {
type AnalysisError,
} from "../domain/analysisErrorBase.js";
import {
AnalysisCancelledError,
AnalysisCapabilityUnavailableError,
AnalysisInputError,
AnalysisOutputError,
cancelledBy,
} from "../domain/analysisErrorCore.js";
import { createEvidence, type Evidence } from "../domain/evidence.js";
import { jsonObjectSchema } from "../domain/jsonValue.js";
@@ -157,11 +157,7 @@ export class WebModuleTraceService {
let resolutionFailure: AnalysisError | undefined;
if (literals.length > 0) {
if (options?.signal?.aborted)
return incomplete(
new AnalysisCancelledError(OPERATION, {
cause: options.signal.reason,
}),
);
return incomplete(cancelledBy(OPERATION, options.signal));
const request = {
importerUrl,
importMap: