mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
* build(scripts): type-check the Evidence verification scripts against src Six JavaScript callers kept passing `undefined` as an Evidence subject after `createEvidence` stopped accepting it (#11536); `npm run typecheck` saw only the TypeScript callers. The scripts import built modules by relative `../dist/` paths, which a checker resolves to the built JavaScript (or nothing, before a build) rather than the source types. A package-private `#dist/*` import alias resolves to `./dist/*` at run time, and `tsconfig.scripts.json` maps it to `./src/*` and checks the listed scripts with `checkJs` under the main compiler options. `typecheck`, and so `check:fast`, runs it; turbo's typecheck inputs include the scripts and the new config. First slice: `verify-package-evidence.mjs` (its evidence-bundle import becomes static), `verify/javascript/output.mjs` and `verify/javascript/digests.mjs`, with the JSDoc types the check required. Refs #11545 * build(scripts): type-check the MCP verifier results and Ghidra snapshot lifecycle helpers (#11590) * build(scripts): type-check the managed app manifest verifier (#11592) * build(scripts): type-check the managed oracles and completion report (#11605) oracles.mjs and completion-report.mjs join tsconfig.scripts.json (72 errors). ensureIlspy is an assertion function, the ILSpy import returns the imported Evidence and reads its normalized result through managedReconstructionImportResultSchema, the manifest-rejection controls are named records walked by a checked field lookup, and the completion report names its input.
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
import { ArtifactResourceScope } from "#dist/resources/ArtifactResourceScope.js";
|
|
|
|
/** A failed close retains the scope that can retry all of its owners. */
|
|
export class VerifierArtifactCleanupFailure extends AggregateError {
|
|
/**
|
|
* @param {ArtifactResourceScope} scope
|
|
* @param {readonly unknown[]} failures
|
|
* @param {unknown} cause
|
|
*/
|
|
constructor(scope, failures, cause) {
|
|
super(failures, "Verifier cleanup failed", { cause });
|
|
this._tag = "VerifierArtifactCleanupFailure";
|
|
this.cleanupOwner = scope;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Run one verifier operation and retain its exact scope if close fails.
|
|
* @template T
|
|
* @param {(scope: ArtifactResourceScope) => Promise<T>} operation
|
|
* @returns {Promise<T>}
|
|
*/
|
|
export async function withVerifierArtifactScope(operation) {
|
|
const scope = new ArtifactResourceScope();
|
|
/** @type {{ readonly ok: true; readonly value: T } | { readonly ok: false; readonly cause: unknown }} */
|
|
let outcome;
|
|
try {
|
|
outcome = { ok: true, value: await operation(scope) };
|
|
} catch (cause) {
|
|
outcome = { ok: false, cause };
|
|
}
|
|
try {
|
|
await scope.close();
|
|
} catch (cleanupCause) {
|
|
throw new VerifierArtifactCleanupFailure(
|
|
scope,
|
|
outcome.ok ? [cleanupCause] : [outcome.cause, cleanupCause],
|
|
outcome.ok ? cleanupCause : outcome.cause,
|
|
);
|
|
}
|
|
if (!outcome.ok) throw outcome.cause;
|
|
return outcome.value;
|
|
}
|