fix(errors): let typed limit refusals state recovery from the measured requirement (#15447)

Several limit refusals wrote their own "raise X up to MAX" text, which
replaced the shared adjustable-budget recovery and advised a value that
cannot admit the input when the measured requirement is above the
control's maximum. Following #15407 (VSIX and pyc), these producers now
report a typed limit with the measured requirement and no prose:

- NuGet parse budgets, as VSIX already does.
- The selected-file size budget of NuGet, VSIX, Maven/Gradle metadata,
  ESP NVS, release exposure and NTFS journal reads. The reader's
  observed file size becomes required_value through the new
  selectedFileRequirement helper.
- IL2CPP's native pointer index budget.

inspect_packet_capture's DNS limitation no longer says to raise
dns_identity_limit's control when it is already at its maximum or the
requirement is above it. The unused imageFileSizeRemediation is removed.

Refs #15325
This commit is contained in:
morluto
2026-12-01 01:40:19 -05:00
committed by GitHub
parent 5a0ab31812
commit 3070116222
12 changed files with 123 additions and 72 deletions
+5 -10
View File
@@ -7,6 +7,7 @@ import {
readStableArtifact,
translateArtifactFailure,
type StableArtifactSnapshot,
selectedFileRequirement,
} from "../resources/index.js";
import {
isParseLimit,
@@ -17,7 +18,6 @@ import { xmlElementDepthConstraint } from "../domain/xmlDocument.js";
import { errorMessage } from "../kernel/errorMessage.js";
import { ArtifactOperationError } from "../domain/artifactOperationError.js";
import {
MAVEN_GRADLE_FILE_BYTES,
mavenGradleFileBytesLimit,
mavenGradleReportLimit,
mavenGradleReportLimits,
@@ -84,13 +84,6 @@ export class MavenGradleMetadataProvider {
}
}
const inputBudgetRemediation = (
input: InspectMavenGradleMetadataInput,
): string =>
input.max_file_bytes >= MAVEN_GRADLE_FILE_BYTES.maximum
? `The file exceeds the ${String(MAVEN_GRADLE_FILE_BYTES.maximum)}-byte input ceiling this operation accepts; select a smaller artifact.`
: `Raise max_file_bytes above ${String(input.max_file_bytes)} bytes, up to ${String(MAVEN_GRADLE_FILE_BYTES.maximum)}, or select a smaller artifact; this is the caller-selected input read budget.`;
const REPORT_LIMIT_FIELDS = Object.keys(
MAVEN_GRADLE_REPORT_LIMIT_BOUNDS,
) as MavenGradleReportLimitField[];
@@ -152,8 +145,10 @@ const mavenGradleMetadataFailure = (
),
{
retryable: false,
limit: mavenGradleFileBytesLimit(input.max_file_bytes),
remediationAction: inputBudgetRemediation(input),
limit: {
...mavenGradleFileBytesLimit(input.max_file_bytes),
...selectedFileRequirement(failure),
},
},
),
unclassified: (failure, origin) =>