mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 14:05:49 +00:00
perf(doctor): slim cold CLI/MCP doctor module graphs and run probes concurrently
Record default catalog counts and digests in recordedCatalogDigests.js, reuse the SHA-256-verified mcp-catalog.json in default rea mcp doctor runs, move Windows existing-project Ghidra admission constants to GhidraAdmission, defer BinaryTargetResolver and Kuna installation probes until needed, and join independent Doctor host/provider/identity probes via settleConcurrent. Statically loaded JS drops 7.03 MB -> 2.07 MB (-70.6%) for rea doctor/setup (command_ms 440ms -> 207ms, -53.0%) and 5.71 MB -> 0.85 MB (-85.1%) for rea mcp doctor.
This commit is contained in:
1 parent
de12494939
commit
cb33fa8376
15 files changed
+445
-130
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
|
||||
|
||||
/**
|
||||
* Join independent read-only inspections before surfacing any failure so peers
|
||||
* finish handing retained resources to the owning scope first. Prefer physical
|
||||
* failures and incomplete-cleanup attributions over plain cancellation.
|
||||
*/
|
||||
export const settleConcurrent = async <T extends readonly unknown[]>(tasks: {
|
||||
[K in keyof T]: Promise<T[K]>;
|
||||
}): Promise<T> => {
|
||||
const settled = await Promise.allSettled(tasks);
|
||||
const rejected = settled.flatMap((outcome) =>
|
||||
outcome.status === "rejected" ? [outcome.reason] : [],
|
||||
);
|
||||
if (rejected.length > 0) {
|
||||
const physical = rejected.find(
|
||||
(cause) => !(cause instanceof AnalysisCancelledError),
|
||||
);
|
||||
if (physical !== undefined) throw physical;
|
||||
const withCleanup = rejected.find(
|
||||
(cause) => cause instanceof AnalysisError && cause.cleanupIncomplete,
|
||||
);
|
||||
throw withCleanup ?? rejected[0];
|
||||
}
|
||||
return settled.map((outcome) =>
|
||||
outcome.status === "fulfilled" ? outcome.value : undefined,
|
||||
) as unknown as T;
|
||||
};
|
||||
Reference in new issue
Block a user