mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +00:00
fix(limits): report details.limit for pyc budget refusals (#14386)
* fix(limits): report details.limit for pyc budget refusals Rebased onto main; the devicetree and NuGet parts were dropped here (landed via #14622 and #14629). This commit now carries only the pyc part. Refusals of the per-call budgets on inspect_devicetree, inspect_nuget_nupkg and inspect_python_pyc carried recovery only in remediation prose. Each owner now keeps one bounds object that feeds both its input schema and a structured details.limit (parameter, effective value, unit, range, default). A pyc limit that depends on max_objects and max_depth together reports related_parameters instead of a single range. The fixed decoded devicetree allowance is reported as a fixed ceiling and registered as pending. Refs #14234 * test(python): expect field-only pyc recovery text and the CLI limit flag
This commit is contained in:
1 parent
5e51d46a31
commit
52b3358f7e
6 files changed
+195
-58
No files matched your search
@@ -11,7 +11,8 @@ import type { PythonPycPort } from "../ports/python/PythonPycPort.js";
|
||||
import type { ExecutionOptions } from "../ports/AnalysisProvider.js";
|
||||
import { AnalysisResourceConstraintError } from "../domain/analysisErrorCore.js";
|
||||
import {
|
||||
PYTHON_PYC_LIMIT_MAXIMA,
|
||||
PYTHON_PYC_READ_BUDGETS,
|
||||
pythonPycBudgetLimit,
|
||||
type InspectPythonPycInput,
|
||||
type PythonPycLimits,
|
||||
} from "../domain/python/pythonPyc.js";
|
||||
@@ -30,20 +31,30 @@ import { offlineArtifactFailureDialect } from "../providers/offlineArtifactFailu
|
||||
|
||||
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.
|
||||
*/
|
||||
const parserLimitRecovery = (
|
||||
input: InspectPythonPycInput,
|
||||
fields: readonly (keyof PythonPycLimits)[],
|
||||
) => {
|
||||
const actions = fields.map((field) => {
|
||||
const selected = input[field];
|
||||
const maximum = PYTHON_PYC_LIMIT_MAXIMA[field];
|
||||
const option = `--${field.replaceAll("_", "-")}`;
|
||||
const { maximum } = PYTHON_PYC_READ_BUDGETS[field];
|
||||
return selected < maximum
|
||||
? `Raise ${field} (${option}) above ${selected}, up to ${maximum}, on the next call.`
|
||||
: `${field} (${option}) is at this operation's maximum of ${maximum}; select a complete artifact within that bound.`;
|
||||
? `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] } }
|
||||
: {}),
|
||||
remediationAction: `${actions.join(" ")} Repeating the unchanged request fails the same way; waiting or adding host memory does not raise these parser limits.`,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user