Skip to content

Run only the OS-difference desktop tests on Linux and Windows nightly - #566

Merged
yansfil merged 3 commits into
mainfrom
ci/desktop-os-scope
Oct 6, 2026
Merged

yansfil merged 3 commits into
mainfrom
ci/desktop-os-scope

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Related: #412

Summary

nightly의 Linux/Windows desktop e2e는 10-04에 들어온 뒤 한 번도 통과하지 못했다. 앞쪽 test가 90초씩 걸려 20분 상한을 다 썼고, 그 원인은 test가 아니라 제품 결함이었다.
hide connect가 띄우는 hided와 그 자식 Herdr가 부모(Electron)가 받은 디버깅 pipe(fd 3, 4)를 물려받아, 앱이 이미 종료돼도 Playwright의 app.close()가 pipe가 닫히길 기다렸다. 실제 사용자도 앱을 띄운 터미널이나 감독 프로세스가 pipe 닫힘을 기다리면 같은 모양으로 멈춘다.
이 PR은 (1) detach가 부모의 추가 fd/handle을 데몬에 넘기지 않게 고치고, (2) desktop e2e 중 OS 차이를 확인하는 6개에 @platform을 붙여 Linux/Windows nightly는 그것만 돌리게 하고, (3) nightly web은 macOS와 Windows의 @platform만, desktop은 macOS 전체와 Linux/Windows의 @platform만 돌린다(Linux web은 PR과 verify가 전체를 돌린다).
with-hide/hide-private#100(PR 검사 B+C)이 이 PR 머지 뒤 desktop/src/main 변경 시 Linux/Windows desktop @platform을 PR에서 돌릴 예정이다.

Review

commit 3개이고 각각 볼 곳이 다르다.

1. Start a detached daemon without the descriptors its parent was lent (제품 수정, 가장 중요)

  • 판단해 주세요: Windows 방식이 문서화된 방법이 아니다. detach가 부모의 handle 값 4..65536을 훑어 INHERIT를 끈다. 한계 두 가지: (1) 상한 밖 handle은 못 잡는다 (2) 부모 프로세스의 handle 플래그를 바꾼다. 호출자가 수명이 짧은 hide connect가 daemon을 띄우는 hided/src/spawn.rs의 spawn_owned 하나뿐이라 허용했고, 다른 thread가 동시에 child를 띄우는 process는 부르면 안 된다는 전제를 detach 문서에 적었다(그 child가 상속할 handle을 지울 수 있음). 문서화된 방법인 PROC_THREAD_ATTRIBUTE_HANDLE_LIST는 std의 raw_attribute가 unstable이라 CreateProcessW를 직접 써야 해서 이번에는 하지 않았다.
  • 조심해서 볼 파일: hide-platform/src/process.rs detach (Unix pre_exec, Windows 쓸기) - fork 뒤에는 POSIX가 안전하다고 적은 fcntl과 맨 시스템 호출 syscall만 쓰는지(sysconf는 목록에 없어 fork 전에 계산해 closure로 넘김), fd를 닫지 않고 close-on-exec로 표시한 이유(std의 exec 오류 pipe가 exec까지 살아 있어야 함), sysconf가 -1이면 상한까지 표시.
  • 비용 검토: Unix는 close_range(CLOEXEC) 한 번, 커널이 못 받으면 fd 3..상한(65,536)을 fcntl로 훑는다. macOS는 close_range가 없어 항상 후자다(데몬 시작 때 한 번, 상한은 ulimit -n과 65,536 중 작은 값).

2. Tag the desktop e2e tests that check what differs by system

  • 판단해 주세요: 고른 6개가 맞는가. 기준은 "그 OS에서 다르게 동작하는 것을 확인하는가"이고 통과 여부로 고르지 않았다. 나머지(⌘ chord 고정, 창/compositor, SSH, packaged app)는 macOS에서만 돈다.
  • 조심해서 볼 파일: desktop/e2e/desktop.spec.ts - attach는 chord를 web/e2e/chords.ts에서 읽고, lifetime은 마지막 창을 닫으면 macOS는 앱 유지, 그 밖에는 종료 뒤에도 hided 유지로 OS별 단언을 한다. add-project.spec.ts, reveal-external.spec.ts는 화면의 경로를 wire 표기(toPage, docs/TESTING.md의 규칙)로 비교한다.
  • Linux에서만 드러난 결함 두 개도 같이 고쳤다: screenshot helper가 screencapture를 OS와 무관하게 실행했고, lifetime의 두 번째 Electron 직접 spawn에 Playwright가 첫 인스턴스에 주는 --no-sandbox가 없었다.

3. Run only the @platform tests on the desktop and web nightly where they differ by system

  • 조심해서 볼 파일: .github/workflows/nightly.yml - web은 macOS와 Windows가 @platform 1 shard(Linux 전체 web은 verify가 돌려 nightly web job이 없다), desktop은 macOS 전체와 Linux/Windows @platform. #574의 lane 규칙은 그대로다: macOS OS 계약은 hide-platform/hide-herdr-client 변경 때 도는 별도 job이고 desktop e2e는 os-contract를 따라오지 않으며, nightly에는 os-contract job도 없다(verify가 세 leg를 돈다). scripts/tests/test_ci_plan.py에 nightly 범위 test를 더했다.
  • 문서: CONTRIBUTING.md, docs/TESTING.md, docs/PERFORMANCE_TESTING.md, pr.yml 주석(동작 변경 없음).

Evidence

  • 확인한 것:
    • 원인: 진단 dispatch 3회(Linux, 이미 제거한 temporary 코드). Electron은 app.close() 50ms 안에 exit 0, stdout/stderr destroyed인데 close(stdio 종료)는 hided를 죽인 1.5초 뒤에야 도착했고, hided의 fd 3, 4가 앱의 것과 같은 inode였다.
    • Linux 수정 확인 (nightly 37344130136): desktop @platform job 20분 상한 timeout(수정 전 37312210782) -> 3분 47초, 6/6 통과, 합 44.8초(add-project 12.7s, attach 2.5s, lifetime 4.8s, 없는 CLI 2.1s, reattach 9.2s, reveal 3.1s). web @platform 1/1 통과(6.5분, 이 job은 3번 commit이 뺐다). 이 run은 수정 직후 커밋(ef60ac4b)이고, 이후 바뀐 것은 lifetime의 non-darwin closing 처리 등 test 쪽이라 Linux에서는 그 최종 상태를 다시 돌리지 않았다.
    • Windows 수정 확인 (nightly 37349223208, 최종 HEAD 31657880): desktop job 26분(수정 전 37315772488) -> 7.5분(test 1.3분), 5/6 통과, Worker teardown timeout 소멸. attach 9.1s, lifetime 4.0s, 없는 CLI 4.5s, reattach 8.5s, reveal 3.9s. web @platform 1/1 통과(12.2분).
    • 로컬(macOS): desktop @platform 6/6(57.7s), hide-platform process 계약 34 passed(새 test는 수정 전에 macOS에서 실패 확인), hided connect_stop/handshake, clippy, fmt, Windows/Linux target cargo check --all-targets, desktop typecheck/lint, scripts/tests 134 OK(첫 실행에서 에러 1건, 어떤 test인지 못 잡았고 재실행은 통과, 부하 때문으로 보임).
  • 확인하지 못한 것:
    • 이전 verify의 macOS desktop e2e 빨강은 browser.spec.ts:753(area cycle native, @needs-focus)가 retry까지 실패한 것으로, 열린 flaky #511이다. 같은 시간대 main run 37352905893, 37348869063도 같은 job이 같은 test로 실패했고 이후 main은 녹색이다. 이 PR이 건드린 파일과 무관하다. origin/main(afe83b1, Run macOS jobs in pull request checks only when needed and start fewer jobs per run #574 포함) 위로 다시 쌓아 새 verify를 돌린다.
    • 빨강 1건: Windows add-project.spec.ts:37 (37349223208). test 본문은 통과하고 정리에서 실패한다. 진단 run(37352097532)으로 확인: 첫 hide stop은 성공하고, 이어지는 fs.rmSync(root)가 home\projects\alpha에서 EBUSY로 멈추기 전에 bin\hide-open.exe를 지운다. 재시도의 hide stop이 보여 주는 HIDE_OPEN_COMMAND: invalid는 그 부분 삭제의 결과다. 잠금은 Herdr pane의 작업 폴더로 추정하고(직접 확인하지 못함), 수정은 Remove a desktop fixture's root after Herdr stops on Windows #572(이 PR 위에 쌓음)가 한다.
    • 새 계약 test a_detached_child_holds_none_of_its_parents_extra_descriptors는 로컬에서 macOS만 돌렸다. Linux/Windows는 이 PR의 os contract와 windows check가 처음 돌린다. 수정 전 Linux/Windows에서의 실패는 직접 보지 않았고, 수정 전 macOS 실패와 Linux 진단 로그로 갈음했다.
    • macOS desktop 전체 suite와 Linux 전체 web suite는 이 PR의 verify가 돈다.
    • nightly 전체는 이 branch에서 lane별로만 돌렸다(os contract, package는 all에서만).
추가 증거: Windows web 전체(바꾸지 않음) 실패 목록

nightly Windows web full(37315772488)의 실패 test 15건을 "Windows 차이를 확인하는가"로 나눴다(표는 로컬 run 기록, 저장소 밖). 확인하는 것은 checkout-pr:99, home:82, s8:83 세 개뿐이고(경로 표기와 link), 나머지 12건은 fixture가 따라가지 못한 flow test다. 운영자 결정으로 nightly Windows web은 @platform만 돌게 되어 이 PR에서 바뀐다. 세 test의 태그와 수정은 별도 세션이 맡는다.

The add-project picker path, attach, lifetime, a missing CLI, reattach and
the file manager reveal are tagged @platform. Attach reads its chords from the
system's registry, lifetime asserts that closing the last window keeps the app
on macOS and ends it elsewhere, and the missing-CLI test names the system's
executable, copying hide and hided on Windows where a link needs a privilege.
A supervisor that launches a program with a pipe of its own (a test runner
closing an app, a terminal waiting for its job) waits for that pipe to close.
hide connect passed the pipe on to the daemon it starts, so the wait lasted as
long as the daemon, which outlives the app by design. On Unix the child now
marks every descriptor above the standard three close-on-exec, and on Windows
the parent clears the inherit flag of its other handles.
@yansfil
yansfil force-pushed the ci/desktop-os-scope branch from f5bc2cf to 7a1083c Compare October 6, 2026 02:40
@yansfil
yansfil merged commit f2cc994 into main Oct 6, 2026
19 checks passed
@yansfil
yansfil deleted the ci/desktop-os-scope branch October 6, 2026 03:07
yansfil added a commit that referenced this pull request Oct 6, 2026
Part of #561

## Summary

#597 deals the web e2e shards by recorded durations; its review found
that a shard could run fewer tests than planned, or none, and stay
green. This makes the step prove what it runs.

- The shard file is written as UTF-8 bytes. Through a Windows runner's
cp1252 stdout `›` was one byte Playwright read as no delimiter, so no
test matched, and Playwright counts a `--test-list` that matches nothing
as a pass.
- `web-e2e-shard.py check` runs after the split: it fails the step
unless `playwright test --list --test-list <shard file>` lists exactly
the tests `split` planned, with one line saying how many matched
nothing.
- A problem with the list, the table or the plan is one line and exit
status 1, never a traceback.
- A `grep` that leaves fewer tests than shards leaves the extra shards
an empty file and an early end, as the old `--shard` did, instead of a
failure.
- `durations --list` keeps only listed tests, takes a passing retry as
its test, and reads a Windows runner's `ok` mark, so a refresh needs no
hand pruning.
- The balance claim became a report: the plan warns (first shard only)
when listed tests are missing from the table or the heaviest shard is
over 15 % above the mean, and docs/TESTING.md and CONTRIBUTING.md say
what is dealt and what is not measured.

## Review

- **판단해 주세요**: the duration table stays a Linux recording; only the pull
request's Linux lane deals by it now that the nightly runs one shard per
system (#566), so the macOS and Windows balance claim is removed, not
measured.
- **조심해서 볼 파일**: `.github/workflows/web-e2e.yml` - the step lists twice
per shard (full, then `--test-list`) and `check` compares them; a
mismatch fails the step.
- **조심해서 볼 파일**: `scripts/web-e2e-shard.py` - `emit` writes bytes to
`stdout.buffer`, `read` decodes UTF-8 explicitly.
- **질문**: review item 6 (list once in the `build` job and hand shard
files to the shards) is not done: it saves about 2 seconds of cold
TypeScript load per shard and moves the list into an artifact, which
this change does not need.

## Evidence

- **확인한 것**: `python3 -m unittest discover -s scripts/tests` passes (160
tests); new ones run the script with `PYTHONIOENCODING=cp1252` and
assert the shard file is exactly the UTF-8 bytes, `check` passes and
fails (nothing matched, unplanned tests selected, empty shard), inputs
fail as one line without `Traceback`, and the table names only `file ›
title` keys of existing specs.
- **확인한 것**: against the real suite, `split`, `playwright --list
--test-list` and `check` pass for all four shards (44, 47, 43 and 45
tests, 179 in all); a shard file naming a test that does not exist fails
`check` with "would run 0 tests, not the 44 planned".
- **확인한 것**: a one-test `grep` over four shards gives shard 1 the test
and shards 2 to 4 an empty file.
- **확인한 것**: the committed table is unchanged by the new parser:
regenerated from the same 118 logs with `durations --list` it is
identical (179 tests).
- **확인하지 못한 것**: a Windows runner. The encoding is covered by a cp1252
run on macOS and the `ok` mark by a log line; the real Windows nightly
runs one shard per lane, so this path does not run there today.
yansfil added a commit that referenced this pull request Oct 6, 2026
Related: #566, #412

## Summary

Windows desktop `@platform` test `add-project.spec.ts:37` failed in its
cleanup, not in its body: removing the fixture root hit `EBUSY` on the
registered project folder `home\projects\alpha`.
The desktop fixture removed the root right after stopping hided, while
the Herdr server it shares was still running, and a Herdr pane keeps its
working folder locked on Windows until the server's processes are gone.
The root is now removed by the Herdr fixture's stop on Windows, the same
order `web/e2e/hided-fixture.ts` already uses (`herdr.afterStop`); other
systems remove it at once as before.

## Review


- **판단해 주세요**: 없음. 판단할 제품 결정은 없고 fixture 정리 순서만 바뀐다.
- **조심해서 볼 파일**: `desktop/e2e/fixture.ts` `cleanup` - Windows에서만 root
삭제를 `herdr.afterStop`으로 미룬다. 삭제 실패는 이제 `herdr.stop()`에서 던져진다.
- **질문**: `hide stop`은 멈추는 데 쓰지 않는 `HIDE_OPEN_COMMAND` 같은 키까지 모두
검증하고(`hided/src/cli.rs:285`의 `env::load()`) 틀리면 거부한다. 이번 실패에서는 부분 삭제가
오프너 파일을 지운 뒤의 재시도가 이 거부를 보여 줬을 뿐 원인은 아니다. 그래도 "잘못된 무관한 키 때문에 떠 있는 데몬을 멈출
수 없다"는 점은 제품 쪽 별도 질문이다. 이 PR에서는 바꾸지 않았다. 이슈로 올릴까?

## Evidence

- **확인한 것**:
- 진단 dispatch 1회 (nightly 37352097532, Windows): 오프너
`root\bin\hide-open.exe`는 isolate, launch, 프로젝트 등록, `app.close()`, 첫
`hide stop` 직전과 직후(status 0)까지 모두 존재했다(stat ok, 107520 bytes).
- 같은 run의 두 번째 정리 시도에서야 `ENOENT`가 되고 `hide stop`이 `HIDE_OPEN_COMMAND:
invalid`(status 2)로 거부됐다. 첫 `hide stop`은 성공했고, 그 뒤 `fs.rmSync(root)`가
`bin`을 지운 다음 `home\projects\alpha`에서 `EBUSY`로 멈췄다. 이전 run(37349223208)의
`invalid`는 이 부분 삭제의 결과였다.
- 같은 `EBUSY ...\home\projects\alpha`가 nightly 분류의 G1c(web `s2:499`,
`cmdk:396`, `home:82`)에도 있고, `hided-fixture.ts`에 같은 원인(pane의 작업 폴더가
Herdr 서버 종료 전까지 잠김)과 `afterStop` 순서가 이미 주석으로 있다.
- 로컬(macOS): `fixture-cleanup.unit.ts` 6개 통과(새 test 포함), desktop `tsc`,
`eslint`. 새 unit test는 macOS의 즉시 삭제 분기만 돈다.
- **확인하지 못한 것**:
- 이전 verify의 macOS desktop e2e 빨강은 `browser.spec.ts:753`(area cycle
native, `@needs-focus`)가 retry까지 실패한 것으로, 열린 flaky #511이다. 같은 시간대 main
run 37352905893, 37348869063도 같은 job이 같은 test로 실패했고 이후 main은 녹색이다. 이 PR이
건드린 파일과 무관하다. origin/main(2277e7a) 위로 다시 쌓아 새 verify를 돌린다.
- `alpha`를 잡고 있는 것이 Herdr pane이라는 점은 직접 보지 못했다. 위 두 근거(기록된 기전, 같은 폴더 이름의
web 실패)와 "첫 stop 성공 뒤에도 alpha만 잠김"으로 추정한다.
- 이 수정은 Windows CI에서 돌려 보지 않았다(dispatch 한도 소진). 이 PR의 `windows e2e`가
desktop `@platform`을 돌리지 않으므로, 확인은 이 PR 머지 뒤 nightly 한 번이다.
  - Windows unit test 분기(root가 `afterStop` 호출 전까지 남음)는 로컬에서 돌리지 못했다.
yansfil added a commit that referenced this pull request Oct 6, 2026
## Summary

`startGroups` in `web/e2e/agent-tab-groups.spec.ts` returned `{
...group, stop: () => { group.daemon.stop(); herdr.stop(); } }`: `stop`
closed over the original object, while "the area layout and its divider
ratio survive a hided restart" sets `group.daemon = await
group.daemon.restart()` on the returned copy.
So `stop` stopped the old daemon, already gone, and the restarted hided
ran on until the worker exited.
On Windows it kept the checkout open, and Herdr's teardown failed to
remove the fixture folder: `EBUSY: resource busy or locked, rmdir
'...\fixture'` on both attempts in nightly run
[37391023049](https://github.com/modakbul-gongbang/hide/actions/runs/37391023049/job/112036663075)
(Windows full, shard 1/4).
`stop` now reads the daemon from the object it returns.

## Review

- **조심해서 볼 파일**: `web/e2e/agent-tab-groups.spec.ts` only; the other
specs that restart hided (`s3`, `s6`, `s7`, `cmdk`, `theme`,
`view-bookmarks`, ...) assign the new daemon to the variable or object
their stop reads, and `sidebar-menus`, the other spec with a stop
closure, never restarts.

## Evidence

- **확인한 것**: locally on macOS (isolated Herdr and hided, main 76aef3b
built in this worktree), a temporary uncommitted check after
`group.stop()` in the restart test polled the restarted daemon's pid for
5 s. Old `stop`: alive in 3 of 3 runs. This change: gone in 3 of 3, and
the test passes each time.
- **확인한 것**: `pnpm --dir web lint` (eslint and the e2e size budget) and
`pnpm --dir desktop typecheck` pass.
- **확인하지 못한 것**: the Windows teardown itself; this test is not
`@platform`, so after #566 no Windows lane runs it.
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