Explorar el Código

fix(code-runtime-python): drop the sealed-blocks ternary in the stray flush to hold 100% branch coverage

Chinesezjc hace 1 mes
padre
commit
9e6f279040
Se han modificado 1 ficheros con 5 adiciones y 2 borrados
  1. 5 2
      packages/code-runtime/code-runtime-python/src/index.ts

+ 5 - 2
packages/code-runtime/code-runtime-python/src/index.ts

@@ -1134,8 +1134,11 @@ export class PythonCodeRuntime extends CodeRuntime {
       // sequence is real truncated input and the U+FFFD is the honest render.
       function flushStray(stray: StrayBuffer, retainPartialTail?: boolean): void {
         if (stray.chunks.length === 0 && stray.blocks.length === 0) return
-        const begun = stray.blocks.length > 0 ? [...stray.blocks, ...stray.chunks] : stray.chunks
-        let full = Buffer.concat(begun)
+        // Concatenate the sealed blocks and the current-chunk residual together
+        // unconditionally (no `blocks.length > 0` ternary): a flush can run with
+        // either or both present, and a branch on their presence would need a
+        // test that flushes exactly at a seal boundary.
+        let full = Buffer.concat([...stray.blocks, ...stray.chunks])
         // A budget flush landing exactly between a lead byte and its
         // still-pending continuation requires the combined-cost threshold to trip
         // on a specific mid-multibyte pipe boundary — not deterministically