Explorar o código

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.
Chinesezjc hai 1 mes
pai
achega
46db9e2ad4

+ 7 - 5
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 })