From 4c3e453080991ba0a04bfc05012cc4df3cced62d Mon Sep 17 00:00:00 2001 From: Chinesezjc Date: Tue, 25 Aug 2026 22:18:35 +0800 Subject: [PATCH] fix(code-runtime-python): drop the now-dead per-line cap check again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pre-join counter (single unframed line) and the first-frame check (newline-bearing chunk) reject any frame past FRAME_PARSE_CAP_BYTES before the join, so every line reaching this loop is within the cap by construction — the per-line check was dead code and its continue branch could never fire, failing the per-file 100% coverage gate. --- packages/code-runtime/code-runtime-python/src/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/code-runtime/code-runtime-python/src/index.ts b/packages/code-runtime/code-runtime-python/src/index.ts index bc2ee80a4e..9403a6703a 100644 --- a/packages/code-runtime/code-runtime-python/src/index.ts +++ b/packages/code-runtime/code-runtime-python/src/index.ts @@ -1402,10 +1402,11 @@ export class PythonCodeRuntime extends CodeRuntime { buffered = buffered.subarray(newline + 1) /* v8 ignore next -- an empty line comes only from a forged `\n\n` write. */ if (line.length === 0) continue - // A later frame in this buffer may still exceed the cap; drop that - // single line like any junk frame (the first frame was already - // bounded by the check above). - if (line.length > FRAME_PARSE_CAP_BYTES) continue + // No per-line cap check here: the pre-join counter (single unframed + // line) and the first-frame check (newline-bearing chunk) above + // reject any frame past FRAME_PARSE_CAP_BYTES before this join, so + // every line in this loop is within the cap by construction — a + // per-line check would be dead code. const text = line.toString('utf8') // JSON.parse would silently ROUND an integer token outside the // safe range before validation could see it, so a forged frame