mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
fix(verify): report every nested verifier failure reason (#11202)
This commit is contained in:
1 parent
25b1c42ce4
commit
9cc208fc60
6 files changed
+56
-10
No files matched your search
@@ -8,3 +8,6 @@ export function withVerifierCleanup<T>(
|
||||
operation: () => T | Promise<T>,
|
||||
cleanupTasks: readonly (() => void | Promise<void>)[],
|
||||
): Promise<T>;
|
||||
|
||||
/** The leaf reasons of a verifier failure, through nested AggregateErrors. */
|
||||
export function verifierFailureReasons(cause: unknown): string[];
|
||||
@@ -36,3 +36,15 @@ export async function withVerifierCleanup(operation, cleanupTasks) {
|
||||
await closeVerifierResources(cleanupTasks);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The leaf reasons of a verifier failure. `withVerifierCleanup` and the
|
||||
* fixtures it releases nest `AggregateError`s (verification failure, cleanup
|
||||
* failure, retained root), so a reporter that unwraps one level shows only
|
||||
* "Verifier cleanup failed" instead of why.
|
||||
*/
|
||||
export function verifierFailureReasons(cause) {
|
||||
if (cause instanceof AggregateError)
|
||||
return cause.errors.flatMap(verifierFailureReasons);
|
||||
return [cause instanceof Error ? cause.message : String(cause)];
|
||||
}
|
||||
@@ -3,7 +3,10 @@ import { basename } from "node:path";
|
||||
import { FridaInstrumentationService } from "../dist/application/frida/FridaInstrumentationService.js";
|
||||
import { FridaInstrumentationManager } from "../dist/frida/FridaInstrumentationManager.js";
|
||||
import { isValidFridaRemoteAddress } from "../dist/domain/fridaRemoteAddress.js";
|
||||
import { withVerifierCleanup } from "./lib/verifier-cleanup.mjs";
|
||||
import {
|
||||
verifierFailureReasons,
|
||||
withVerifierCleanup,
|
||||
} from "./lib/verifier-cleanup.mjs";
|
||||
|
||||
const options = parseArguments(process.argv.slice(2));
|
||||
if (options.help) {
|
||||
@@ -113,9 +116,8 @@ try {
|
||||
process.stdout.write(`${JSON.stringify(report)}\n`);
|
||||
if (!report.ok) process.exitCode = 1;
|
||||
} catch (cause) {
|
||||
const causes = cause instanceof AggregateError ? cause.errors : [cause];
|
||||
process.stderr.write(
|
||||
`Frida real-provider verification failed: ${causes.map((reason) => (reason instanceof Error ? reason.message : String(reason))).join("; ")}\n`,
|
||||
`Frida real-provider verification failed: ${verifierFailureReasons(cause).join("; ")}\n`,
|
||||
);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,10 @@ import {
|
||||
findMappedNonFunction,
|
||||
} from "./lib/ida-feature-trace.mjs";
|
||||
import { requireMcpToolError } from "./lib/mcp-verifier-results.mjs";
|
||||
import { withVerifierCleanup } from "./lib/verifier-cleanup.mjs";
|
||||
import {
|
||||
verifierFailureReasons,
|
||||
withVerifierCleanup,
|
||||
} from "./lib/verifier-cleanup.mjs";
|
||||
import { withVerifierResourceOwner } from "./lib/verifier-file-resources.mjs";
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
@@ -454,11 +457,7 @@ try {
|
||||
phase,
|
||||
message: cause instanceof Error ? cause.message : String(cause),
|
||||
...(cause instanceof AggregateError
|
||||
? {
|
||||
causes: cause.errors.map((failure) =>
|
||||
failure instanceof Error ? failure.message : String(failure),
|
||||
),
|
||||
}
|
||||
? { causes: verifierFailureReasons(cause) }
|
||||
: {}),
|
||||
};
|
||||
process.exitCode = 1;
|
||||
|
||||
Reference in new issue
Block a user