Repository navigation
Split runtime into responsibility-owned modules - #81
Merged
Merged
Conversation
yansfil
force-pushed
the
refactor/runtime-modules
branch
from
September 16, 2026 15:20
4d88fec to
3c637f5
Compare
1 of 3 tasks
yansfil
added a commit
that referenced
this pull request
Sep 17, 2026
## Summary - Make the worktree Overview regression test wait for background reads to become idle before measuring Git activity. - Add test-only idle inspection to `BackgroundRead` and `WorktreeReader`. - Keep the original contract assertion that closing Overview and unchanged ticks do not trigger additional Git log reads. ## Related - Follows the runtime refactor merged in #81. ## Review focus - **사람이 판단할 것**: Confirm that the test-only idle seam reflects the existing reader contract and does not change production behavior. - **위험한 파일**: `herdr-core/src/reader.rs` and `herdr-core/src/worktrees.rs`, because they add test-only access to background reader state. - **리뷰어에게 묻는 것**: Is three consecutive idle polls an adequate deterministic settle boundary for this fixture? ## Risk surface - **High-frequency path**: The test protects the existing Overview close and idle Git-read bound. The production reader scheduling and cache behavior are unchanged. ## Evidence - Targeted Overview regression test: 5/5 repeated runs passed. - `GIT_CONFIG_GLOBAL=/dev/null bash scripts/verify-cargo.sh test`: passed. - `GIT_CONFIG_GLOBAL=/dev/null bash scripts/verify-cargo.sh lint`: passed. - Capability-reader off-lock gate: passed. - Typed wire boundary structure gate and its 7 regression tests: passed. - `GIT_CONFIG_GLOBAL=/dev/null zsh scripts/check-runtime-gates.sh`: passed. - Swift suite: 462 tests passed. - Herdr pin single-source check: passed. - Pinned Herdr schema-only contract check: passed. - A non-isolated local Rust run was affected by the workstation's global Git commit-signing configuration; the isolated run passed without changing repository behavior. - No native interactive UI change was made, so native visual QA is not applicable. ## AI tooling - [ ] 사람이 직접 작성 - [x] 일부를 AI 도구로 작성 - [ ] 대부분을 AI 도구로 작성 **손으로 확인한 것**: Reviewed the three-file diff, confirmed the production assertion remains unchanged, and checked the targeted repetition plus full runtime gate output.
This was referenced Sep 17, 2026
yansfil
added a commit
that referenced
this pull request
Sep 17, 2026
## Summary - Extract ShellModel navigation presentation into its own module. - Extract pane-selection lifecycle and transition policy into a dedicated module with focused tests. - Keep Herdr dispatch and snapshot settlement coordination in `ShellModel`. ## Related - Follows the runtime refactor merged in #81 and the overview reader stabilization merged in #83. ## Review focus - **사람이 판단할 것**: Confirm that pane-selection and navigation state transitions still match the ShellModel ownership contract. - **위험한 파일**: `ShellModel.swift`, `ShellModelNavigation.swift`, and `ShellModelPaneSelection.swift`, because presentation and transition policy moved across module boundaries. - **리뷰어에게 묻는 것**: Are the extracted pure policies sufficiently isolated from Herdr dispatch and snapshot settlement? ## Risk surface - **Ownership**: Herdr dispatch and snapshot settlement remain in `ShellModel`; the extracted modules own presentation and pure transition policy. - **Failure path**: Existing refusal and settlement behavior remains in the ShellModel event path. - **High-frequency path**: The pane-selection policy tests and full Swift suite cover the extracted transitions. ## Evidence - Rebased onto `origin/main` at `72f382e` without conflicts. - `bash scripts/check-hide-full.sh` passed. - Swift shell suite: 465 passed. - Rust, repository structure, design/component, Herdr contract, and native bundle gates passed. - Existing Highlightr, SwiftTerm, and archive deployment-target warnings were unchanged baseline warnings; no ShellModel-specific warnings remain. - Worktree is clean at `76da63e`. ## AI tooling - [x] 일부를 AI 도구로 작성 **손으로 확인한 것**: 직접 대조한 rebase base, clean worktree, commit range, full gate output, and assembled bundle result.
yansfil
added a commit
that referenced
this pull request
Sep 17, 2026
## Summary Split the former monolithic Hide UI source into responsibility-owned Swift modules without changing runtime behavior or snapshot/event ownership. The refactor now has dedicated modules for search, sidebar, main surface, terminal surface, chat composer, shared environment/font handling, shell root composition, recent navigation, Pet dashboard, and worktree creation. The obsolete `HideUI.swift` file is removed. The component/design ownership checks and the Rust source-structure regressions now follow the new module boundaries. ## Related - PR #83 - stabilize the worktree overview reader test and merge the current base. - PR #81 - split the Rust runtime into responsibility-owned modules. ## Review focus - **사람이 판단할 것**: Whether the extracted SwiftUI modules match the existing product composition and ownership patterns. - **위험한 파일**: `macos/Sources/HerdrMacOS/HideMainView.swift`, `macos/Sources/HerdrMacOS/HideTerminalSurface.swift`, and `herdr-core/src/runtime/tests/snapshot_delta.rs` because they preserve the main composition, terminal retention surface, and source-structure regressions. - **리뷰어에게 묻는 것**: Does the final module layout provide the right long-term ownership boundary now that `HideUI.swift` is gone? ## Risk surface - **Ownership**: No core state, Herdr ownership, snapshot wire, or event dispatch semantics changed. The change only moves existing SwiftUI declarations and updates structural ownership checks. - **Failure path**: No user-visible failure path or diagnostic behavior changed. The Rust source checks were updated only to read the new Swift file locations. ## Evidence - **확인한 것**: Rebased cleanly onto `origin/main` at `72f382e`; `bash scripts/check-hide-full.sh` passed with Rust workspace tests, Swift tests, repository invariants, Herdr schema, design contract, and design-control tests. Rust runtime tests reported 554 passed and 6 ignored; Swift tests reported 462 passed; Python script tests reported 33 passed. `bash scripts/check-hide-accessibility.sh` passed against the assembled signed dev bundle and native accessibility probe. Component ownership, worktree policy, workbench ownership, no-attribution, and diff checks passed. - **확인하지 못한 것과 그 이유**: No separate interactive screenshot/performance evidence was collected because this is a behavior-preserving source refactor and the native accessibility gate passed. The full build still prints existing warnings from unchanged Highlightr/SwiftTerm/vendor code, the unchanged `HerdrApp.swift` sendability capture, and linker deployment-target diagnostics; no warning points at changed source paths. ## AI tooling - [x] 대부분을 AI 도구로 작성 **손으로 확인한 것**: Rebase result, commit sequence, changed-file ownership, full deterministic gate output, native accessibility output, no-attribution result, and clean worktree state.
1 task
yansfil
added a commit
that referenced
this pull request
Sep 17, 2026
## Summary 2026-09-17 16:04 `core.jsonl`에서 본 두 증상을 고칩니다: Herdr가 `pane.close`를 인정한 뒤에도 pane이 `pane_closed` 이벤트가 소비될 때까지(~5초) 화면에 남아 클릭을 받았고, 그 pane을 한 번 더 닫으면 `layout.export`가 다시 실행돼 `layout_not_found`로 실패했습니다. 원인은 core가 close를 전송 응답만으로 끝난 것으로 보고, 같은 대상에 대한 두 번째 요청을 막지 않은 데 있습니다. 이 PR은 `prd/hide-async-state`의 구현을 현재 `main` 모듈 구조(#81, #85, #86, #87, #88 분할) 위로 옮긴 것입니다. - Herdr 소유 mutation(split, zoom, resize, tab move, remote mutation, close) 하나마다 core가 연결 세대, 대상과 충돌 범위, 단계, 절대 5초 deadline을 가진 operation 레코드를 갖고 `status.async_operations`로 내보냅니다. 전송 성공은 topology 확정이 아니며, 만료되거나 결과가 불명인 mutation은 재전송 없이 `unknown`으로 표시되고 같은 범위의 새 요청은 거절됩니다. - close는 승인 즉시 `closing`에 들어가 입력, focus, 같은 대상 재닫기를 막고 확인된 생존 pane/tab으로 선택을 옮긴 뒤에야 layout export와 close를 보냅니다. 캡처한 항목은 확정된 20개 undo 기록과 분리된 예약이라 거절되거나 불명인 close가 이전 기록을 밀어내지 않고, fresh snapshot의 부재 확인만 예약을 요청 순서로 확정합니다. - 결과가 불명인 close는 읽기 전용 status check 하나를 시작하고, 그 snapshot을 navigator에 먼저 적용해 이미 닫힌 대상이 다른 이벤트까지 화면에 남지 않게 합니다. - 활동 상태를 알 수 없는 agent pane은 fresh status 전까지 destructive close를 막고(`Check status`), 작업 중 확인 모달과 분리합니다. 읽지 않은 완료는 더 이상 확인을 묻지 않습니다. - 세션 coordinator에 250 ms tick이 생겨 Herdr 이벤트 없이도 deadline이 진행되고, 독립 workspace는 다른 workspace가 layout이나 대체 focus를 기다리는 동안에도 게시됩니다. - Swift 셸은 pane 헤더 suffix, tab strip 라벨과 경고 glyph, tab strip 안내 줄의 `Check status`로 이 상태를 그리고, 확인 모달은 `Keep open`을 기본으로, `Stop work and close`를 destructive 선택으로 둡니다. 포팅 판단은 `agents/runs/hide-async-state-port/port-report.md`(로컬)에 정리했습니다. ## Related - `agents/prd/hide-async-state/prd.md` (이 PR에 포함) - 원본 브랜치 `prd/hide-async-state` (`1feb151`, base `cc8f02f`), main 분할 이후라 rebase 불가 - 선행: #69 close 확인 프롬프트, #79 `hide-herdr-client`, #80 Agent Conversation Viewer, #81/#85/#86/#87/#88 모듈 분할 ## Review focus - **사람이 판단할 것**: - close 확인 모달의 버튼 순서와 문구(`Keep open` 기본 / `Stop work and close` destructive). 원본 브랜치의 `DESIGN.md`는 `Close and stop work`라 적었고 코드는 `Stop work and close`였는데, PRD B31 문구를 따라 코드 쪽으로 맞췄습니다. - coordinator의 background reader(usage HTTP, `git`, `lsof`)가 이제 subscription이 살아 있을 때만 돌고, 이벤트 직후 한 pass는 건너뜁니다. Herdr 연결이 끊긴 동안 Explorer Git 장식, ports, usage 갱신이 멈추는 것을 받아들일지. - `ActiveSubscription::stop`이 reader 스레드를 더 이상 join하지 않습니다(detached reader의 다음 메시지는 세대 검사로 버려짐). - **위험한 파일**: - `herdr-core/src/runtime/editor.rs`: close 수명주기 전체가 교체됐습니다. `close_precondition_failure`(승인 뒤 대상 변화 감지), `promote_close_reservations`(요청 순서 확정), `ingest_close_status_results`(lock 안에서 `ingest_session_with_catalog` 재진입). - `herdr-core/src/runtime/operations.rs`(신규): 레코드 정의와 pane/remote/tab-move 수명주기, `observe_pane_operations`의 resize 확정 기준(raw rect 비교). - `herdr-core/src/session_sync/replica.rs`: `published_state`와 workspace 단위 부분 게시. 잘못되면 서로 다른 시점의 pane/layout/focus가 섞입니다. - `herdr-core/src/session_sync/coordinator.rs`: tick과 background read 게이팅. - **리뷰어에게 묻는 것**: 원본 브랜치는 이 변경에 새 `#[test]`를 추가하지 않았고 기존 단언만 바꿨습니다(unread completion, close reservation, ambiguous effect, `pane.close_status_unknown`). 이 PR도 같은 범위입니다. B10(응답/이벤트 역전), B12(deadline 만료), B17(가득 찬 undo stack) 회귀 테스트를 이 PR에 넣을지, 후속으로 뺄지 정해 주세요. ## Risk surface - **Runtime mutex**: 새로 lock 안에서 하는 일은 `tick_async_operations`(메모리 비교만), `ingest_close_status_results`의 `ingest_session_with_catalog` 재진입(기존 세션 ingest와 같은 비용). 서브프로세스나 I/O는 없고 `check-capability-readers-off-lock.sh`가 통과합니다. 다만 coordinator 스레드 자체는 여전히 usage HTTP, `git`, `lsof`를 inline으로 실행하므로 이벤트 소비가 그만큼 늦어질 수 있습니다. 이번 PR은 그 창을 줄이기만 하고 없애지 않습니다(port-report의 coordinator-thread finding). - **Snapshot wire**: `status.async_operations`와 `recent_closed.pending/can_reopen/reopen_blocked_reason`은 revisioned `rest`에 실립니다. 셸이 매 프레임 그리는 값이 아니라 상태 전이 때만 바뀌는 값이라 그 채널입니다. - **Ownership**: pane 존재·배치·zoom·크기는 Herdr 확인을 기다립니다. core가 앞서 나가는 것은 closing 표시와 선택 이동뿐이며 geometry는 건드리지 않습니다. tab 선택·focus는 기존 pending 모델 그대로입니다. - **Herdr contract**: 새 메서드나 필드는 없습니다. `session.snapshot`, `layout.export`, `pane.close`, `tab.close`, `agent.list`만 씁니다. `check-herdr-contract.sh --schema-only` pass(protocol 23). - **Failure path**: 확정 거절은 해당 operation만 `refused`로 끝내고 closing과 예약을 풉니다. transport/malformed는 `unknown`으로 남아 예약을 보존하고 pane 헤더 또는 tab strip 안내에 이유와 `Check status`를 보입니다. 모두 `push_diagnostic`으로 `core.jsonl`에 남습니다(`recent_closed.*`, `pane.operation.*`, `tab.move.*`, `remote.control.*`). - **High-frequency path**: resize는 같은 pane·같은 축이면 최신 signed delta로 합쳐져 대기열이 1로 유지됩니다. 250 ms tick은 실제 전이가 있을 때만 notify합니다. remote operation은 128개 상한. ## Evidence - **확인한 것**: - `bash scripts/verify-cargo.sh test`: 553 passed, 6 ignored. 한 번 실패한 `migrate_branch_refuses_before_overwriting_an_ignored_file`은 `Couldn't find key in agent`(commit 서명 agent)였고 단독 재실행에서 통과. - `cargo clippy --locked --workspace --all-targets -- -D warnings`, `cargo fmt --all --check`: clean. - `bash scripts/verify-swift.sh test`: 465 tests passed. - `node scripts/check-design-contract.mjs`, `gen-pen.mjs`/`check-pen.mjs`: pass, canvas 144 generated / 73 authored. - `zsh scripts/check-herdr-contract.sh --schema-only`: pass. - `check-core-bridge-structure.py`, `check-capability-readers-off-lock.sh`, `check-typed-contract-structure.py`, `scripts/tests` 38건, `check-no-workstation-identity.sh`, `check-no-attribution.py`, shortcut/right-panel/accessibility 게이트: pass. - 원본 diff가 추가한 Rust 함수 82개와 Swift 멤버 106개가 포팅 후 이름으로 모두 존재하는 것을 대조. - **확인하지 못한 것과 그 이유**: 실제 pinned Herdr와 native 앱으로 D-16 시나리오(active/background workspace close, 외부 닫기, 응답/이벤트 역전, disconnect)를 돌리지 않았습니다. 포팅 작업 규칙상 dev app을 띄우지 않았고, 운영 중인 Hide/Herdr에 격리 서버를 붙이는 절차를 이 PR 안에서 하지 않았습니다. 원래 증상을 재현한 로그(`core.jsonl` 2026-09-17 16:04)에 대한 재검증도 아직 없습니다. 머지 전 격리 Herdr에서 한 번은 확인이 필요합니다. - **화면 증거**: 없음. 위 이유로 native 캡처를 만들지 않았습니다. ## AI tooling - [ ] 사람이 직접 작성 - [ ] 일부를 AI 도구로 작성 - [x] 대부분을 AI 도구로 작성 **손으로 확인한 것**: 원본 브랜치의 각 hunk가 main의 어느 모듈로 갔는지, `main`이 이긴 자리(hide.pen의 ACV 보드, ARCHITECTURE의 coordinator 문장, `hide_herdr_client::ApiError`, CoreBridge inventory), `_confirmed` 미사용 인자 제거, DESIGN.md 문구 정정.
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
herdr-core/src/runtime.rs에 함께 있던 이벤트 처리, 프로젝트, 세션, 에이전트, 에디터, 터미널, snapshot delta와 테스트를 책임별 하위 모듈로 분리했습니다.runtime.rs는 23,000줄 이상에서 1,464줄의 조립 경계로 줄었고, 기존Runtime상태 권한과 단일 mutex 구조는 유지합니다.구조 검사가 새 하위 모듈까지 따라가도록 capability reader와 typed contract 게이트도 함께 갱신했습니다.
Related
Closes #75
Review focus
session,agents,projects사이의 책임 배치가 장기적으로 이해하기 쉬운지 봐주세요.herdr-core/src/runtime/events.rs,session.rs,terminal.rs는 기존 상태 전이와 외부 효과를 그대로 옮긴 핵심 경로입니다.runtime.rs를 조립 경계로 남기고 도메인 구현을 sibling module에 두는 현재 구성이 적절한가요?Risk surface
Evidence
-D warnings, release build를 통과했습니다. runtime 테스트 195개와 Swift 테스트 444개가 통과했습니다. 구조 회귀 테스트 6개와 capability reader, typed contract, Herdr pin/schema, design contract 및 worktree 관련 저장소 게이트가 통과했습니다. 리팩토링 전후 runtime 테스트 이름 195개와 event kind 78개가 동일함을 별도로 대조했습니다. 독립 읽기 전용 검토에서 actionable finding이 없었습니다.session_syncdeadline 테스트 2개가 실패했습니다. 같은 두 실패가 변경 전 조건에서도 재현되어 이번 runtime 모듈 분리의 통과 증거로 사용하지 않았습니다. 사용자-visible UI와 lifecycle 동작은 바뀌지 않아 네이티브 화면 QA는 수행하지 않았습니다.AI tooling
손으로 확인한 것:
origin/main...HEAD의 20개 파일, artifact 부재, 깨끗한 Git history, 테스트 이름과 event kind의 전후 대칭성, 최종 검증 로그를 직접 대조했습니다.