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 bb953ca9f4..6132527a8d 100644 --- a/packages/code-runtime/code-runtime-python/tests/runtime.spec.ts +++ b/packages/code-runtime/code-runtime-python/tests/runtime.spec.ts @@ -3701,12 +3701,19 @@ describe('PythonCodeRuntime — hostile peer', () => { // frames plus the interpreter exceeded 384 MiB and returned MemoryError as an // exception. Linux-only RLIMIT_AS repro; on macOS the value round-trips // either way, but the fixture stays within the address space so it is honest. - const { runtime } = await setup({ maxValueBytes: 20 * 1024 * 1024, addressSpaceMb: 384, maxWallMs: 20_000 }) + // + // `maxWallMs` is 60s, not the 20s the memory assertion alone needs: the O(depth) + // cursor pulls 6M elements one at a time through Python-level frames, which costs + // ~11s on an idle machine and more under the coverage lane's V8 instrumentation + // with several workers sharing a box. This budget bounds the run without letting a + // loaded runner's scheduling latency read as a `timeout` — what this test asserts + // is the O(depth) memory shape, not a speed claim. + const { runtime } = await setup({ maxValueBytes: 20 * 1024 * 1024, addressSpaceMb: 384, maxWallMs: 60_000 }) const result = await runtime.run({ program: 'return [0] * 6_000_000', bindings: [] }) expect(result.error).toBeUndefined() expect(Array.isArray(result.value)).toBe(true) expect((result.value as number[]).length).toBe(6_000_000) - }, 30_000) + }, 90_000) it('bounds a flood of zero-byte log lines through the per-entry separator charge', async () => { // Blank print() lines carry zero content bytes; without the +1 separator