mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 14:59:05 +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
@@ -359,6 +359,7 @@ class PycMarshalReader extends MarshalReader<MarshalValue> {
|
||||
"max_string_bytes",
|
||||
max_string_bytes,
|
||||
`Marshal string of ${exceeded.amount} bytes exceeds max_string_bytes ${max_string_bytes}.`,
|
||||
exceeded.amount,
|
||||
);
|
||||
default:
|
||||
// Long digits; this reader sets no sequence or digit-count bound.
|
||||
@@ -366,6 +367,7 @@ class PycMarshalReader extends MarshalReader<MarshalValue> {
|
||||
"max_string_bytes",
|
||||
max_string_bytes,
|
||||
`Marshal long of ${exceeded.amount} digit bytes exceeds max_string_bytes ${max_string_bytes}.`,
|
||||
exceeded.amount,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1129,8 +1131,10 @@ class PycMarshalReader extends MarshalReader<MarshalValue> {
|
||||
if (mode === "hash") return value.value ? "i1" : "i0";
|
||||
return value.value ? "B1" : "B0";
|
||||
case "int":
|
||||
// A bit count bounds the decimal key only approximately, so it is
|
||||
// not reported as a byte requirement.
|
||||
if (value.bits > this.input.max_string_bytes * 3)
|
||||
this.#keyTooLarge(value.bits);
|
||||
this.#keyTooLarge(value.bits, false);
|
||||
return this.#boundedJoin("i", [value.value.toString()], "");
|
||||
case "float":
|
||||
if (Number.isNaN(value.value)) return this.#identity(value);
|
||||
@@ -1424,11 +1428,14 @@ class PycMarshalReader extends MarshalReader<MarshalValue> {
|
||||
this.work.keyBytes += size;
|
||||
}
|
||||
|
||||
#keyTooLarge(size: number): never {
|
||||
#keyTooLarge(size: number, measuredBytes = true): never {
|
||||
throw pythonPycLimit(
|
||||
"max_string_bytes",
|
||||
this.input.max_string_bytes,
|
||||
`Marshal key of ${size} bytes exceeds max_string_bytes ${this.input.max_string_bytes}.`,
|
||||
measuredBytes
|
||||
? `Marshal key of ${size} bytes exceeds max_string_bytes ${this.input.max_string_bytes}.`
|
||||
: `Marshal integer key of ${size} bits exceeds max_string_bytes ${this.input.max_string_bytes}.`,
|
||||
measuredBytes ? size : undefined,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user