test(archive): 다른 시험이 쓰는 중인 임시 파일은 사본에 복사하지 않는다

tests/integration/security-followup-archive.test.ts는 후보 빌드에 쓸
증거를 얻으려고 checkout의 artifacts/를 통째로 사본에 복사한다. 같은
integration 실행에서 tests/integration/http-scenario-catalog.test.ts가
artifacts/tests/http-scenario-executions.json을 임시 파일에 쓰고
rename한다. 복사가 목록을 읽은 뒤 그 임시 파일이 rename되면 ENOENT로
실패한다. desktop FE-GATE-007(2026-11-12, load 9)에서 났다.

복사 filter가 원자적 쓰기의 임시 파일(.<이름>.<무작위>.tmp)을 건너뛴다.
그런 파일은 쓰는 중이라 증거가 아니다. fs.cp는 filter를 stat보다 먼저
부르므로, 건너뛴 파일은 사라져도 오류가 없다.

버린 것:
- 필요한 증거 경로만 복사: 공급망 생성이 추적 파일(artifacts의 .gitkeep
  포함)을 모두 lstat하고 build가 읽는 증거가 여러 곳이라, 목록을 따로
  관리해야 한다.
- 두 시험을 같이 돌지 않게 하기: integration 층 전체를 직렬로 돌려야 한다.

위험: 임시 파일이 아닌 파일을 다른 시험이 지우는 경합은 남는다. 지금
artifacts/ 아래에서 그렇게 하는 시험은 찾지 못했다.

검증(desktop):
- 다른 프로세스가 artifacts/tests에 임시 파일 10개를 계속 만들고
  rename하는 동안 이 시험을 돌렸다. main 6b4f703c는 3회 중 2회가 같은
  ENOENT(.tmp)로 실패했고, 이 커밋은 3회 모두 통과했다.
- test:unit, check:types, check:ci, lint, verify:documentation.
This commit is contained in:
DongHyeonka
2026-11-12 11:43:08 +09:00
parent 77c01b03c1
commit db4c632d53
@@ -21,6 +21,9 @@ import {
} from "../../scripts/lib/fixture-node-modules.ts";
import { selectRepositoryPaths } from "../../scripts/lib/repository-layout.ts";
/** The temporary file of an atomic write: `.<name>.<random>.tmp`. */
const IN_FLIGHT_WRITE = /^\..+\.tmp$/u;
it(
"builds a real candidate assessment and passes the default archived verifier from the captured archive",
async () => {
@@ -36,8 +39,13 @@ it(
return !selectRepositoryPaths("supply-chain-fixture-skip").includes(first ?? "");
},
});
// Other test files write their receipts under artifacts/ while this one
// copies it: a temporary file of an atomic write (.<name>.<uuid>.tmp) was
// renamed between the listing and the copy, and the copy failed with
// ENOENT (FE-GATE-007 on desktop, 2026-11-12). It is never evidence.
await cp(path.join(sourceRoot, "artifacts"), path.join(fixtureRoot, "artifacts"), {
recursive: true,
filter: (source) => !IN_FLIGHT_WRITE.test(path.basename(source)),
});
await rm(path.join(fixtureRoot, "artifacts/release"), {
recursive: true,