Skip to content

Run macOS jobs in pull request checks only when needed and start fewer jobs per run - #574

Merged
yansfil merged 8 commits into
mainfrom
ci/macos-on-demand
Oct 6, 2026
Merged

yansfil merged 8 commits into
mainfrom
ci/macos-on-demand

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Part of with-hide/hide-private#100

Summary

A pull request asked for up to 23 jobs, five of them on macOS, and the organization runs 20 jobs at once and five on macOS, so runs queued behind each other.
Now a pull request starts a macOS job only for what a macOS runner alone proves, and a full run starts at most 17 jobs.

  • The macOS web @platform job is gone from pull requests; Linux (web-e2e) and Windows run the same tests there, and the nightly runs them on macOS.
  • The remote mailbox lane is planned from the crates it builds and tests, runs on Linux in pull requests and on macOS in the nightly (remote-mailbox.yml).
  • The OS contract's macOS leg is its own job, planned for hide-platform and hide-herdr-client changes; desktop e2e no longer follows it.
  • A herdr-core or hided change starts 14 jobs and none on macOS; the nightly runs each macOS check once; desktop e2e runs for desktop/ and the web code it drives.
  • web checks and desktop checks are one job, web-e2e.yml loses its plan and fetch zsh jobs (zsh is cached by runner image), and Linux web e2e runs four shards instead of six.
  • Run the remote mailbox lane in its own Linux job #555 (remote mailbox in its own Linux job, merged) is the base of that lane; the helper and bin copies stay out of its failure artifact in remote-mailbox.yml too.

Review

  • 판단해 주세요: a change to the core or daemon alone no longer gets a macOS @platform run before merge; the nightly finds it the next day.
  • 판단해 주세요: four Linux shards instead of six trade fewer queued jobs for longer shards; the issue named four, balance by past durations is not done.
  • 조심해서 볼 파일: scripts/ci-plan.py - NIGHTLY_ONLY, OS_LANES and the os-contract-macos rule decide what skips macOS.
  • 조심해서 볼 파일: .github/workflows/web-e2e.yml - the shard list is picked by index, and zsh now comes from the build job.
  • 조심해서 볼 파일: .github/workflows/os-contract.yml - takes a systems input; clippy now also runs on macOS.

Evidence

  • 확인한 것: python3 -m unittest discover -s scripts/tests passes (136 tests): lane reach for 25+ paths, no macOS lane for core/daemon changes, and the job count (17) counted from the workflows and matched to docs/TESTING.md.
  • 확인한 것: a review pass over the diff found two stale CONTRIBUTING.md lines, fixed.
  • 확인하지 못한 것: the new job shapes on real runners (indexed shard matrix, os contract (macOS) with clippy on macOS) are first exercised by this pull request's own verify.
  • 확인하지 못한 것: remaining from with-hide/hide-private#100: desktop/src/main changes running desktop @platform on Linux and Windows (waits for the desktop OS scope change), Linux shard balancing by past durations, and the post-merge measurements (median wall time, share of runs with Linux shards waiting over 10 minutes, shard times at four).
  • 확인한 것: origin/main (with Run the remote mailbox lane in its own Linux job #555 merged) is merged into this branch without rebase; the remote mailbox job here is Run the remote mailbox lane in its own Linux job #555's Linux job through remote-mailbox.yml, and the nightly adds remote mailbox (macOS) on the same file.

…r jobs per run

The macOS web @platform job is planned by the nightly only, the OS contract's macOS leg is its own job planned for hide-platform and hide-herdr-client, and desktop e2e no longer follows the OS contract. The web and desktop checks share one job, the web e2e workflow drops its plan and zsh jobs, and the Linux web e2e runs four shards.
…he nightly, and keep one macOS run of each check there
yansfil added a commit that referenced this pull request Oct 6, 2026
## Summary

`web e2e (macOS)` was the longest job of a pull request run (14.4
minutes in the 2026-10-05 queue run): a 4.4-minute build of every CLI
binary, the 6.8-minute `@platform` suite, then the 3.2-minute remote
mailbox lane.
The mailbox lane (`herdr-core/tests/remote_delivery.rs`) now has its own
`remote mailbox` job, and the macOS job builds only `hided` and runs
only the `@platform` suite, like the other lanes.

- `web-e2e.yml` loses the `remote-mailbox` input, its nextest and
flaky-report steps and the mailbox cache key.
- `pr.yml` gains the `remote mailbox` job (cache key `web-e2e-mailbox`)
and `verify` needs it.
- `ci-plan.py` plans the new lane by the crates it builds and tests
(`MAILBOX_CRATES`: a change reaching `herdr-core`, `hided`,
`hide-agent-hooks` or `hide-host`, plus the paths that plan every lane),
never by a web or desktop path; `test_ci_plan.py`, `docs/TESTING.md` and
`CONTRIBUTING.md` follow.
- The failure artifact leaves out the staged binaries, the copies the
install places under each account's `helper` and `bin`, and the SSH
keys.

## Review

- **결정됨**: Linux-only execution is decided by #561 (section B). The job
runs on Linux, not macOS. The lane covers the SSH return route, helper
attestation, reverse-forward intake and the durable mailbox; the
fixture's only macOS-specific code is an ad-hoc codesign of the staged
binaries. What differs by system under it (process lookup, files, the
local stream) is owned by `os-contract` and `windows check`. This drops
the macOS execution of the lane: `nightly.yml` ran it through `verify`,
which plans every lane, and after this merge no CI job runs it on macOS,
so the fixture's macOS branches (codesign, BSD `ps` and `strip`, the
SFTP server path) go unrun until a nightly macOS run exists (#574 adds
`remote mailbox (macOS)` to `nightly.yml`).
- **조심해서 볼 파일**: `.github/workflows/pr.yml` (`remote-mailbox` job: zsh
and SFTP server install, Linux Herdr asset), `scripts/ci-plan.py`
(`MAILBOX_CRATES` and its one rule in `classify`).
- **질문**: none open.

## Evidence

- **확인한 것**: `python3 -m unittest discover -s scripts/tests` passes (135
tests), including a test that `remote-mailbox` is planned for the
mailbox crates and the test itself, for a path that plans every lane,
and not for web, desktop or documentation paths. `nightly.yml` does not
use the removed input.
- **확인한 것**: the lane's first Linux run failed with "timed out waiting
for consented private helper". A probe run of the lane alone showed the
cause: the device helper install's SFTP read-back took 46 ms per 32 KB
read (401 reads, 18.4 s) against 2.3 ms per write, a Nagle plus
delayed-ACK stall on the fixture's SSH server sockets (no TCP_NODELAY,
unlike OpenSSH); the 79.7 MB staged `hide` then needed about 110 s and
crossed the product's 120 s install bound.
- **확인한 것**: the fixture's server now sets TCP_NODELAY on accepted
sockets (best-effort, after the connection cap check), as OpenSSH does,
and a probe run with the fixture change alone passed in 36.7 s. The
production client is unchanged: no measurement shows it needs the flag,
and it would be its own change. The helper diagnostics print a read-only
process list and start nothing.
- **확인하지 못한 것**: this pull request's own `verify` result with the fix,
until it finishes; the before/after job times.
@yansfil
yansfil merged commit afe83b1 into main Oct 6, 2026
19 checks passed
@yansfil
yansfil deleted the ci/macos-on-demand branch October 6, 2026 02:25
yansfil added a commit that referenced this pull request Oct 6, 2026
…#566)

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`가 전체를 돌린다).
#561(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, #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의 작업 폴더로 추정하고(직접 확인하지 못함), 수정은
#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`에서만).

<details><summary>추가 증거: Windows web 전체(바꾸지 않음) 실패 목록</summary>

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의 태그와 수정은 별도
세션이 맡는다.

</details>
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