mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
fix(errors): vsix and pyc limit refusals state recovery from the measured requirement (#15407)
* fix(errors): let the typed limit refusal state recovery, with the measured requirement A resource constraint with a typed adjustable limit now takes its recovery from the shared refusal owner, which compares the measured requirement with the control's maximum, instead of producer prose. The VSIX and pyc providers drop their hand-built "raise X up to MAX" text. pyc string and key limits report the size the parser measured; VSIX reports its early-stop lower bound only when it already exceeds the control's maximum. Refs #15325 * fix(python): report an integer key's limit without a byte requirement it did not measure * fix(errors): keep producer-authored recovery precedence; vsix and pyc state only typed facts The global precedence change hid multi-control advice (V8) and producer-measured requirements kept in prose (Maven/Gradle). The VSIX and pyc producers no longer author prose for a single-control limit, so the shared typed recovery applies to them without changing other producers.
This commit is contained in:
1 parent
2d1748117e
commit
b211f216d8
7 files changed
+73
-31
No files matched your search
@@ -33,13 +33,25 @@ const OPERATION = "inspect_python_pyc";
|
||||
|
||||
/**
|
||||
* Recovery for the caller-selected budgets that determine one parser limit.
|
||||
* A limit owned by one control reports it as `limit`; a product of several
|
||||
* controls names each as a related parameter, since no single range applies.
|
||||
* A limit owned by one control is typed, with the requirement the parser
|
||||
* measured, so the shared refusal owner states whether raising it can help.
|
||||
* A product of several controls names each as a related parameter, since no
|
||||
* single range applies.
|
||||
*/
|
||||
const parserLimitRecovery = (
|
||||
input: InspectPythonPycInput,
|
||||
fields: readonly (keyof PythonPycLimits)[],
|
||||
required?: number | bigint,
|
||||
) => {
|
||||
const [only] = fields;
|
||||
if (fields.length === 1 && only !== undefined)
|
||||
return {
|
||||
retryable: false as const,
|
||||
limit: {
|
||||
...pythonPycBudgetLimit(only, input[only]),
|
||||
...(typeof required === "number" ? { required_value: required } : {}),
|
||||
},
|
||||
};
|
||||
const actions = fields.map((field) => {
|
||||
const selected = input[field];
|
||||
const { maximum } = PYTHON_PYC_READ_BUDGETS[field];
|
||||
@@ -47,14 +59,9 @@ const parserLimitRecovery = (
|
||||
? `Raise ${field} above ${String(selected)}, up to ${String(maximum)}, on the next call.`
|
||||
: `${field} is at this operation's maximum of ${String(maximum)}; select a complete artifact within that bound.`;
|
||||
});
|
||||
const [only] = fields;
|
||||
return {
|
||||
retryable: false as const,
|
||||
...(fields.length === 1 && only !== undefined
|
||||
? { limit: pythonPycBudgetLimit(only, input[only]) }
|
||||
: fields.length > 1
|
||||
? { related: { parameters: [...fields] } }
|
||||
: {}),
|
||||
...(fields.length > 1 ? { related: { parameters: [...fields] } } : {}),
|
||||
remediationAction: `${actions.join(" ")} Repeating the unchanged request fails the same way; waiting or adding host memory does not raise these parser limits.`,
|
||||
};
|
||||
};
|
||||
@@ -81,7 +88,11 @@ const failureFor = (
|
||||
OPERATION,
|
||||
name === "max_depth" ? "capacity" : "memory",
|
||||
failure,
|
||||
parserLimitRecovery(input, pythonPycLimitControls(name)),
|
||||
parserLimitRecovery(
|
||||
input,
|
||||
pythonPycLimitControls(name),
|
||||
failure.failure.limit.required,
|
||||
),
|
||||
);
|
||||
},
|
||||
fileSize: (failure) =>
|
||||
|
||||
Reference in new issue
Block a user