Repository navigation
feat: count remote device connection outcomes - #1725
Merged
Merged
Conversation
yansfil
added a commit
that referenced
this pull request
Oct 27, 2026
Related: #1722, #1725 ## Summary main의 `verify`가 #1722 머지(e21d4bb) 뒤로 `rust workspace`의 기기 통계 테스트 하나에서 계속 실패합니다. 두 PR이 따로 초록인 채 머지되며 생긴 충돌입니다: #1722는 Herdr 시작 실패 뒤 Retry를 kit 재적용에서 기기 재연결로 바꿨고, #1725의 테스트는 옛 kit 경로로 Retry를 흉내 냈습니다. 제품 동작은 맞습니다: 재연결이 새 연결 시도를 열고, 그 연결의 kit 보고(`Started`)가 성공 한 번으로 기록됩니다. 그래서 코드는 그대로 두고, 테스트가 Retry 뒤 재연결의 결과를 공급하도록 고쳤고, `docs/ARCHITECTURE.md`의 통계 계약에 이 Retry가 재연결의 시도로 세어진다는 문장을 더했습니다. ## Review - **판단해 주세요**: 되돌리기(revert #1722) 대신 테스트 수정을 택했습니다. Retry 성공이 연결 한 번으로 세어진다는 계약은 재연결 경로(`spawn_host_start`의 `begin_device_connect` -> `ingest_host_established`의 claim/complete)에서 그대로 지켜집니다. - **조심해서 볼 파일**: `herdr-core/src/runtime/tests/device_kit.rs` - fixture에 SSH transport가 없어, 바깥 worker가 하는 시도 등록과 연결 결과를 테스트가 직접 넣습니다(바로 위 통계 테스트와 같은 방식). ## Evidence - **확인한 것**: 수정 전 main(e22c924)에서 CI와 같은 단언(device_kit.rs:2897, 두 번째 `Ready(Started)` 없음)으로 로컬 실패를 재현했습니다. - **확인한 것**: 수정 뒤 `verify-cargo.sh nextest -p herdr-core -E 'test(/device_kit|device_analytics|device_connect/)'` 56개 통과, `fmt-check` 통과. - **확인한 것**: 테스트는 Retry가 기존 연결을 닫는지, Retry 자체는 통계를 늘리지 않는지, 재연결 성공이 한 번만 기록되는지를 봅니다. - **확인하지 못한 것**: 디스크 여유가 4GB 아래라 로컬 clippy와 다른 crate는 돌리지 않았습니다. CI `verify`에 맡깁니다. - **확인하지 못한 것**: 실제 기기로 Retry 뒤 PostHog 이벤트가 오는지는 보지 않았습니다. <details><summary>Verification record</summary> Base: `e22c924b67a630e04e4c907d9d28bb021ef22c07`. Failing main runs: 40450672875, 40453581851, 40455435250; last green main a1bed1f (run 40449782460). </details>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hide가 시작하는 outbound 원격 기기 bootstrap의 성공 횟수와 실패 단계를 확인할 수 있도록
hide_device_connected하나를 추가합니다.기기 콘텐츠와 식별자는 보내지 않고, 기존 설치 통계 설정과 전송 큐를 사용합니다.
이 core로 직접 접속하는 inbound node는 집계하지 않습니다.
Review
herdr=preserved로 구분합니다.runtime/device_analytics.rs는 완료 토큰 소비와 실패 매핑,runtime/hosts.rs와runtime/kit.rs는 연결 수명 경계를 담당합니다.failed,failed_step=installEstablishError::Download)failed,failed_step=downloadfailed,failed_step=herdr_startfailed,failed_step=herdr_handoffready,herdr=started/handed_off/current/keptready,herdr=preserved플랫폼은 허용된 macOS/Linux 아키텍처 조합만 전송하며, 플랫폼 확인 전 오류는 승인된
unknown을 사용합니다.연결 세대에 묶인 시도 토큰을 첫 Apply 또는 bootstrap 완료가 소비합니다.
소비 후 중복 완료·status·snapshot은 이벤트를 만들 수 없고, 재연결과 Retry는 새 토큰을 받습니다.
이전 세대의 완료는 무시하며, 취소·동의 철회·제거는 미완료 토큰을 폐기합니다.
Evidence
Verification record
c88c8c470e14(main). Head:70483c77806a413c766349c3f392bad145307dcd.70483c77806a413c766349c3f392bad145307dcd, no Fix now defects. Follow-up: production SSH admission fixture coverage; tests currently supply initial admission.cc0c99d6b78f50c9b8e21f5aa27bfbd85968797fagainst mainc88c8c470e14a712245fa6e3cc27c2faedc7aada.