Sfoglia il codice sorgente

test(code-runtime-python): make the stray-seal copy-volume bound discriminate

The stray-sealing regression test asserted copied < 2 MiB — about 4x the
defended sealed shape, so reverting the seal to a re-merge (or removing it)
left the test green. Measured both shapes as the fd-3 sibling does: the sealed
shape copies ~120 KB, the re-merge shape ~538 KB. Tighten the bound to 256 KiB,
which sits between them, and record the measurements in the comment and the
Agent Note so the fail-before claim holds.
Chinesezjc 1 mese fa
parent
commit
45814baf26

+ 2 - 2
.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.i18n.yaml

@@ -2,5 +2,5 @@
 # side as of the last confirmed-consistent state. Both languages carry equal authority;
 # after editing either side, bring the other along and re-record with:
 #   pnpm run verify-translation-pairing --write .agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.md
-2026-07-31-code-runtime-python-settlement-fixes.md: 669268f9b128e98b9af6b221d4add86e0258016d
-2026-07-31-code-runtime-python-settlement-fixes.zh.md: 003c42ebb0a7634539e510fc780e237fd36a6a29
+2026-07-31-code-runtime-python-settlement-fixes.md: a62b6c67da185081bce7895af242473797722423
+2026-07-31-code-runtime-python-settlement-fixes.zh.md: c04131399c50d53749656111a478dc3c756e32cb

File diff suppressed because it is too large
+ 0 - 0
.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.md


File diff suppressed because it is too large
+ 0 - 0
.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.zh.md


+ 10 - 3
packages/code-runtime/code-runtime-python/tests/runtime.spec.ts

@@ -3157,9 +3157,16 @@ describe('PythonCodeRuntime — hostile peer', () => {
     // length depends on pipe coalescing, but it is one entry and non-empty.
     expect(result.logs.length).toBe(1)
     expect((result.logs[0] as string).length).toBeGreaterThan(0)
-    // Sealing keeps each byte copied a bounded number of times; re-merging the
-    // whole residual per threshold would push the total far past this.
-    expect(copied).toBeLessThan(2 * 1024 * 1024)
+    // Sealing appends a finished block rather than re-merging everything held, so
+    // each byte is copied a bounded number of times. Re-merging the whole
+    // residual at every seal threshold instead makes the cumulative copy volume
+    // quadratic. Measured like the fd-3 sibling above rather than reasoned about:
+    // this sealed shape copies about 120 KB for 60000 trickled bytes, the
+    // re-merging shape about 538 KB (the stray path adds one whole-residual
+    // concat at the terminating newline over the fd-3 sibling's 119/540, landing
+    // at the same order). 256 KiB sits between them with margin on both sides, so
+    // reverting the seal to a re-merge turns this assertion red.
+    expect(copied).toBeLessThan(256 * 1024)
   }, 40_000)
 
   it('caps a huge exception diagnostic child-side before it crosses the wire', async () => {

Some files were not shown because too many files changed in this diff