mirror of
https://github.com/morluto/rea.git
synced 2026-11-04 22:06:10 +00:00
Parse Pickle extents once at the ASAR boundary and carry finalized signature facts through root and nested classification. Scan JSON whitespace within its declared extent and decode budget without retaining the whitespace prefix. Keep prefix storage bounded independently of stream chunk ownership. Fill fixed ASAR prefixes and DMG trailers across short reads, preserve cancellation through admission and stream EOF, and retain existing cleanup ownership. Cover public CLI/MCP selection, root/nested inventory, malformed JSON whitespace and padding, limits, native/XML consumers and descriptor faults. Validation: 24 focused files / 170 tests; full check; docs check; test discovery. Official inert ASAR fixtures and controlled descriptor faults were exercised; real Electron execution, Windows and natural OS short-read frequency remain unverified. Equivalent compact CLI tasks returned identical results and reply token estimates; repeated timings do not establish a speedup. Fixes #3574 Fixes #5188
21 lines
579 B
TypeScript
21 lines
579 B
TypeScript
import { Readable } from "node:stream";
|
|
import { expect, it } from "vitest";
|
|
|
|
import { hashReadable } from "./ArtifactHash.js";
|
|
|
|
it("preserves cancellation arriving with the final stream result", async () => {
|
|
const controller = new AbortController();
|
|
const reason = { stage: "source-eof" };
|
|
const source = Readable.from(
|
|
(async function* () {
|
|
yield Buffer.from("complete bytes");
|
|
controller.abort(reason);
|
|
})(),
|
|
);
|
|
|
|
await expect(hashReadable(source, controller.signal)).rejects.toMatchObject({
|
|
reason: "cancelled",
|
|
cause: reason,
|
|
});
|
|
});
|