Skip to content

test: own a bounded child's Windows tree in a job object from its start - #1855

Merged
yansfil merged 6 commits into
mainfrom
fix/windows-follow
Oct 30, 2026
Merged

yansfil merged 6 commits into
mainfrom
fix/windows-follow

Conversation

@yansfil

@yansfil yansfil commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes with-hide/hide-private#324
Related: with-hide/hide-private#328, with-hide/hide-private#326, #1841

Summary

Windows 테스트 도우미 runBounded가 자식 프로세스 트리 일부를 놓치던 문제(#324)를 고칩니다.
이제 자식을 시작하는 순간 Windows Job object에 넣고(hide-processes run), 끝날 때 job이 빌 때까지 확인합니다.
나중에 프로세스 목록을 다시 읽어 트리를 찾던 방식은 없어졌습니다.
#328(창이 셸을 30초 못 그림)은 다음에 실패할 때 어느 단계가 멈췄는지 남도록, 실패 때만 기록을 남깁니다.
#1841의 Windows 7.4초는 종료 결함이 아니었습니다(Evidence).

스크린샷 없음: 테스트 도우미와 fixture만 바뀌고 제품 화면은 바뀌지 않습니다.

Review

  • 판단해 주세요: 첫 컴파일(hide-processes 자신)은 아직 job을 만들 도구가 없어, 프로세스 하나짜리 단계로 나눴습니다: clang -c, 그리고 clang이 -###로 알려 준 lld-link 한 번.
  • 비교한 대안: 지금처럼 clang -o 한 번은 clang이 link.exe와 vctip.exe를 자식으로 띄워 #324의 경우 1이 그대로 남습니다.
  • launcher 바이너리를 커밋하면 저장소에 빌드 산출물이, Rust owner로 만들면 web unit suite에 cargo 빌드가, PowerShell Add-Type job은 csc.exe 자식과 수십 초 cold start가 붙습니다.
  • launcher는 이미 소스 hash당 한 번만 빌드되고 runBounded는 그것만 씁니다. 남는 것은 그 한 번의 빌드라 단계 분리를 골랐고, Windows unit suite가 세 단계가 각각 프로세스 1개임을 job으로 셉니다.
  • 조심해서 볼 파일: web/e2e/shims/hide-processes.c - 프로그램을 job 안에서 만드는 것(PROC_THREAD_ATTRIBUTE_JOB_LIST), 받은 인자를 그대로 넘기는 after_argument, 상속 handle을 stdout/stderr/NUL로 제한한 것, job을 다시 끝내며 비었는지 세는 루프.
  • 시작 전 준비가 실패하면 unstarted, 시작 뒤 wait나 exit status 읽기가 실패하면 job을 끝내고 빈 것을 확인한 뒤 failed, job을 끝내거나 셀 수 없으면 unconfirmed로 Win32 오류와 함께 보고합니다.
  • 첫 컴파일은 clang이 cc1을 따로 띄우게 하는 CC_PRINT_PROC_STAT, CLANG_SPAWN_CC1, CCC_OVERRIDE_OPTIONS를 뺀 환경에서, 기본 config 파일을 읽지 않고(--no-default-config, 컴파일과 -### 계획 둘 다) 돕니다. Windows 테스트가 변수 둘과 -fproc-stat-report를 켠 clang.cfg(clang이 먼저 찾는 폴더)를 둔 채 세 단계가 각각 프로세스 1개인지 세고, 같은 config로 --no-default-config 없이 컴파일하면 프로세스가 2개 이상인 것도 확인합니다.
  • 조심해서 볼 파일: web/e2e/bounded-child.ts - Windows의 끝내기가 launcher 보고를 기다리는 비동기로 바뀜(30초 상한). worker exit 때는 launcher 입력을 닫아 job을 끝내게 하고, launcher가 죽으면 KILL_ON_JOB_CLOSE가 끝냅니다.
  • 조심해서 볼 파일: desktop/e2e/fixture.ts - 셸 대기가 실패할 때만 host 로그 끝 40줄, 창 상태, 페이지의 요청과 status를 [failure dump] shell wait로 남깁니다. 요청 실패 이유는 남기지 않습니다. 각 비동기 읽기는 5초 상한(host 로그 읽기는 동기).

Evidence

Verification record
  • base: a891332, head: 84ca48b
  • macOS: vitest run e2e/bounded-child.unit.ts e2e/platform-program.unit.ts 9 passed 1 skipped (Windows-only); web/desktop typecheck, lint 통과; hide-processes.c zig cc(x86_64-windows-gnu) -Wall -Wextra 경고 없음(pragma 제외)
  • CI run 40990677533(head 29eaaa4): 모든 lane 통과, flaky 0
  • CI run 40994151251(head 1e7bfc3, 리뷰 반영): attempt 1에서 Windows desktop만 #221로 실패, attempt 2 통과, verify pass
  • CI run 41000366235(head 84ca48b, 기본 clang config 차단): verify pass, 첫 attempt 모든 lane 통과

runBounded on Windows found a child's tree from process snapshots taken
after the spawn, which missed a grandchild whose parent had exited and
failed a child that exited before its identity was read. hide-processes
run now puts the child in a job object before its first instruction,
ends the job however the run ends and reports once none of it is left.
Its own first compile, before there is a hide-processes, runs in steps
that each start no other process.

Closes with-hide/hide-private#324
A Windows desktop window sometimes missed its shell for 30 s in the
middle of a job while its daemon had started, and nothing said which step
stopped. The fixture's waits for the shell now record the host log's last
lines, each window as the main process sees it and each page's requests.
…y failure to follow it

The program was created suspended and joined its job afterwards, so a
launcher that died in between left it outside the job, and a failed event,
thread, wait or exit-status read ended the run without saying why. The
program is now created in the job (PROC_THREAD_ATTRIBUTE_JOB_LIST), what
the run waits on is ready before it starts, and a failure after the start
still ends and counts the job and reports its Win32 error. The first
compile runs without the variables that would have clang start cc1 as a
second process.
@yansfil
yansfil merged commit 1e8355e into main Oct 30, 2026
49 checks passed
@yansfil
yansfil deleted the fix/windows-follow branch October 30, 2026 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant