mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
refactor(verify): release five verifier roots through VerifierFixture after their clients confirm (#11118)
* refactor(verify): release five verifier roots through VerifierFixture after their clients confirm * fix(verify): keep the binary-layout and EVM roots until their auxiliary MCP clients confirm * fix(verify): carry the retained root on each migrated verifier's final failure
This commit is contained in:
1 parent
e38e339e5f
commit
fe05a4c56d
9 files changed
+183
-125
No files matched your search
@@ -38,6 +38,12 @@ export class VerifierFixture {
|
||||
readonly released: boolean;
|
||||
/** Register a cleanup that must confirm before the root may be removed. */
|
||||
releaseAfter<T extends () => unknown>(cleanup: T): T;
|
||||
/**
|
||||
* Run cleanups now, in order; one that fails stays registered, so `release`
|
||||
* retries it and keeps the root until it confirms. Failures are thrown as
|
||||
* an AggregateError.
|
||||
*/
|
||||
closeEarly(cleanups: readonly (() => unknown)[]): Promise<void>;
|
||||
/**
|
||||
* Keep the root for good: something that may still use it cannot be
|
||||
* confirmed stopped. Every later release fails with `reason`.
|
||||
|
||||
@@ -92,6 +92,26 @@ export class VerifierFixture {
|
||||
return cleanup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close resources the verifier is done with before the fixture is released,
|
||||
* such as an auxiliary MCP client. Each cleanup runs now, in order, even
|
||||
* after an earlier one fails. One that fails stays registered, so `release`
|
||||
* retries it and keeps the root until it confirms; the failures are thrown.
|
||||
*/
|
||||
async closeEarly(cleanups) {
|
||||
const failures = [];
|
||||
for (const cleanup of cleanups) {
|
||||
const once = this.releaseAfter(onceConfirmed(cleanup));
|
||||
try {
|
||||
await once();
|
||||
} catch (cause) {
|
||||
failures.push(cause);
|
||||
}
|
||||
}
|
||||
if (failures.length > 0)
|
||||
throw new AggregateError(failures, "Verifier cleanup failed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep the root for good: something that may still use its files cannot be
|
||||
* confirmed stopped and has no cleanup this fixture could retry (an owned
|
||||
|
||||
Reference in new issue
Block a user