refactor(errors): require a reason for every analysis cancellation (#10566)

* 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(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
This commit is contained in:
morluto authored and GitHub committed 2026-11-14 15:20:03 -05:00
1 parent 2f4c588584
commit 85da0bd4ee
51 files changed
+900 -488

No files matched your search

+10
View File
@@ -180,6 +180,16 @@ cause when a directly checked caller `AbortSignal` is converted to an
follow indirect cancellation helpers, or prove that an explicit cause equals
the caller's reason. Keep focused boundary and lifecycle tests for those facts.
Build a cancellation with `cancelledBy` from `src/domain/analysisErrorCore.ts`.
Its reason argument is required: an aborted `AbortSignal`, an earlier
`AnalysisCancelledError`, a `carriedReason(...)` recovered from an inner
failure, or an `OwnerCancellation` when REA itself closed the work's owner. The
architecture guard rejects a direct `new AnalysisCancelledError(` outside that
module. Files that still construct one directly are listed with their counts in
`scripts/verify/architecture-guard-baselines.json`; a file may not exceed its
count, and after removing copies run
`node scripts/verify/architecture-guards.mjs --shrink-baselines` to lower it.
`rea/no-evidence-json-preadmission` rejects direct generic JSON parses in
`createEvidence` payload expressions; it does not analyze intermediate values.
`rea/no-positional-tool-contract` rejects catalog indices used to select