From f5e4e80e70896505854e35579e1bba2015619699 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 13 Nov 2026 19:06:24 +0900 Subject: [PATCH] =?UTF-8?q?test(rpc):=20=EC=8A=A4=ED=8A=B8=EB=A6=BC=20?= =?UTF-8?q?=EC=8B=9C=ED=97=98=20=EC=85=8B=EC=9D=B4=20=EC=8B=A4=EC=A0=9C=20?= =?UTF-8?q?1=EC=B4=88=EB=A5=BC=20=EC=9E=90=EC=A7=80=20=EC=95=8A=EA=B2=8C?= =?UTF-8?q?=20=EC=83=81=ED=95=9C=20=EC=8B=9C=EA=B3=84=EB=A5=BC=20=EB=84=98?= =?UTF-8?q?=EA=B8=B4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: RPC 스트림 시험 셋("cancels the physical stream exactly once after a timeout", "refuses a second stream while the first has not confirmed closure", "admits a second stream once waitClosed fulfils")은 시계를 넘기지 않아, 닫힘 확인이 없을 때의 1초 정리 상한을 runtime 기본 시계로 실제로 기다렸다(junit 1.03~1.06초). 같은 파일의 `cappedClock`은 다른 시험 넷에만 넘겼다. 고친 것: `cappedClock`(모든 대기를 30 ms로 자름)을 파일 위로 올리고 셋에도 넘긴다. 작업 마감 25 ms는 그 아래라 단언 뜻이 바뀌지 않는다. 검증: desktop junit에서 셋 모두 100 ms 아래. 고치기 전 파일은 같은 실행에서 1.027·1.059·1.056초. Refs: 1101/10-07 --- .../browser-rpc-remediation.test.ts | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/unit/browser-rpc/browser-rpc-remediation.test.ts b/tests/unit/browser-rpc/browser-rpc-remediation.test.ts index 7167788f..8048d718 100644 --- a/tests/unit/browser-rpc/browser-rpc-remediation.test.ts +++ b/tests/unit/browser-rpc/browser-rpc-remediation.test.ts @@ -377,6 +377,19 @@ describe("RPC-RR-04 transport results and frames are exactly decoded", () => { }); }); +/** + * 1101/10-07. The system clock with every wait capped at 30 ms. Without a + * positive receipt the stream cleanup waits out its 1 s bound; capped, a test + * passes that bound instead of sleeping through it. The operations' own 25 ms + * deadlines are below the cap and unchanged. Every stream test that ends + * without a positive receipt takes it, so none sleeps a real second. + */ +const cappedClock: ClockPort = Object.freeze({ + now: () => systemClock.now(), + sleep: (milliseconds: number, signal?: AbortSignal) => + systemClock.sleep(Math.min(milliseconds, 30), signal), +}); + /** * RPC-RR-01. A bare `AsyncIterable` gave the runtime no way to cancel the * physical stream or to learn when it actually closed, so a timed-out call left @@ -395,6 +408,7 @@ describe("RPC-RR-01 server stream leases and the DRAINING fence", () => { mappers: MAPPERS, requestEncoders: { RpcResourceStreamRequestEncoder: STREAM_ENCODER }, transports: { CONNECT_REFERENCE_STREAM: probe.transport }, + clock: cappedClock, }); const results = await collect( @@ -418,6 +432,7 @@ describe("RPC-RR-01 server stream leases and the DRAINING fence", () => { mappers: MAPPERS, requestEncoders: { RpcResourceStreamRequestEncoder: STREAM_ENCODER }, transports: { CONNECT_REFERENCE_STREAM: probe.transport }, + clock: cappedClock, }); const stream = runtime.bindServerStream( "WATCH_RPC_RESOURCES", @@ -541,18 +556,6 @@ describe("RPC-01 only a positive receipt confirms physical closure", () => { { label: "never settles", waitClosed: () => new Promise(() => {}) }, ]; - /** - * 1101/10-07. The system clock with every wait capped at 30 ms. Without a - * positive receipt the stream cleanup waits out its 1 s bound; capped, the - * test passes that bound instead of sleeping through it. The operation's own - * 25 ms deadlines are below the cap and unchanged. - */ - const cappedClock: ClockPort = Object.freeze({ - now: () => systemClock.now(), - sleep: (milliseconds: number, signal?: AbortSignal) => - systemClock.sleep(Math.min(milliseconds, 30), signal), - }); - for (const { label, waitClosed } of negativeReceipts) { it(`keeps the operation DRAINING when waitClosed ${label}`, async () => { const probe = leaseProbeWith(waitClosed); @@ -598,6 +601,7 @@ describe("RPC-01 only a positive receipt confirms physical closure", () => { mappers: MAPPERS, requestEncoders: { RpcResourceStreamRequestEncoder: STREAM_ENCODER }, transports: { CONNECT_REFERENCE_STREAM: probe.transport }, + clock: cappedClock, }); const stream = runtime.bindServerStream( "WATCH_RPC_RESOURCES",