Skip to content

feat: fetch every device kit by one rule from the core's own release - #2130

Merged
yansfil merged 6 commits into
mainfrom
feat/device-kit-contract
Nov 6, 2026
Merged

yansfil merged 6 commits into
mainfrom
feat/device-kit-contract

Conversation

@yansfil

@yansfil yansfil commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes with-hide/hide-private#501
Related: with-hide/hide-private#501 N2 (kit-contract); N3 (릴리스가 네 키트를 만들어 목록에 넣는 일)이 이 PR 다음입니다.

Summary

기기에 보내는 프로그램 묶음(기기 키트)의 플랫폼 목록이 코어 코드, 패키지 스크립트, 앱 안의 목록 파일에 따로 적혀 있었습니다.
그래서 Mac 앱과 Windows 앱이 각자 목록을 들고 다녔고, Windows 코어가 Mac 기기를 받는 것처럼 새 조합을 같은 방식으로 받을 수 없었습니다.
이제 플랫폼은 contracts/device-kits.json 한 곳에만 적습니다.
모든 코어가 같은 규칙으로 자기 버전의 릴리스에서 목록을 받아 자기 빌드와 맞는지 확인하고, 네 플랫폼을 같은 코드로 검사합니다. 앱은 목록을 싣지 않습니다.
목록에 없는 플랫폼(Windows ARM PC, Intel Mac)은 설치 전에 이유와 함께 거절하고, Linux ARM64 기기 연결을 CI(ubuntu-24.04-arm)에서 돌립니다.

Review

  • 판단해 주세요: 이 PR이 머지되면 N3(release-kits)가 머지될 때까지 모든 릴리스가 자산 게이트에서 실패합니다. 실패 메시지가 이유를 말합니다.
    • 이유: 릴리스 쪽은 아직 Linux 두 키트만 만들고, 이 코어는 네 키트가 다 있어야 받습니다. 그대로 내면 Mac 코어의 Linux 기기 연결이 조용히 깨집니다.
    • 순서: 1.2.1 게시 뒤 이 PR, 그다음 N3, 그다음 릴리스. 키트를 만드는 쪽의 변경은 N3 몫입니다.
  • 판단해 주세요: 캐시를 #501의 플랫폼별 고정 칸 대신 1024 MiB 상한 안의 LRU로 바꿨습니다. 고정 칸 넷은 내려받기 공간까지 1.5 GiB라, 두 플랫폼 때의 상한을 지키려는 것입니다.
  • 판단해 주세요: 목록 형식을 3에서 4로 올렸습니다. 형식 3은 앱이 싣던 Linux 두 개짜리 목록이고, 이전 빌드는 새 목록을 번호로 거절합니다.
  • 판단해 주세요: arm64 레인은 캐시를 저장하지 않고 매번 새로 빌드합니다. 10 GB 캐시 예산에 시스템 하나를 더 얹지 않으려는 것이고, PR 잡 상한이 50에서 51이 됩니다.
  • 조심해서 볼 파일:
    • hide-node/src/ssh/kit/cache.rs - failure path: 잠금, staging 정리, 축출, 다른 빌드의 칸 교체. connection worker에서만 돌고 runtime mutex 밖입니다.
    • hide-node/src/ssh/kit/manifest.rs - 컴파일된 VERSION/COMMIT/ORDER와 다른 목록은 아카이브를 받기 전에 거절합니다.
    • hide-node/src/ssh/kit/archive.rs - 압축 해제 상한과 tar 항목 거절(링크, 폴더, 중복, 목록에 없는 이름, 크기).
    • hide-node/src/ssh/kit/select.rs - 한 규칙: 개발자 파일, 자기 플랫폼의 자기 프로그램, 그다음 릴리스 키트. 어느 경로든 Windows 기기는 계약이 적은 ConPTY 파일만 받습니다.
    • hide-node/src/ssh/kit/contract.rs - Windows 키트의 ConPTY 파일을 contracts/conpty.json 핀에 묶는 테스트. 핀이 바뀌면 PR에서 이 테스트가 돕니다(scripts/ci-plan.py).
    • desktop/scripts/package.mjs, .github/workflows/package.yml - 앱에 목록이 실리지 않고, Windows 패키지는 키트를 기다리지 않습니다. Windows 앱의 ConPTY 파일 확인도 핀을 읽습니다.
    • scripts/ci-plan.py - remote-mailbox-arm 레인과 계약 파일의 계획.
    • scripts/check-release-assets.mjs - 계약의 모든 플랫폼 키트(20개 자산)를 요구하고, 모자라면 N3를 이유로 거절합니다.
  • 비용 검토: 고빈도 경로가 아닙니다. 기기 연결 때 connection worker에서 한 번 돌고, 요청 60초, 목록 64 KiB, 키트 256 MiB, 캐시 1024 MiB가 상한입니다.

Evidence

  • 확인한 것:
    • hide-node 253개 통과(고정 rustc 1.99.1, macOS arm64). 그중 키트 13개: 네 플랫폼 받기, 검사, 오프라인 재사용.
    • 키트 테스트가 거절을 확인: 다른 빌드의 목록(아카이브 요청 전), 잘못된 헤더, 목록에 없는 항목, 링크, 폴더, 중복, 바뀐 바이트.
    • 키트 테스트가 확인: 다이제스트·크기 불일치는 캐시에 남지 않음, 오래된 칸 교체, LRU 축출, staging 정리 실패 보고, 로컬 빌드의 개발자 폴더 안내.
    • verify-cargo.sh lint: fmt와 워크스페이스 전체 clippy(--all-targets -D warnings) 통과.
    • 데스크톱 스크립트 vitest 29개(device-helpers 18개: 형식 4, 헤더 세 종류, stage 이름과 거절) 통과.
    • 릴리스 게이트: Linux 키트만 있는 릴리스가 모자란 키트 이름과 release-kits를 말하며 실패하는 테스트 포함, Python 27개와 JS 26개 통과.
    • 레인 계획: remote-mailbox-arm은 hide-node, hide-node-link, 기기 테스트, 계약에만 잡히고 herdr-core 같은 변경에는 안 잡힘(test_ci_plan.py).
    • check-device-kits-single-source.py는 지금 통과하고, 일부러 넣은 플랫폼 이름은 잡아냄.
    • CI remote mailbox arm64(ubuntu-24.04-arm 이미지): 메일박스, 노드 계약, 시스템 ssh, 엔진 기기 테스트 32개 통과(device_own_engine 포함). 캐시 없이 6분 18초(빌드 3분 40초).
    • Windows: windows check(stage 테스트 포함)와 package (windows) 통과.
    • 리뷰 수정: 패키지 번호가 없는 빌드(order 0, 예: cargo build --release)는 릴리스를 찾지 않고 개발자 폴더를 알려 줍니다(테스트 추가).
    • 리뷰 수정: 링크와 폴더 항목이 프로그램의 이름과 크기를 가져, 항목 종류 검사만 막습니다. archive.rs의 is_file을 지우면 이 테스트가 실패하는 것을 확인했습니다.
    • 구조 점검 수정: 핀에 파일 하나를 더하면 계약 테스트가 실패하는 것을 확인했습니다. 로컬 폴더에서 계약에 없는 파일은 보내지 않고, 빠진 파일은 그 이름과 함께 거절합니다(테스트 추가).
    • 독립 검증(맥미니): 진짜 CI 키트와 loopback 서버로 첫 받기, 재연결 시 요청 0개, 서버가 꺼져도 캐시 사용, 다른 커밋의 목록 거부, 1바이트 변조 거부, 네 플랫폼의 진짜 헤더 통과, 4칸 861 MB를 확인했습니다.
  • 확인하지 못한 것:
    • 실제 릴리스에서 코어가 형식 4 목록을 받는 것: 그런 릴리스가 아직 없습니다(N3 뒤).
    • Windows 코어가 Mac 기기를 받는 것: 릴리스에 macOS 키트가 아직 없습니다(N3).
    • Windows 실제 PC에서의 세 가지(작업 플래그 0x2800, job none, ssh를 끊어도 창 유지)는 Flaky test: closing a primary checkout's last pane in the UI keeps one tab for it and the linked workspace #501 N5 몫입니다.
    • 후속(with-hide/hide-private#610): JS에 따로 있는 압축 파일 읽기 코드와 hide 명령으로의 stage, 두 기기 동시 연결 때의 busy 실패, 릴리스 주소를 테스트에서 바꿀 수 없는 점, payload_for에서 릴리스 키트까지 가는 테스트.
    • node_contract, system_ssh, device_own_engine(sshd가 필요한 ignored 테스트)은 로컬에서 돌리지 않았고, CI의 두 메일박스 레인이 돌렸습니다.
    • 스크립트 모음 823개 중 test_web_shard_discovers_twice_and_prepares_phone_once 1개가 맥미니의 bash 3.2에서 실패합니다(빈 배열 오류). 이 PR이 건드리지 않은 스크립트이고 CI는 Linux bash로 돌립니다.
Verification record

The device kit contract (contracts/device-kits.json) names the four
platforms, their programs, headers and the Windows runtime files, and the
platforms refused before install. A core fetches the format 4 manifest
from its own v<VERSION> release, refuses one that names another version,
commit or build order, checks ELF, Mach-O and PE headers and folder
entries, and keeps every kit within one 1024 MiB cache budget. No app
carries the manifest any more.
…f a device kit

The remote mailbox lane also runs on an ubuntu-24.04-arm runner, planned
for the device link's crates, its device test and the device kit contract,
and with every lane on main's push run and the nightly. The nextest
installer takes the runner processor's release.

The release asset gate now requires a kit for every platform in
contracts/device-kits.json and checks each kit's own file names. A core
takes a device's kit only from a manifest naming every platform, so a
release with the Linux kits alone is refused with its reason until the
release producers make the macOS and Windows kits.

The build, install, architecture, testing and contract guides describe the
one lookup rule, the release fetch, the cache budget and the refused
platforms.
…ar needs

The GNU tar on a Windows runner read the archive's absolute D: path as a remote host and failed the two stage tests in windows check.
A plain cargo build --release carries the crate's version, the commit and build order 0, and counted as a published release, so it asked GitHub for a release that does not exist. It now names the developer folder like any local build.

The archive test now puts a link and a folder in a program's place with that program's name and size, so only the entry type check refuses them.
@yansfil

yansfil commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

구조 점검 판정: desktop/scripts/device-helpers.mjs의 readUstar/stageDeviceKit이 hide-node/src/ssh/kit/archive.rs와 같은 키트 규칙을 한 벌 더 가진 파편화는 이 PR에서 수락하고 with-hide/hide-private#610에서 하나로 모읍니다(로컬 빌드로 N3 전에 기기를 시험할 길이 필요해서). 이 PR이 머지되면 release-kits(N3)가 들어올 때까지 릴리스 자산 검사가 실패하므로, N3를 다음 릴리스 전에 따라 넣습니다.

…to the pin

The Windows kit's runtime in contracts/device-kits.json restated the ConPTY
files contracts/conpty.json pins, with nothing holding the two together, and
two more copies decided what a Windows device got: a core sent its whole
holder-conpty folder from its own build, and a core whose files carry no mode
named a program by its own .exe rule. A pin that renamed or added a file
passed the pull request and broke first in a release's kit, and a Windows
device could get other files from a Windows core than from a Mac core.

Now a core sends a device exactly the runtime files its kit names, refusing
a folder short of one by its name, and marks a program by that device's kit.
hide-node's contract test holds the Windows runtime to the pinned files and
the file list beside them, and a change to the pin runs it. The app's own
ConPTY check reads the pin too.
@yansfil
yansfil enabled auto-merge November 6, 2026 02:29
@yansfil
yansfil added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 9d89f1a Nov 6, 2026
221 of 225 checks passed
@yansfil
yansfil deleted the feat/device-kit-contract branch November 6, 2026 02:44
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 9, 2026
…ease candidate (with-hide#2138)

Related: with-hide/hide-private#501 (N3 release-kits), base with-hide#2130 (N2),
companion with-hide/hide-private#625 (N4 publisher-mac-kit)

## Summary

릴리스 후보가 Windows 기기용 묶음을 만들지 않아서, Mac이나 Linux 코어가 릴리스로 Windows PC를 기기로 붙일
수 없었습니다.
이제 후보 실행의 `device bundles` 작업이 Linux 두 묶음 옆에 Windows x64 묶음을 만듭니다.
Windows 묶음은 Windows 앱이 싣는 바로 그 바이트(`compile (windows)` 산출물)와 고정된 ConPTY로
만들고, Windows를 두 번 빌드하지 않습니다.
묶음 목록(`device-bundles.json`)은 공개 쪽이 만들지 않습니다. 비공개 배포 쪽이 서명된 Mac 묶음을 더해 네
묶음의 목록을 씁니다(with-hide#625).
Mac 패키지는 더 이상 묶음을 릴리스 폴더에 복사하지 않습니다.

스크린샷 없음: 화면을 바꾸지 않는 릴리스 스크립트와 workflow 변경입니다.

## Review

- **판단해 주세요**: receipt schema 5는 `device_helpers`를 없애고 `device_kits`(목록
항목 그대로: asset, sha256, size, files)로 바꿉니다. 배포 쪽은 이 항목을 목록에 그대로 옮깁니다.
- **조심해서 볼 파일**:
- `.github/workflows/package.yml` - `device bundles`가 이제 `compile
(windows)`를 기다리고, `package (macos)`는 묶음을 기다리지 않음. 후보는 main과 다른
`package.yml`을 가진 source를 거부하므로(`release-candidate.yml:75`) rc는 이 PR과
#625가 모두 들어간 뒤에.
- `.github/workflows/release-candidate.yml` - receipt 작업이 묶음과 그 원본 빌드(두
Linux helper, Windows compile)를 함께 받아, 묶음 안 프로그램이 기록된 빌드와 같은 바이트인지 main의
검사기로 확인.
- `desktop/scripts/device-helpers.mjs` - `makeDeviceKit`,
`readDeviceKit`, `writeDeviceManifest`를 #625가 공개 checkout에서 import해서 씀.
이름과 인자 순서가 계약.
- `desktop/scripts/package.mjs` - 릴리스 Mac 패키지의 묶음 복사를 지움(engineering
principle 1).
- **질문**: #2130이 먼저 머지되면 이 PR과 #625가 들어갈 때까지 모든 릴리스가 자산 게이트에서 거부됩니다(의도된
실패). 셋을 연달아 머지해 주세요.

## Evidence

- **확인한 것**:
- `device-helpers.test.mjs` 20개: 후보 묶음 3개(목록 없음), Windows 묶음이 compile
산출물 바이트와 ConPTY 8개 파일을 담음, 다른 identity·바뀐 바이너리·ConPTY 없음 거부, 4개 항목으로 쓴
format 4 목록을 `readDeviceKit`·`stageDeviceKit`가 받아들임, 모자란 목록·바뀐
archive·다른 버전 이름 거부.
- `release-candidate.test.mjs` 13개: schema 5 receipt가 세 묶음의 항목을 기록, 다른
버전·추가 archive·기록과 다른 Windows 빌드 거부, 한 번만 채움.
- `test_release_candidate.py`, `test_release_assets.py`,
`test_ci_plan.py` 121개 통과; 자산 게이트는 여전히 20개 파일과 태그의 identity를 가진 format 4
목록을 요구하고, 모자란 묶음 메시지에서 N3 언급을 뺌.
- 로컬에서 실제 `device-helpers.mjs bundle`을 가짜 프로그램 바이트 + 실제
`fetch-conpty.py`로 돌려 세 archive를 만들고, Windows archive가 `.exe` 4개와
`holder-conpty/` 4개를 담는 것을 `tar -tzvf`로 확인.
  - `scripts/check-device-kits-single-source.py` 통과, desktop eslint 통과.
- **확인하지 못한 것**:
- 실제 릴리스 후보 실행: 이 PR에서 돌릴 수 없음. 이 PR의 `package` 레인 `device bundles` 작업
산출물이 c1의 CI 증거이고, 첫 실제 후보 실행이 남은 증거입니다.
- receipt 작업(`release-candidate.yml`)은 dispatch로만 돌아서 CI에서 실행되지 않음; 단위
테스트로만 확인.
  - 실제 기기로 Mac/Linux 코어에서 Windows 기기 연결: N5(rc 뒤)의 몫.
- 로컬 전체 `unittest discover`에서 부하(load 146) 때
`test_ci_verification_entrypoints`, `test_agent_live_protection`이
subprocess timeout으로 실패했고 단독 재실행에서 71개 통과.

<details><summary>Verification record</summary>

base `feat/device-kit-contract` 2c6f4bd, head 7881f05.
`node --test scripts/tests/*.test.mjs` 55 pass; `vitest run scripts`
(desktop) 31 pass; `pytest scripts/tests/test_release_candidate.py
test_release_assets.py test_ci_plan.py` 121 pass.

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