From 088e1282b2511fe2006f4547c1b79d0fb058d16a Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 13 Nov 2026 05:02:16 +0900 Subject: [PATCH] =?UTF-8?q?test(system):=20provider=20=EB=8C=80=EA=B8=B0?= =?UTF-8?q?=20=EC=8B=9C=EA=B0=84=20=EC=B4=88=EA=B3=BC=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=EC=97=90=20=EA=B0=90=EB=8F=85=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=84=B8=EC=8A=A4=EC=9D=98=20stderr=EB=A5=BC=20=EB=B6=99?= =?UTF-8?q?=EC=9D=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: 시스템 시험의 대기 함수(`waitForFileContent`, `waitForExistingPath`)가 시간 초과로 실패하면 파일 이름만 말한다. 그때 provider 감독 스크립트가 왜 멈췄는지(stderr)는 실행 객체에만 있고 메시지에 없어, 실패 원인을 보려면 시험을 다시 돌려야 한다. 고른 방법: `startProviderSupervisor`가 지금까지의 stderr를 내는 `output()`을 함께 돌려주고, 두 대기 함수가 실행 객체를 받아 시간 초과 메시지 끝에 붙인다(끝 4,000자). 대기 횟수와 간격은 그대로다. 위험·한계: 시간 초과 경로만 바뀐다. 통과하는 실행의 동작은 같다. 검증(desktop): check:types·eslint rc=0. 시스템 컨테이너에서 「kills and collects an active provider when its guardian dies」는 그대로 통과하고, 기대 내용을 일부러 틀리게 바꾼 변이에서는 시간 초과 메시지가 `supervisor stderr:`를 담고 실패했다(로그 /tmp/claude-gates/w2fe2-waitx/). `scripts/verify.sh gate FE-GATE-013` rc=0 235초, status-after 0줄(로그 /tmp/claude-gates/w2fe2-wait013/). Refs: 1105/12-01 --- .../ci-runner/ci-artifact-contract.test.ts | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tests/system/ci-runner/ci-artifact-contract.test.ts b/tests/system/ci-runner/ci-artifact-contract.test.ts index 3d400a38..976f63fe 100644 --- a/tests/system/ci-runner/ci-artifact-contract.test.ts +++ b/tests/system/ci-runner/ci-artifact-contract.test.ts @@ -921,7 +921,7 @@ describe("candidate archive and provider upload boundaries", { timeout: PROCESS_ environment: { PROVIDER_SUPERVISOR_TIMEOUT_MS: "5000" }, }); const unit = await waitForProviderUnit("vulnerability", execution.child.pid); - await waitForFileContent(fixture.reportPath, "started\n"); + await waitForFileContent(fixture.reportPath, "started\n", execution); const guardianPid = await waitForDirectChildMatching( execution.child.pid!, "provider-raw-guardian.ts", @@ -972,7 +972,7 @@ describe("candidate archive and provider upload boundaries", { timeout: PROCESS_ sealedPath: path.join(fixture.root, "provider-evidence/vulnerability-report.json"), }); const unit = await waitForProviderUnit("vulnerability", execution.child.pid); - await waitForFileContent(fixture.reportPath, "started\n"); + await waitForFileContent(fixture.reportPath, "started\n", execution); const reportIdentity = await lstat(fixture.reportPath); const cgroupRoot = path.resolve("/sys/fs/cgroup", `.${showProviderUnit(unit).ControlGroup}`); const cgroupPids = await readCgroupPids(cgroupRoot); @@ -1007,7 +1007,7 @@ describe("candidate archive and provider upload boundaries", { timeout: PROCESS_ try { const unit = await waitForProviderUnit("vulnerability", execution.child.pid); await expectProviderUnitGone(unit); - await waitForExistingPath(sealedPath); + await waitForExistingPath(sealedPath, execution); const guardianPid = await waitForDirectChildMatching( execution.child.pid!, "provider-raw-guardian.ts", @@ -1051,7 +1051,7 @@ describe("candidate archive and provider upload boundaries", { timeout: PROCESS_ try { const unit = await waitForProviderUnit("vulnerability", execution.child.pid); await expectProviderUnitGone(unit); - await waitForExistingPath(sealedPath); + await waitForExistingPath(sealedPath, execution); const guardianPid = await waitForDirectChildMatching( execution.child.pid!, "provider-raw-guardian.ts", @@ -1144,7 +1144,7 @@ describe("candidate archive and provider upload boundaries", { timeout: PROCESS_ environment: { PROVIDER_SUPERVISOR_TIMEOUT_MS: reason === "timeout" ? "500" : "5000" }, }); const unit = await waitForProviderUnit("vulnerability", execution.child.pid); - await waitForFileContent(fixture.reportPath, "started\n"); + await waitForFileContent(fixture.reportPath, "started\n", execution); const reportIdentity = await lstat(fixture.reportPath); const cgroupRoot = path.resolve("/sys/fs/cgroup", `.${showProviderUnit(unit).ControlGroup}`); const cgroupPids = await readCgroupPids(cgroupRoot); @@ -1686,6 +1686,8 @@ function startProviderSupervisor( stderr: string; stdout: string; }>>; + /** The supervisor's stderr so far, for a wait that times out. */ + output: () => string; }> { const kind = input.kind ?? "vulnerability"; const child = spawn( @@ -1712,7 +1714,9 @@ function startProviderSupervisor( child.once("error", reject); child.once("close", (code, signal) => resolve({ code, signal, stderr, stdout })); }); - return Object.freeze({ child, completion }); + // 1105/12-01 ②. What the supervisor wrote so far, for a wait that times out. + const output = () => `supervisor stderr:\n${stderr.slice(-4_000) || "(empty)"}`; + return Object.freeze({ child, completion, output }); } function providerSupervisorEnvironment( @@ -1771,7 +1775,11 @@ async function expectProviderUnitGone(unitName: string): Promise { throw new Error(`provider scope survived completion: ${unitName}`); } -async function waitForFileContent(filename: string, expected: string): Promise { +async function waitForFileContent( + filename: string, + expected: string, + execution: Readonly<{ output: () => string }>, +): Promise { for (let attempt = 0; attempt < 120; attempt += 1) { try { if ((await readFile(filename, "utf8")) === expected) return; @@ -1780,7 +1788,7 @@ async function waitForFileContent(filename: string, expected: string): Promise { @@ -1800,7 +1808,10 @@ async function waitForDirectChildMatching(supervisorPid: number, pattern: string throw new Error(`provider supervisor child was not observable: ${pattern}`); } -async function waitForExistingPath(target: string): Promise { +async function waitForExistingPath( + target: string, + execution: Readonly<{ output: () => string }>, +): Promise { for (let attempt = 0; attempt < 120; attempt += 1) { try { await lstat(target); @@ -1810,7 +1821,7 @@ async function waitForExistingPath(target: string): Promise { } await delay(25); } - throw new Error(`expected path did not appear: ${target}`); + throw new Error(`expected path did not appear: ${target}\n${execution.output()}`); } async function waitForMissingPath(target: string): Promise {