test(system): provider 대기 시간 초과 메시지에 감독 프로세스의 stderr를 붙인다
frontend-quality-gates / external-vulnerability-provider (pull_request) Canceled after 0s
frontend-quality-gates / external-provenance-provider (pull_request) Canceled after 0s
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Canceled after 0s
frontend-quality-gates / deploy-promoted-release (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Canceled after 0s
frontend-quality-gates / merge / static checks (pull_request) Canceled after 0s
frontend-quality-gates / merge / tests (pull_request) Canceled after 0s
frontend-quality-gates / merge / browser tests (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Canceled after 0s
frontend-quality-gates / main / self-tests and removal drills (pull_request) Canceled after 0s

문제: 시스템 시험의 대기 함수(`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
This commit is contained in:
DongHyeonka
2026-11-13 05:27:41 +09:00
parent c5f29344cd
commit 088e1282b2
@@ -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<void> {
throw new Error(`provider scope survived completion: ${unitName}`);
}
async function waitForFileContent(filename: string, expected: string): Promise<void> {
async function waitForFileContent(
filename: string,
expected: string,
execution: Readonly<{ output: () => string }>,
): Promise<void> {
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<v
}
await delay(25);
}
throw new Error(`provider output did not reach expected content: ${filename}`);
throw new Error(`provider output did not reach expected content: ${filename}\n${execution.output()}`);
}
async function readCgroupPids(cgroupRoot: string): Promise<number[]> {
@@ -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<void> {
async function waitForExistingPath(
target: string,
execution: Readonly<{ output: () => string }>,
): Promise<void> {
for (let attempt = 0; attempt < 120; attempt += 1) {
try {
await lstat(target);
@@ -1810,7 +1821,7 @@ async function waitForExistingPath(target: string): Promise<void> {
}
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<void> {