mirror of
https://github.com/morluto/rea
synced 2026-10-26 06:16:17 -04:00
f4f7c75c66
Use the shared source owner for Mach-O and PyInstaller admission, descriptor and selected-path identity, hashing and cleanup. Retain lipo joining and reader-owned PyInstaller admission, caller cancellation and private PYZ leases. Centralize admission failure projection and remove the superseded PyInstaller wrapper. Preserve physical identity verification before late hash-completion cancellation. Close an owned source before returning failed initial metadata acquisition and retain the exact handle when close fails. A focused regression failed twice before that fix and now passes. Validation: fresh runtime build, 259 focused fixture tests, nine documentation checks and all local static/discovery/duplication gates passed. An earlier check also ran four system-lipo suite cases (three read-only native inspections) before the final source fix; those were excluded from subsequent fixture qualification.
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
/** Fail promptly if an operation never reaches its controlled lifecycle boundary. */
|
|
export const awaitAcknowledgement = async (
|
|
acknowledgement: Promise<void>,
|
|
operation: Promise<unknown>,
|
|
boundary: string,
|
|
): Promise<void> => {
|
|
let deadline: ReturnType<typeof setTimeout> | undefined;
|
|
try {
|
|
const observed = await Promise.race([
|
|
acknowledgement.then(() => ({ kind: "acknowledged" }) as const),
|
|
operation.then(
|
|
(value) => ({ kind: "settled", status: "fulfilled", value }) as const,
|
|
(cause: unknown) =>
|
|
({ kind: "settled", status: "rejected", cause }) as const,
|
|
),
|
|
new Promise<{ readonly kind: "deadline" }>((resolve) => {
|
|
deadline = setTimeout(() => resolve({ kind: "deadline" }), 2_000);
|
|
}),
|
|
]);
|
|
if (observed.kind !== "acknowledged")
|
|
throw new Error(
|
|
`${boundary} was not acknowledged before ${observed.kind === "deadline" ? "the gate deadline" : "the triggering operation settled"}`,
|
|
{ cause: observed },
|
|
);
|
|
} finally {
|
|
if (deadline !== undefined) clearTimeout(deadline);
|
|
}
|
|
};
|