Skip to content

Windows 데스크톱 호스트: 페이지와 wire 철자로 주고받고, 설치 폴더와 셸을 추측하지 않기 - #345

Merged
yansfil merged 4 commits into
mainfrom
platform/desktop-host-windows
Oct 3, 2026
Merged

yansfil merged 4 commits into
mainfrom
platform/desktop-host-windows

Conversation

@yansfil

@yansfil yansfil commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Related: with-hide/hide-private#103, #332(경로 모델), #334(windows check 필수)

Summary

데스크톱 호스트(desktop/src/main/)는 Windows에서 페이지에 native 철자(C:\repo)로 답하고 페이지의 경로를 native로 읽었습니다.
페이지는 #332의 wire 철자(C:/repo)로 경로를 잇고 비교하므로, Windows에서는 probe 답이 체크아웃 루트와 맞지 않았고 \foo도 절대 경로로 통과했습니다.

  • desktop/src/main/wirePath.ts가 hide_platform::path 규칙을 TypeScript로 한 글자씩 옮긴 유일한 경계입니다. probe의 real과 폴더 피커 답은 toPage로 나가고, reveal·open·probe 입력은 fromPage로 들어옵니다.
  • Windows에서는 native C:\x, 드라이브 없는 \x, 드라이브 상대 C:x를 페이지 입력으로 받지 않습니다. 환경 변수의 경로도 드라이브가 있어야 하고, 드라이브 없는 PATH 항목은 Rust find_program처럼 건너뜁니다.
  • Windows 설치 폴더는 각 설치 프로그램의 기본 폴더입니다: ~\.local\bin(Claude Code), Codex·Herdr의 %LOCALAPPDATA%\Programs\...\bin, Git for Windows(계정용·머신용 Git\cmd), %APPDATA%\npm, GitHub CLI, Node.js.
  • PATH가 없는 자식은 %SystemRoot% 아래 기본 시스템 Path를 받습니다. 변수가 없는 폴더는 추측하지 않고 빼며, 시작할 때 env.locations_missing가 그 키를 남깁니다.
  • 로그인 셸의 /bin/zsh 추측은 지웠습니다. 이제 SHELL, 없으면 계정 DB의 셸을 쓰고, 둘 다 없으면 그 단계를 건너뛰고 no_shell을 로그에 남깁니다. macOS에서 답은 그대로입니다(wire 철자 = native).

Review

  • 판단해 주세요: Windows에서 ComSpec을 읽지 않습니다. 호스트는 Windows에서 셸을 시작하지 않습니다(로그인 셸 없음, hide.exe 직접 실행). 읽기만 하고 쓰지 않는 키는 env 레지스트리 규칙에 어긋납니다.
  • 판단해 주세요: 킷은 Windows에서도 ~\.local\bin에 확장자 없는 hide 링크를 만들어, 검색이 찾지 못합니다. 킷이 hide.exe를 쓰게 하는 일은 킷 변경이라 이 PR에서 고치지 않았습니다.
  • 조심해서 볼 파일:
    • desktop/src/main/wirePath.ts: 기기 사이 경로 계약입니다. Rust와 다르면 둘 중 하나가 버그입니다. 장치 이름은 ASCII만 대문자로 바꾸고 Unicode 공백을 잘라 내며, 그 경우를 양쪽 테스트에 넣었습니다.
    • desktop/src/main/host.ts: failure path입니다. wire 철자가 없는 폴더를 고르면 이유와 함께 거절하고, 페이지 진단에 "folder picker failed"가 뜹니다.
  • 적용한 원칙:
    • 1: revealablePath를 지웠습니다.
    • 2: 방향마다 변환 지점이 하나입니다.
    • 4: 추측 대신 거절하고 그 키를 이름으로 남깁니다.
    • 7: 새 규칙을 만들지 않고 Rust 규칙을 거울처럼 옮겼습니다.
    • 12: 기대값은 Rust 테스트와 설치 프로그램 소스에서 왔고, 심은 버그 5개가 모두 잡혔습니다.
    • 13: 드라이브 없는 경로를 페이지 입력, env, PATH, 기억된 CLI에서 같은 규칙으로 막습니다.

Evidence

  • 확인한 것:
    • macOS에서 bash scripts/verify-web.sh exit 0, desktop src/main 92 통과·3 건너뜀(Windows 전용).
    • cargo test -p hide-platform --lib path:: 7 통과(새 장치 이름 경우 포함), cargo fmt --check, hide-platform clippy 통과.
    • Windows 규칙은 텍스트라 macOS에서도 검사합니다(wirePath.test.ts).
    • 미리 예측하고 버그를 심었더니 모두 해당 테스트가 실패했습니다: 드라이브 대문자 누락, fromPage 변환 생략, C: 루트 없이 허용, 옛 장치 이름 규칙, Windows 시뮬레이션에서 드라이브 없는 PATH 허용.
    • 경로를 path.win32로 바꾸고 플랫폼을 흉내 내 순수 테스트만 돌렸습니다(파일을 쓰지 않음): resolver 9, 설치 폴더 1, env 2 통과.
  • 확인하지 못한 것:
    • 실제 Windows 실행은 이 PR의 windows check(desktop unit)가 처음입니다.
    • Windows 앱 UI는 패키지가 없어 확인하지 못했습니다(PR 4).
    • macOS desktop e2e는 로컬에서 돌리지 않고 CI에 맡겼습니다. 디스크 사정과 macOS 동작 무변경이 이유입니다.
    • 설치 폴더는 공식 문서와 설치 스크립트 소스로 정했고, 실제 Windows에 설치해 보지는 않았습니다.
    • 웹의 터미널 링크 탐지(terminalLinks.ts, pathLookups)는 아직 POSIX 전용이라, Windows 터미널 링크는 웹 쪽 작업이 남았습니다.

Refs with-hide/hide-private#103

The page joins and compares absolute paths with `/`, as hided sends them,
but the desktop host answered the terminal-link probe and the folder
picker in the native spelling and read the page's reveal, open and probe
paths as native, so on Windows a probe answer never matched a checkout
root and `\foo` counted as absolute.

`desktop/src/main/wirePath.ts` states `hide_platform::path`'s rules in
TypeScript: answers leave through `toPage` and every path the page names
comes back through `fromPage`, which refuses anything but an absolute wire
spelling (a native `C:\x`, a rooted `\x` or a drive-relative `C:x` on
Windows). The Windows rules are text, so their tests run on every system
with the Rust tests' expected spellings.
The desktop host searched `~/.local/bin`, Homebrew's and `/usr/local/bin`
for `hide` and appended them to every child's PATH on every system, gave a
child without PATH the Unix system folders, and fell back to `/bin/zsh`.

On Windows the install folders are now each installer's own: `~\.local\bin`
(Claude Code), Codex's and Herdr's
`%LOCALAPPDATA%\Programs` folders, Git for Windows for the account or the
machine, npm's `%APPDATA%\npm`, the GitHub CLI and Node.js. A child without
PATH gets the default system Path under `%SystemRoot%`. A folder whose
variable is unset is left out and `env.locations_missing` names the key.

The login shell is SHELL, or the account's shell in the user database, and
with neither the step is skipped and logged; Windows reads no shell, since
the host starts none there. Home is USERPROFILE on Windows, as in
`hide_platform::host`, and an environment path must carry a drive there.
`reservedDevice` upper-cased with `toUpperCase` and trimmed with
`trimEnd`, where Rust's `reserved_device` folds ASCII letters only and
trims Unicode White_Space: a dotless `conın$` or `lpt1` with a trailing
U+FEFF read as devices in TypeScript and as names in Rust, and `nul` with
a trailing U+0085 the other way round. Both sides' tests now hold the
three names.
…\bin

A PATH entry without a drive (`\tools`) named a folder on whatever drive
was current and was remembered so; the CLI search now skips it, as
`hide_platform::host::find_program` does, and a remembered path must carry
a drive. The kit links `hide` into `~\.local\bin` without the `.exe`
Windows needs, so the docs no longer say the search finds it there.

A child on Windows gets one PATH, with the inherited `Path` dropped rather
than left to Node's key order, and an account with no user database entry
reads as having no login shell instead of failing the start.
@yansfil

yansfil commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

머지 준비 완료 49505c8
독립 리뷰 Fix now 3건 반영, verify run 37122375164 attempt 2 green, 보고서 섹션 추가. attempt 1의 windows check 실패(hided real_herdr의 pane retirement 경합)는 #288에 기록 후 한 번 재실행했고, Windows 기기가 없어 재현은 하지 못했습니다. PR 1(#347)과 web/src/host.ts가 겹쳐 나중에 머지되는 쪽은 rebase가 필요할 수 있습니다.

@yansfil
yansfil merged commit 39000d6 into main Oct 3, 2026
39 of 41 checks passed
@yansfil
yansfil deleted the platform/desktop-host-windows branch October 3, 2026 12:57
yansfil added a commit that referenced this pull request Oct 3, 2026
Related: #293 (batch 7, 항목 4)

## Summary

`pnpm --dir desktop package`가 macOS `hide.app`만 만들던 것을, 실행한 시스템의 패키지를
만들도록 넓혔습니다.
Windows x64는 폴더를 zip으로, Linux x64는 폴더를 tar.gz로 묶고 각각 `.sha256`을 붙입니다. 둘
다 서명하지 않습니다(운영자 결정 2026-10-03). macOS는 지금처럼 ad-hoc 서명입니다.
새 `package.yml`이 windows-latest와 ubuntu-latest에서 각 패키지를 만들고, 압축을 풀어 창 없이
띄워 봅니다(`smoke-package.mjs`). release는 이 워크플로를 불러 세 패키지를 한 draft에 올립니다.
smoke를 준비하다 Windows에서 `hide connect`가 성공할 수 없던 원인 세 가지를 고쳤습니다:
`hided.exe`가 아니라 `hided`를 찾았고, `/health`를 `/usr/bin/curl`로 물었고, detach한
`hided`가 CLI의 stdout 파이프를 상속해 호출자(데스크톱 앱)가 출력 끝을 영영 못 보게 됩니다.

```
ok checksum / unpack / bundled files / herdr --version / hide-host-helper-<os>-x86_64 --version
ok hide-agent-hooks doctor --json / Electron runs the bundled hcoord as Node
ok hide connect starts the bundled daemon / the daemon answers /health / serves the web shell it embeds / hide stop ends it
```

## Review

- **판단해 주세요**: 형식은 같은 도구(@electron/packager) 그대로 zip(Windows)과
tar.gz(Linux)입니다. 설치 프로그램(NSIS/MSIX)이나 AppImage/deb는 다른 도구가 필요하고, 서명 없이
얻는 것이 없어 뒤로 미뤘습니다. tar.gz는 실행 비트를 보존합니다.
- **판단해 주세요**: `package.yml`은 PR에서는 패키지에 들어가는 경로(`desktop/scripts/**`,
`desktop/package.json`, `desktop/resources/**`, Herdr pin과 fetch 스크립트,
`verify-cargo.sh`, 워크플로 자신)를 바꿀 때만 돌고 `verify`에 넣지 않았습니다. 콜드 release 빌드라
`windows check`의 몇 배가 들고, 일부 PR에서만 도는 검사는 required가 될 수 없습니다. 패키지는 7일간
artifact로 남아 실기 확인에 쓸 수 있습니다.
- **판단해 주세요**: Linux에서 마지막 창을 닫으면 앱이 종료됩니다(macOS만 창 없이 남음). 관례대로 두고
INSTALL과 ARCHITECTURE에 적었습니다. `hided`는 어느 쪽이든 계속 돕니다.
- **조심해서 볼 파일**: `hided/src/cli.rs` - failure path. `hide
connect`/`status`의 health 확인이 curl fork에서 이미 링크된 `ureq`(프록시 없음, 1초)로
바뀌었습니다.
- **조심해서 볼 파일**: `hide-platform/src/process.rs` - ownership. Windows
`detach`가 이 프로세스의 표준 핸들 상속 플래그를 끕니다(프로세스 전역 상태). 이후 `Stdio::inherit` 자식은
std가 상속 가능한 사본을 넘기므로 영향 없습니다. 실패는 `io::Result`로 올라가 `start_failed`가 됩니다.
- **조심해서 볼 파일**: `hide-kit/src/local.rs` - 화면 문구. macOS 밖에서는 This
machine 행이 "Hide installs its kit only from its macOS app, so it
installs nothing on this machine"을 보여 줍니다(이전 문구는 "설치된 앱으로 열라"는 거짓 안내).
- **조심해서 볼 파일**: `desktop/scripts/package.mjs` - macOS 경로를 공유합니다. 로컬에서
macOS 패키지를 한 번 만들어 서명, RunAsNode 확인, 아이콘, Resources 목록이 그대로인 것을 봤습니다.
- **조심해서 볼 파일**: `.github/workflows/release.yml` - 태그 없이는 돌릴 수 없습니다. 각
패키지가 artifact가 되고 `draft` 잡 하나가 체크섬 3개를 확인한 뒤 draft를 하나 만듭니다.
- **질문**: Windows/Linux 패키지는 kit(`hide` 링크, 훅, hcoord)을 설치하지 않습니다.
`hide_kit::bundled_kit_dir`가 `hide.app/Contents/Resources`만 알아보기 때문입니다.
같은 이유로 새 버전이 이전 버전의 `hided`를 교체하지 않고 거절하므로, INSTALL에 업데이트 전
`resources/hide stop`을 적었습니다. Electron 폴더 구조를 알아보게 할지는 #3(Windows 훅 명령)이
들어온 뒤 정하는 게 맞아 보입니다. 어떻게 할까요?
- **원칙**: #2 가장 단순한 형식(새 도구 없음). #3 창 없이 시작까지 증명된 패키지를 먼저, kit/설치기/서명은 그
위에. #4 다른 아키텍처는 거절, 빠진 파일은 이름으로 실패. #7 기존 packager, 시스템 tar, 이미 있는
`ureq`. #12 새 테스트와 smoke 모두 심은 버그로 수익을 확인. #14 smoke와 테스트는 시작한 데몬을 모든
경로에서 멈춤.
- hcoord는 macOS와 같은 `resources/hcoord/dist`로 넣었습니다. #3이
`hide-kit/src/hcoord.rs`에 Windows 런처를 넣어도 패키지 내용은 바뀌지 않고, kit이 Windows
패키지에서 켜질 때 런처가 쓰입니다.

## Evidence

- **확인한 것**: 새 `connect_stop` 테스트가 macOS에서 통과. `hided` 이름에 `.exe`를 붙이는
버그를 심으면 `start_failed`, health 확인을 깨면 `no_response`로 실패.
- **확인한 것**: 새 OS contract 테스트(detach한 자식이 부모 출력을 붙잡지 않음)가 macOS에서 통과.
자식에 stdout을 상속시키는 버그를 심으면 15초 뒤 실패. Windows에서의 결과는 아래 CI.
- **확인한 것**: smoke 스크립트를 로컬 debug 바이너리로 만든 Linux 구조의 가짜 tar.gz에 돌려 11개
확인 모두 통과. `hided`를 시작 못 하는 파일로 바꾸면 `hide connect` 단계에서 이름을 달고 실패.
- **확인한 것**: `HIDE_VERSION=0.0.0-local.1 pnpm --dir desktop package`로
macOS 패키지 생성(서명 검증 통과), 확인 후 출력과 `target/release` 삭제.
`/Applications/hide.app`은 건드리지 않음.
- **확인한 것**: `verify-cargo.sh lint`, 워크스페이스 테스트 57 suite, desktop
lint/typecheck/test, script suite, pin single-source 검사.
- **확인한 것**: 첫 push(head `5ff03f0d`)에서 `verify` run 37123328975 전부
green. `windows check`에서 `connect_stop` 통과(0.4초), `os contract
(windows)`에서 새 detach contract 통과.
- **확인한 것**: `package` run 37123328851 green. Windows: release 빌드
14m51s, 잡 17분, zip artifact 약 200 MB. Linux: 빌드 7m28s, 잡 9분, tar.gz 약
164 MB. 두 runner 모두 smoke 11개 확인 통과(`hide connect` -> `/health` -> 내장 셸
-> `hide stop` 포함).
- **리뷰(별도 subagent)**: Fix now 4건 모두 반영 - Windows 핸들 상속(위), smoke가
timeout으로 죽인 `hide`의 출력을 받아들이던 것, 사실과 다른 kit 안내 문구, Windows에서 WSL
`bash`가 잡힐 수 있는 소스 빌드(문서에 Git Bash 명시). 경로 필터 보강, `CARGO_BIN_EXE_hide`,
stop 실패가 원래 오류를 가리던 것도 반영.
- **확인하지 못한 것**: #344, #345 위로 rebase한 head `ff1730f5`에서 `verify`의 `web
e2e linux 2/6`이 두 번(재실행 포함) 실패. `cmdk.spec.ts:394`(프로젝트 3개,
`catalog.root_unresolved`)와 재실행 때 `new-tab.spec.ts:71`. 둘 다 main
`39000d6a`와 직전 head에서는 통과했고, 이 PR이 닿지 않는 경로라 #288에 기록. `package`는 이
head에서도 green(run 37125618484).
- **확인하지 못한 것**: 실제 Windows/Linux 기기에서 창을 띄운 적 없음(SmartScreen 화면,
chrome-sandbox 메시지, Herdr 서버 자동 시작 포함). release 워크플로는 태그가 없어 실행하지 않음.
- **확인하지 못한 것**: Windows 데스크톱 호스트의 경로/PATH 처리는 #2(별도 PR) 몫이라 이 패키지에 반영되지
않음.

Refs #293
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