refactor(parsers): report format failures through one ParseFailure algebra (#10593)

* refactor(parsers): report format failures through one ParseFailure algebra

Add ParseFailure (malformed, truncated, unsupported, limit, with format,
offset and field) and its one carrier, ParseFailureError, in the domain.
BinaryReader now names truncation and the field it read, and its native
format and resource failures are ParseFailureError subclasses.

Providers projected a format failure with their own instanceof ladder,
and some dropped the selected path from the invalid_format message.
parseFailureAnalysisError now owns that projection for the native,
Go, devicetree, V8, Windows Shortcut and Electron fuse providers.
The V8 code cache, Windows Shortcut and Electron fuse format classes
are removed in favour of the algebra.

The architecture guard counts raw Buffer and DataView reads, plain
Error throws in parser folders and plain JSON.parse of parser input
against baselines that can only shrink.

* fix(parsers): retain malformed range offsets
This commit is contained in:
morluto authored and GitHub committed 2026-11-14 14:35:28 -05:00
1 parent e939cd04fe
commit a0d9025202
41 files changed
+816 -359

No files matched your search

-11
View File
@@ -1,16 +1,5 @@
import type { V8CodeCacheInputBudget } from "../domain/v8/v8CodeCacheBudget.js";
/** Distinguish corrupt containers from unrecognized formats. */
export class V8CodeCacheFormatFailure extends Error {
constructor(
readonly kind: "malformed" | "unsupported",
message: string,
) {
super(message);
this.name = "V8CodeCacheFormatFailure";
}
}
/** A caller-selected budget was exceeded while scanning the payload. */
export class V8CodeCacheBudgetFailure extends Error {
constructor(