mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
72ba1cd92b
Own operation results and exact rejections in withVerifierCleanup, including undefined, null and independent cleanup failures. Remove the optional-primary cleanup contract and migrate every caller, preserving returns, annotations, signal restoration and dependent cleanup order. Make Frida/JEB reporters fail on reasonless rejections and retain JEB fixture files while provider cleanup is incomplete. Own the nested packaged WASM verifier and expose its composite process/root cleanup capability for retry. Update runnable docs and isolated fixture dependencies. Validation: 547 focused cases in 20 files, eight isolated boundary unit checks, static/build/docs/discovery gates and duplication check (3.58%). Node process, SDK and descriptor cleanup are exercised; provider and packaging results in orchestration tests are simulated. Pack/install subprocess ownership remains with the existing shared package runner outside the nested-command change.
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import { hashStableFile } from "../../dist/filesystem/StableFileHash.js";
|
|
import { ArtifactResourceScope } from "../../dist/artifacts/ArtifactResourceScope.js";
|
|
import { AnalysisCleanupLease } from "../../dist/artifacts/AnalysisCleanupLease.js";
|
|
import { withVerifierCleanup } from "./verifier-cleanup.mjs";
|
|
|
|
/** Finish a prerequisite probe and release its exact retained cleanup owners. */
|
|
export async function withVerifierResourceOwner(operation) {
|
|
const resources = new ArtifactResourceScope();
|
|
const resourceOwner = {
|
|
retain(owner, resource) {
|
|
resources.retain({
|
|
kind: "lease",
|
|
resource,
|
|
lease: AnalysisCleanupLease.forCloseOwner(owner, resource),
|
|
});
|
|
},
|
|
run: (work) => resources.run(work),
|
|
};
|
|
return withVerifierCleanup(
|
|
() => operation(resourceOwner),
|
|
[() => resources.close()],
|
|
);
|
|
}
|
|
|
|
/** Hash one verifier input while retaining any descriptor whose close fails. */
|
|
export function hashVerifierFile(path, resources) {
|
|
return hashStableFile(path, {
|
|
retainFailedClose(owner) {
|
|
resources.retain({ kind: "file-handle", resource: path, handle: owner });
|
|
},
|
|
});
|
|
}
|