refactor(errors): derive parse-limit resource_constraint refusals from LimitRef (#11775)

* refactor(errors): derive parse-limit resource_constraint refusals from LimitRef

* docs(guides): update plist and IL2CPP reported_limits documentation
This commit is contained in:
morluto authored and GitHub committed 2026-11-16 16:31:52 -05:00
1 parent ab904c793c
commit ddd0d6d4a4
30 files changed
+377 -221

No files matched your search

+16 -21
View File
@@ -2,7 +2,12 @@ import { IL2CPP_METADATA_PROVIDER_IDENTITY } from "./Il2CppMetadataProviderIdent
import {
Il2cppBinaryFormatFailure,
IL2CPP_BINARY_BYTES,
IL2CPP_BINARY_FORMAT,
} from "./Il2cppBinaryFormat.js";
import {
isParseLimit,
parseLimitConstraint,
} from "../domain/parseFailureAnalysisError.js";
import { Il2cppMetadataFormatFailure } from "./Il2cppMetadataFormat.js";
import { inspectIl2cppMetadataV108 } from "./Il2cppMetadataV108.js";
import type { AnalysisPartialObservation } from "../domain/analysisErrorBase.js";
@@ -82,30 +87,20 @@ const failureForPrimary = (
return cause;
if (
cause instanceof Il2cppBinaryFormatFailure &&
cause.failure.kind === "limit"
isParseLimit(cause, IL2CPP_BINARY_FORMAT)
)
return new AnalysisResourceConstraintError(
return parseLimitConstraint(
OPERATION,
cause.reason === "native-type-text-capacity" ? "memory" : "capacity",
cause.message,
// The producing site states what its maximum counts.
{
boundary: cause.reason,
...(cause.unit === undefined
? {}
: { [`maximum_${cause.unit}`]: cause.failure.limit.maximum }),
},
{
cause,
...fixedAllowanceOptions(
"The IL2CPP native-link allowance",
cause.reason === "native-type-text-capacity" ? "parser" : "count",
{
limit: cause.failure.limit.maximum,
...(cause.unit === undefined ? {} : { unit: cause.unit }),
},
),
},
cause,
fixedAllowanceOptions(
"The IL2CPP native-link allowance",
cause.reason === "native-type-text-capacity" ? "parser" : "count",
{
limit: cause.failure.limit.maximum,
...(cause.unit === undefined ? {} : { unit: cause.unit }),
},
),
);
if (
cause instanceof Il2cppBinaryFormatFailure ||