Skip to content

feat: connect the phone app through encrypted device relays - #2019

Merged
yansfil merged 9 commits into
mainfrom
feat/phone-app
Nov 2, 2026
Merged

yansfil merged 9 commits into
mainfrom
feat/phone-app

Conversation

@yansfil

@yansfil yansfil commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #2011

Summary

폰이 별도 네트워크 설정 없이 중계를 통해 기기에 연결되고, 한 앱에서 여러 기기를 고를 수 있습니다.
시작 화면은 기기와 같은 프로토콜의 /p/<n>/ 묶음을 열며, 지원하지 않는 기기에는 업데이트 안내를 보여 줍니다.
기존 /m/과 목록·대화·답장·빠른 키·시작·깨우기 화면을 공유하고, 기기별 알림과 외부 스크립트 차단을 추가했습니다.

390px QR 연결 화면: 기기 이름을 일반 텍스트로 표시
390px 기기 선택: 연결 점과 내 차례·작업 중 개수
지원하지 않는 기기의 버전과 업데이트 안내

버전이 바뀐 저장 기기: 인증 없이 차단하고 두 버전을 표시

Review

  • 판단해 주세요: 390px의 긴 기기 이름, 상태 수, 업데이트 문구와 삭제 확인 흐름.
  • 조심해서 볼 파일: relaySocket.ts, connection.ts - 첫 암호화 인증, 중단·재접속, 입력을 다시 보내지 않는 경계.
  • 조심해서 볼 파일: hosts.ts, push.ts, public/m/sw.js - 기기별 저장소·푸시 등록의 수명과 알림 대상.
  • 조심해서 볼 파일: web/package.json, scripts/verify-web.sh, web-e2e.yml - 새 체크아웃의 WASM 준비와 실패 전파, 목록 조회와 실행의 빌드 경계.
  • 비용 검토: 메시지 크기만큼 암복호화하며 송신 대기열은 없습니다. 소켓별 초당 만료 확인 하나, 표시 중인 목록만 최대 16개 연결을 소유합니다.
  • 비용 검토: 저장 기기 16대·송신 버퍼 1 MiB·메시지 256 KiB·정적 캐시 128개로 제한하고, 닫기·숨김·삭제 때 소유 자원을 정리합니다.

Evidence

  • 확인한 것: 실제 암호화 연결을 쓰는 390px 브라우저 흐름 14개, 기존 /m의 실제 데몬 연결 흐름 4개를 통과했습니다.
  • 확인한 것: 외부 스크립트 차단, QR 카메라 디코딩·해제, 기기별 푸시 등록·삭제와 알림 링크 대상을 확인했습니다.
  • 필수 검사: Rust lint·테스트 7,345개, 웹 2,465개·데스크톱 307개 단위 테스트와 타입 검사·lint·빌드가 통과했습니다.
  • CI: 병합 HEAD의 verify PASS. 정책 검사를 새로 실행했고, 나머지 검사는 이전 성공 실행을 재사용했습니다.
  • 확인하지 못한 것: 실제 iPhone의 홈 화면 저장소·카메라·다중 푸시 등록 및 실서비스 푸시 수신, 배포된 기기/중계 통합.
  • 생성물: build:phone은 root loader·서비스 워커·manifest·protocols.json과 /p/1/을 web/phone-dist/에 만듭니다.
Verification record

Head: d4298e4ba116ac4f623916a1dd781eae8a30f219; base: main (#2011 병합 후).
작성자 검토는 정확성·중복·단순성·모듈 경계·소유권/상한·테스트를 확인했습니다.
독립 검토: 화면·연결 구현 1205d9d4b PASS. 이후 변경은 WASM 빌드 진입점과 CI 준비·검증 fixture입니다. 목록의 버전 검사 우회와 답장 재전송 회귀 검증을 보완했습니다.
390×844 CSS pixels, DPR 2의 격리된 브라우저와 로컬 가짜 기기를 사용했고 종료 후 자체 서버·카메라·탭을 정리했습니다.
공유 Rust 라이브러리의 native responder와 WASM initiator 사이에서 실제 암호화 바이트를 교환했습니다.
외부 배포·운영 앱 교체·운영 데몬 조작은 수행하지 않았습니다.

  • bash scripts/verify-cargo.sh lint && bash scripts/verify-cargo.sh test-scoped && bash scripts/verify-web.sh: 현재 SHA 모두 PASS, 재실행 없음. Rust 7,345 PASS / 169 ignored; web 2,465 PASS / 3 skipped; desktop 307 PASS / 4 skipped.
  • bash scripts/verify-cargo.sh hakari: 현재 SHA PASS. 생성물 차이와 의존성 변경 없음.
  • bash scripts/verify-web.sh web e2e phone-relay.spec.ts mobile.spec.ts --workers=1: acc975885에서 18 PASS (릴레이 14, 기존 직접 연결 4).
  • origin/main merge로 날짜 수정 #2020과 중계 서버 #2014를 포함했습니다. 폰 앱 소스·빌드 진입점은 acc975885와 동일합니다.
  • 저장된 기기를 다른 프로토콜로 바꾼 뒤 루트 목록과 헤더 선택기에서 암호화 프레임·인증·앱 메시지 0건을 확인했습니다.
  • 실제 답장 적용 후 확인 응답 전에 연결을 끊었고, 재접속 후 적용 횟수는 1회였습니다.
  • 관련 저장소·서비스 워커·연결·한국어 문구 단위 테스트 20개, 개인정보 경로·harness namespace·design contract PASS.
  • ABI가 없는 상태에서 패키징용 web bundle이 생성물을 만들었습니다. 준비 실패는 번들링을 차단하고 shard 목록 조회 두 번은 준비 작업을 시작하지 않습니다.
  • 기존 CI의 패키징 2건·Windows E2E 준비 시간·정책 fixture 실패를 수정했습니다. Web build의 5분 제한은 유지하고 최초 WASM 도구 준비를 별도 단계로 분리했습니다.
  • 푸시 권한과 PushManager는 브라우저 테스트에서 대체했습니다. 카메라 입력은 생성한 QR 영상이며 디코딩·track 종료는 실제 경로입니다.
  • WebKit과 실제 iPhone, 운영 푸시 제공자는 실행하지 않았습니다.
  • 추가 로컬 정책 검사 (acc975885): 813개 중 791 PASS / 21 skipped / 1 FAIL. 범위 밖 macOS 전용 test_verification_builds.test_warm_builds_observe_core_and_test_changes_and_propagate_failures의 fixture에 hide-holder가 없습니다. 같은 SHA의 해당 테스트 1회 재실행과 main cbefda718의 동일 파일 실행 모두 같은 실패입니다. CI 정책 검사는 현재 SHA PASS입니다.
  • 수정 중 최초 실행의 두 진입점 테스트와 모바일 sleep 테스트는 시간초과가 있었고, 각각 해당 테스트만 1회 재실행해 통과했습니다. acc975885의 정책 검사는 해당 진입점 실패 없이 완료됐으며 원본 로그는 보존했습니다.
  • 이전 후보 8162a5440의 Rust 검사에서 범위 밖 remote_spawn/adapter_contract 테스트가 각 1회 실패했고 같은 SHA의 각 단독 재실행은 통과했습니다. 해당 원본 로그는 보존했습니다.
  • 이전 후보의 한국어 조사 규칙 실패는 현재 후보에서 문구를 수정해 통과했습니다.

@yansfil
yansfil marked this pull request as ready for review November 2, 2026 09:38
@yansfil
yansfil merged commit 03c00c0 into main Nov 2, 2026
45 checks passed
@yansfil
yansfil deleted the feat/phone-app branch November 2, 2026 12:19
yansfil added a commit that referenced this pull request Nov 2, 2026
Related: #2011

## Summary

폰이 기본으로 Hide 중계를 통해 연결되고, 설정의 한 연결 줄에서 연결 상태와 다시 시도·업데이트·상한 거부를 확인합니다.
QR은 app.withhide.dev를 열며 5분 뒤 만료됩니다. Tailscale 직접 연결은 고급에서 고릅니다.
방법마다 페어링한 폰을 따로 유지하고, 끄기·해제 시 연결을 닫습니다.
폰 내용은 기기와 폰 사이에서 암호화합니다.
기존 Tailscale 설정은 그대로 이어 쓰고 새 설정은 중계로 시작합니다.

![Settings Mobile: encrypted relay connection, five-minute QR and
advanced
Tailscale](https://github.com/yansfil/pr-assets/blob/main/hide/feat-hided-relay/e8fa807/settings-qr.png?raw=true)

실제 Settings 컴포넌트의 격리 갤러리입니다.
연결 줄, QR 만료 안내, 접힌 고급 영역을 확인해 주세요.

![Settings Mobile: relay stays available when the old Tailscale setup
cannot be
removed](https://github.com/yansfil/pr-assets/blob/main/hide/feat-hided-relay/5eeb736/settings-cleanup.png?raw=true)

이전 Tailscale 연결을 정리할 CLI가 없어도 중계는 연결되고, 같은 한 줄에 정리 실패가 남습니다.

## Review

- **판단해 주세요**: 연결 상태와 암호화 설명의 길이, 고급 Tailscale의 발견성.
- **조심해서 볼 파일**: `hided/src/mobile/relay.rs`, `phone.rs` - 암호화 경계, 종료
순서, 취소와 큐 상한.
- **조심해서 볼 파일**: `mobile/mod.rs`, `phones.rs`, `store.rs` - 키 저장, 방식 전환과
기존 폰 보존, 재연결 후 요청 기록.
- **비용 검토**: 연결 1개, 폰 작업 8개, 폰당 수신 8프레임·공유 송신 32프레임; 상태 전환만 발행하며 core 잠금
안에서 네트워크 작업을 하지 않습니다.

## Evidence

- **확인한 것**: 실제 hided 중계 통합 6개가 macOS·Linux·Windows에서 암호화·재연결·방법별 폰
보존·해제·끄기·미인증 제한 시간을 확인합니다.
- **확인한 것**: 입력 중단 테스트가 연결을 끊고 같은 요청을 재시도할 때 영구 대기에 남지 않음을 확인합니다.
- **확인한 것**: Mobile UI 24개, 직접 연결 브라우저 5개와 격리 갤러리의 한글·영문·큰
글씨·dark/light·QR·고급 상태를 확인했습니다.
- **확인한 것**: 최신 커밋에서 로컬 lint·Rust 7,357개·web 2,471개·desktop 307개·빌드·디자인
계약과 GitHub CI가 통과했습니다.
- **재시도 이력**: 기존 기기 테스트 #430·#439는 최초 실패 후 로컬 단독 1회와 CI 작업 1회 재실행에서
통과했습니다. CI에는 기존 세션 복원 #419의 자동 재시도도 있습니다.
- **확인하지 못한 것**: 실제 폰·native 앱·운영 TLS와 실제 PTY 답장 재전송은 통합·배포 검증에 남아 있습니다.

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

Head: `d75b9db7d9ef0287392452ad5fc77bfce605f26c`.
Base: `b1b25cde4`, including protocol #2011, Memory correction #2020,
relay server #2014 and hosted phone #2019.
Scope: mobile-relay B1-B10, hided B24, B28; hided transport, Settings
Mobile, owning architecture/UI guides.
The architecture merge preserves both the hosted phone WASM initiator
and the device responder/admission/authentication contract.
Cargo.lock and workspace-hack did not change in that merge; their shared
feature union was generated at `92620a992` and passes CI.
Caller tests use shared admission/routing types and real Noise sessions
without implementing a second relay service.
The interrupted-input test uses the real phone/Noise path and node
permission boundary; it does not claim an actual PTY write.
The original socket handler already detached its input task on
disconnect, so the original cancellation premise was not reproduced.
The follow-up additionally settles from the blocking operation with an
Uncertain drop guard; the caller test verifies disconnect/retry lifetime
rather than isolating that guard.
Independent re-review passed at `5eeb73668`; the additional live-peer
and unreaped-task bound at `744506a3e` was reviewed and accepted.
The QR screenshot was captured at `e8fa80774`; the cleanup screenshot
was captured at `5eeb73668`; the Settings product changes are unchanged
since that follow-up.
The five direct-mobile browser journeys passed at `6c2a6e338` without
weaker assertions or timeouts.
The Cursor fixture now explicitly selects Advanced > Use Tailscale
before enabling Mobile.

Current-head local verification ran on macOS under the shared mission
lock:

- `bash scripts/verify-cargo.sh lint`: PASS, 1m 10s.
- `bash scripts/verify-cargo.sh test-scoped`: core 3,929 passed, 1
failed, 20 ignored; stopped at the existing own_devices assertion in
`herdr-core/src/runtime/tests/own_devices.rs:158`.
- The only exact-test rerun on the same SHA passed in 0.27s; the initial
Kit/GuardrailPolicy assertion failure remains recorded, matching
[#430](with-hide/hide-private#430) and
[#439](with-hide/hide-private#439).
- `bash scripts/verify-cargo.sh test-scoped --workspace --exclude
herdr-core` then ran the crates the initial command had not reached:
3,427 passed, 149 ignored.
- Combined Rust coverage: 7,357 passed, 169 ignored, including the one
separately rerun test; this is a split completion after an initial
failure, not an uninterrupted green run.
- `bash scripts/verify-web.sh`: PASS; web 2,471 passed / 3 skipped,
desktop 307 passed / 4 skipped; type checks, lint and builds passed.
- `node scripts/check-design-contract.mjs`: PASS.

[GitHub CI run
41456834038](https://github.com/with-hide/hide/actions/runs/41456834038)
passed on attempt 2 after exactly one failed-job rerun:

- Attempt 1: Rust 7,338 passed / 1 failed / 166 skipped; own_devices
#430/#439 failed both automatic attempts.
- Attempt 2: Rust 7,339 passed / 166 skipped; own_devices passed on its
first attempt in 0.027s.
- Attempt 2 also includes one automatic retry of the existing
session-restore test
[#419](with-hide/hide-private#419); the first
failure remains in its job log.
- Linux and Windows each passed all six mobile_relay caller tests on
attempt 1; Windows job `125315707247` completed successfully.
- Linux browser shards and Windows E2E passed on attempt 1 without flaky
results.
- Cursor phone passed in shard 6 (`125317575438`, 6.6s); the
reopened-tab test tracked by #418 passed in shard 4 (`125317575230`,
3.3s), both on their first attempt.
- macOS desktop, protocol and packaging lanes passed; macOS hided mobile
evidence is the local run above.

Real phone/native-app interaction, production TLS and actual PTY replay
remain outside this PR's verified evidence.

</details>
yansfil added a commit that referenced this pull request Nov 2, 2026
Related: #2019, #2018

## Summary

폰의 연결 안내가 길고, 기기 선택 메뉴가 화면 내용과 겹쳤습니다.
선택한 B1 안으로 기기 중심의 QR 화면과 아래에서 열리는 기기 선택창을 적용하고, 알림·홈 화면 안내를 간결하게 정리했습니다.
한국어·영어 문구를 기존 언어 설정에 맞추고, 상세 제목은 줄바꿈하며 답장과 빠른 키는 공용 부품으로 맞췄습니다.

![QR 연결 화면: 왼쪽 변경 전, 오른쪽 B1 적용 후 (각
390px)](https://github.com/yansfil/pr-assets/blob/main/hide/feat-phone-design/0d2bb7d/phone-qr-before-after-390.png?raw=true)

![기기 선택: 왼쪽 변경 전, 오른쪽 아래 선택창 (각
390px)](https://github.com/yansfil/pr-assets/blob/main/hide/feat-phone-design/0d2bb7d/phone-picker-before-after-390.png?raw=true)

![버전 안내: 왼쪽 변경 전, 오른쪽 짧은 안내와 버전 비교 (각
390px)](https://github.com/yansfil/pr-assets/blob/main/hide/feat-phone-design/0d2bb7d/phone-version-before-after-390.png?raw=true)

## Review

- **판단해 주세요**: 390px 화면의 여백, 한글 줄바꿈, 기기 선택창의 정보 밀도가 적절한지 확인해 주세요.
- **조심해서 볼 파일**: `HostPicker.tsx`, `ui/sheet.tsx`는 선택창을 닫은 뒤 기기 버튼으로 초점을
돌려줍니다.
- 연결·전송·서비스 워커·프로토콜 동작은 기존 계약을 유지합니다.

## Evidence

- 최종 커밋에서 폰 E2E 전체 20개, 웹 2,481개, 데스크톱 307개 테스트와 빌드·린트·디자인 계약 검사를
통과했습니다.
- 이전 커밋의 Rust 검사에서 변경 밖 테스트가 실패 후 단일 재실행으로 통과했습니다. 원본 결과는 아래 기록에 보존했습니다.
- 390px 실제 브라우저에서 밝은·어두운 화면, 긴 기기명, 한국어 글꼴, 오프라인·연결 거절, 상세 대화·터미널을
확인했습니다.
- 캡처는 실제 폰 번들과 테스트 중계 픽스처를 사용했습니다. 실제 iPhone의 설치·카메라·OS 알림은 이번 검증에 포함하지
않았습니다.

**후속**: 도구 호출 요약은 [별도
이슈](https://github.com/with-hide/hide-private/issues/451)로 분리했습니다.
정규화된 도구 호출에는 원본 파일 위치가 없어 기존 대화 페이지 기준에 바로 넣을 수 없습니다.
파일 대화, 그래프 대화, 데이터베이스 대화의 세 경로에서 페이지·소유권·증분 갱신을 함께 설계해야 합니다.
이번 변경에는 도구 요약이나 wire 변경이 없습니다.

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

- Head: `a36833ebb53489507e74735270409825efcc0430`
- Base ancestry: `97bbc867b69f64184ad0391373e4c9b761a231fd` (`#2019` and
`#2018` merged).
- Baseline visual source: `1205d9d4b21f1757f99a902e7664f2ecacde9b2c`;
saved real build with realistic fixture name.
- Follow-up review: direct pairing heading/expiry assertions match the
chosen B1 screen; stale hosted-layout documentation updated;
push-removal assertions wait for the home URL before reading
service-worker registrations. No product-code change after the captures.
The 15-file final diff retains transport and ownership boundaries.
- No independent review was requested in this task.
- All verification commands ran under `lockf -k
/tmp/mission-27-gate.lock`, with pnpm 10 for web commands.
- Final head: `verify-web.sh web e2e mobile.spec.ts
mobile-settings.spec.ts phone-relay.spec.ts` passed 20/20 without retry;
`verify-web.sh` exit 0 (web 2,481 passed / 3 skipped, desktop 307 passed
/ 4 skipped); design contract exit 0.
- E2E used fresh hided and hook binaries built after merging main; the
later commits change only tests and documentation. Full native
lint/tests were not repeated for this test-only follow-up; the previous
local record is below, and the final head runs CI.
- Previous validation head: `0d2bb7d7c919a0c1b49b04becd6484a18715d2f6`;
the following Rust/web results belong to that head.
- `bash scripts/verify-cargo.sh lint`: exit 0.
- `bash scripts/verify-web.sh`: exit 0; web 2,465 passed / 3 skipped,
desktop 307 passed / 4 skipped, typecheck/lint/build passed.
- Mobile relay E2E: 15 passed; `node scripts/check-design-contract.mjs`:
exit 0.
- `bash scripts/verify-cargo.sh test-scoped`: core 3,929 passed / 1
failed / 20 ignored.
`runtime::tests::inbound::a_linked_node_s_sessions_are_read_through_its_link`
expected no pane registration but saw `Unregistered`; its one exact-test
rerun at that previous validation head passed. Original failure
retained.
- Remaining workspace tests, run once after fail-fast with `test-scoped
--workspace --exclude herdr-core`: exit 0, 3,419 passed / 149 ignored
across 62 suites. Core doc-tests also exit 0 (0 tests). Including the
successful focused rerun, 7,349 Rust tests passed / 169 ignored; the
original failed full-run result remains recorded above.
- At intermediate head `5c0f835711e768097437237c0f4c8371e1c12bdb`,
`lifecycle::a_holder_runs_its_shell_and_carries_input_and_output_across_connections`
exited before its expected terminal output. Its one exact-test rerun at
that same head passed. Both native test failures are outside this diff;
their causes were not changed or claimed resolved.
- Captures at `0d2bb7d7c` remain applicable: phone components, their
translations and shared sheet have no changes at the final head.
Captures use a loopback relay endpoint override and a real encrypted
peer with fixture application data; viewport measured as 390 × 844 CSS
pixels.
- Terminal keeps the existing body token (`13px × 1.25` on phone); no
terminal parsing or input behavior changes.
- Local follow-up at `80528c5f9` passed 19/20 mobile E2E cases; the
push-removal test read service-worker registrations during navigation.
It had waited for an action present on both the old picker and the
destination. The final test waits for the destination URL first, without
retries, sleeps or product changes.
- Original CI `41469753615` failed the direct-pairing journey because
main added an expectation for the former heading and expiry sentence.
The final test asserts the chosen device-name heading exactly and the
approved short expiry copy, with all post-pairing assertions preserved.
- Physical iPhone installation, QR camera permissions, OS push delivery
and Windows/Linux native runtime are not established by these local
macOS checks.

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