From 46db9e2ad4d4066f1b3e997565dcd005ada18c4f Mon Sep 17 00:00:00 2001 From: Chinesezjc Date: Sun, 2 Aug 2026 16:53:49 +0800 Subject: [PATCH] test(code-runtime-python): update output-cap bound to ceiling-envelope The frame-ceiling cap test asserted the old (ceiling-envelope)/6 bound and its 44739232 message. The load bound is now ceiling-envelope because both budgets are metered in already-escaped bytes; assert 268435392. --- .../code-runtime-python/tests/runtime.spec.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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 9aedcb756f..2f78dcddc8 100644 --- a/packages/code-runtime/code-runtime-python/tests/runtime.spec.ts +++ b/packages/code-runtime/code-runtime-python/tests/runtime.spec.ts @@ -94,14 +94,16 @@ describe('PythonCodeRuntime — seam descriptors and misuse', () => { // 256 MiB framing ceiling is fixed. A larger cap is unsatisfiable rather // than generous: a completion the cap admits arrives as an over-ceiling // frame and fails the run as `worker-exit`, inverting the `output-limit` - // the cap describes. The bound is `(ceiling - envelope) / 6`, since a - // control character escapes to six bytes. - const admissible = Math.floor((256 * 1024 * 1024 - 64) / 6) + // the cap describes. Both budgets are metered in already-escaped serialized + // bytes, so a payload occupies at most `cap + envelope` on the wire; the + // bound is `ceiling - envelope`, not `(ceiling - envelope) / 6` (that + // divided in escape expansion the charge already counts). + const admissible = 256 * 1024 * 1024 - 64 const ctx = new Context() await expect(ctx.plugin(PythonCodeRuntime, { maxLogBytes: admissible + 1 })) - .rejects.toThrow(/maxLogBytes must not exceed 44739232 .*fd-3 frame ceiling/) + .rejects.toThrow(/maxLogBytes must not exceed 268435392 .*fd-3 frame ceiling/) await expect(ctx.plugin(PythonCodeRuntime, { maxValueBytes: admissible + 1 })) - .rejects.toThrow(/maxValueBytes must not exceed 44739232 .*fd-3 frame ceiling/) + .rejects.toThrow(/maxValueBytes must not exceed 268435392 .*fd-3 frame ceiling/) // The boundary value itself loads: the bound is the largest cap a frame can // still carry, not one below it. const boundary = await ctx.plugin(PythonCodeRuntime, { maxValueBytes: admissible })