From d3e34d5612c09eb2a6184f318aadc6643835c8fe Mon Sep 17 00:00:00 2001 From: Chinesezjc Date: Thu, 20 Aug 2026 16:53:23 +0800 Subject: [PATCH] test(code-runtime-python): replace literal NUL bytes in comments with the escape text The comments describing NUL serialization contained literal NUL bytes, which interfere with source tooling. Use the \x00 escape text instead. --- .../code-runtime-python/tests/runtime.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/code-runtime/code-runtime-python/tests/runtime.spec.ts b/packages/code-runtime/code-runtime-python/tests/runtime.spec.ts index d01f891424..86dc925188 100644 --- a/packages/code-runtime/code-runtime-python/tests/runtime.spec.ts +++ b/packages/code-runtime/code-runtime-python/tests/runtime.spec.ts @@ -848,7 +848,7 @@ describe('PythonCodeRuntime — programs and bindings', () => { it('bounds a control-char-dense native residual by serialized cost, not raw length', async () => { // A newline-free NUL flood passes the cheap `length + 3` lower bound at a - // raw length well under the budget, but each NUL serializes to `` (6 + // raw length well under the budget, but each NUL serializes to `\x00` (6 // bytes), so the true JSON cost is ~6x. The ledger must charge that // serialized cost — and `jsonStringCostUpTo` must measure it WITHOUT // allocating the escaped copy, so a near-budget line under a large @@ -3269,7 +3269,7 @@ describe('PythonCodeRuntime — hostile peer', () => { }, 20_000) it('rejects a control-heavy oversized completion on its length, not its escaped copy', async () => { - // Every "\x00" escapes to the six bytes "", so the escaped form of a + // Every "\x00" escapes to the six bytes "\x00", so the escaped form of a // 40 MB string is ~240 MB. The walk must refuse on the cheap // `len(current) + 2` lower bound; the 384 MiB address space holds the raw // string but not its escaped expansion, so a pre-escape check dies on @@ -3523,7 +3523,7 @@ describe('PythonCodeRuntime — hostile peer', () => { it('caps a control-heavy exception diagnostic by its serialized cost, not raw bytes', async () => { // The diagnostic crosses fd 3 inside a JSON frame where a control character - // escapes sixfold (a NUL is one raw byte, six as ``). Capping by raw + // escapes sixfold (a NUL is one raw byte, six as `\x00`). Capping by raw // UTF-8 length would let a NUL-heavy message near maxValueBytes serialize to // ~6x that and breach the frame ceiling — the silent worker-exit inversion // the load-time cap check exists to prevent. The child meters the diagnostic @@ -4157,7 +4157,7 @@ describe('PythonCodeRuntime — hostile peer', () => { it('drops a forged oversized log frame on its code-unit lower bound, before escaping it', async () => { // A forged `log` frame carrying a control-heavy string sits below the // 256 MiB fd-3 frame ceiling but escapes several-fold: 24 MiB of NULs - // becomes ~144 MiB of ``. Charging it required building that escaped + // becomes ~144 MiB of `\x00`. Charging it required building that escaped // copy first, so a 32-byte maxLogBytes could still force a // hundreds-of-megabytes host allocation. The cheap `length + 3` lower bound // truncates it instead. The host's own heap is what is under test, so keep