Repository navigation
feat: browse, clone and create a project on any machine from Add a project - #2196
Conversation
…ach machine's node
…and the browser-tab e2e
…e node ask reasons
…typed folder is shown
|
CI run 42372559603: every job passes except |
yansfil
left a comment
There was a problem hiding this comment.
FAIL: 88b4d2a85743b4df7948c012b5fcf6d81e4b578c에서 병합 차단 결함 4건입니다.
docs/CODE_REVIEW.md의 serious 기준(버그 또는 경계 위반)을 적용했습니다.
아래는 소스 흐름으로 확인한 결함이며, 이번 리뷰에서 빌드나 실행 재현은 하지 않았습니다.
-
serious / Correctness, boundary: 폴더 배지가 홈 밖 Git 메타데이터를 읽습니다.
hide-host/src/browse.rs:49
홈 안에 linked worktree가 있고 원본 저장소가 홈 밖에 있으면, 목록의 자식 경로는 홈 검사를 통과하지만repository_at은.git파일의gitdir:를 홈 밖으로 따라갑니다.
hide-project/src/lib.rs:497-530은 외부 HEAD의 metadata, commondir 및 reciprocal gitdir를 읽고,repository.branch()는 외부 HEAD의 브랜치를 반환합니다.
정상적인 Git linked worktree만으로 발생하며 경합도 필요 없습니다.
수정: 이 목록에서 쓰는 Git 탐색에 홈 경계를 전달하고, gitdir/commondir/HEAD를 포함한 모든 읽기를 경계 안의 핸들로 수행하십시오.
경계를 벗어나는 저장소는 외부 파일을 읽기 전에 배지를 생략해야 합니다.
홈 밖 원본 저장소와 홈 안 linked worktree fixture를 추가하십시오. -
serious / Correctness, boundary: 기기 경로 검사와 생성·복제 사이에 홈 경계가 사라집니다.
hide-core/src/checkout_owner/open.rs:327,
hide-core/src/runtime/clone.rs:308
NewFolderTarget가 반환한 것은 경로 문자열뿐입니다.
검사 후~/projects를 홈 밖 폴더로 향하는 링크로 바꾸면 뒤의ProjectCreate/RepositoryClone은 이를 따라갑니다.
실제 handler는 절대경로 여부만 검사하고(hide-host/src/serve.rs:1156,1201), 생성은fs::create_dir와 git init(project.rs:90,110), 복제는 문자열 staging 경로와 cwd(clone.rs:63-81)로 쓰므로 홈 밖에 부작용이 생깁니다.
생성 결과를 나중에 비교해 거절해도 이미 만든 폴더는 되돌리지 못합니다.
수정: 기기의 실제 변경 연산이 홈 정책을 소유하고 검사한 부모의 핸들/identity를 mkdir, Git 실행, rename, cleanup까지 유지하도록 하십시오.
단순히 canonicalize를 한 번 더 하는 것으로 경합이 없어지지는 않습니다.
검사와 변경 사이 부모를 교체하는 barrier 기반 회귀 테스트가 필요합니다. -
serious / Correctness: 유효한 홈 안 링크 경로를 입력하면 추가가 계속 비활성화됩니다.
web/src/FolderBrowser.tsx:103,
web/src/FolderBrowser.tsx:155
~/inward -> ~/work에서~/inward/를 입력하거나 Tab으로 들어가면 node는 정상적으로label: "~/work"를 반환합니다(hide-host/src/browse.rs:378의 기존 테스트도 이 응답을 기대).
그러나~/입력은 kind=folder라 입력 정규화가 생략되고,typedRequest !== listing.label이 계속 참이므로 Add/Use this location이 꺼집니다.
suffix 필터도 같은 비교 때문에 적용되지 않습니다.
수정: 요청 identity와 성공 응답으로 pending을 판단하고, folder 입력의 suffix를 보존하면서 canonical label을 반영하십시오.
입력과 Tab 양쪽에 홈 안 링크 회귀 테스트를 넣으십시오. -
serious / Correctness, failure path: 입력으로 연 폴더의 읽기 실패와 재시도가 숨겨집니다.
web/src/FolderBrowser.tsx:134,
web/src/FolderBrowser.tsx:181
읽을 권한이 없는~/private/를 입력해 unreadable 응답을 받으면 typed 요청을 loading/failed에서 제외하므로 이전 목록만 남습니다.
hint도 unreadable/busy를 처리하지 않아 이유와 다시 시도가 없고 Add는 꺼집니다.
같은 경로의 재입력은 typedRequest 의존값이 같아 재요청도 하지 않습니다.
수정: typed 요청도 명시적인 loading/failed/retry 상태로 처리하고, 기존 목록을 유지하는 예외는 명세의 not_found처럼 한정하십시오.
권한 실패 후 복구·재시도와 지연 응답을 검증하십시오.
|
리뷰 4건 반영했습니다. head F1 폴더 배지가 홈 밖 Git 메타데이터를 읽음 (
F2 검사와 생성·복제 사이에 홈 경계가 사라짐 (
F3 홈 안 링크 경로 입력 시 추가가 꺼짐 (
F4 입력한 폴더의 읽기 실패와 재시도가 숨겨짐 (
CI
|
yansfil
left a comment
There was a problem hiding this comment.
FAIL: 재검토 범위 88b4d2a85..4c1724ff31e93ae24bc4a88f88482236e7d43eec.
기존 F1/F3/F4는 닫혔고 F2의 원래 부모 교체 시나리오도 막혔습니다.
그러나 F2의 홈 경계에는 아래 잔여 경로가 있고, F1 수정에서 새 blocking-read 문제가 생겼습니다.
docs/CODE_REVIEW.md 기준 모두 serious입니다.
-
serious / Correctness, boundary / F2 잔여: Git이 staging 이름의 외부 링크를 따라갑니다.
hide-host/src/clone.rs:85-90
staging.remove()뒤 Git이 목적지를 열기 전에.<name>.hide-clone-<pid>를 홈 밖 빈 폴더로 향하는 링크로 만들면, Git은 부모의 고정된 cwd에서 그 링크를 따라 외부에 복제합니다.
고정된 부모 핸들은 그 안의 목적지 이름까지 고정하지 않습니다.
특히 그 사이remote_in이 설정 조회용 Git을 실행할 수도 있습니다.
마지막 handle-relative rename은 이미 발생한 외부 쓰기를 막지 못합니다.
근거: 임시 fixture에서 부모 fd를 열고 자식에fchdir를 적용한 상태로, 외부 디렉터리를 가리키는 staging 링크에git clone --progress -- file://... <stage>를 실행했습니다.
Git exit=0이고 외부 폴더에.git가 생겼습니다.
이는 Git 동작의 국소 재현이며 제품 전체 실행은 아닙니다.
수정: staging을 배타적으로 만들고 그 디렉터리 자체를 핸들로 고정해 Git이 그 안의.에 복제하도록 하십시오.
게시·정리는 같은 staging identity를 대상으로 해야 합니다.
삭제와 Git 실행 사이 staging 링크를 삽입하는 회귀 테스트가 필요합니다.
새 부모 교체 테스트는 변경 연산에 진입하기 전까지만 바꿔 이 경로를 덮지 못합니다. -
serious / Correctness, ownership / F1 수정의 새 문제: HEAD FIFO가 목록 worker를 영구 점유합니다.
hide-host/src/browse.rs:140-146
홈 안repo/.git가 디렉터리이고repo/.git/HEAD가 writer 없는 FIFO이면, 새read_git_file은 파일 종류 검사 없이 blockinghome.open(path)에 들어갑니다.
take(4096)는 바이트 상한이므로 open/read 대기를 제한하지 않습니다.
기존 reader는 HEAD에require_regular_file을 적용했습니다.
새 코드는 중단 신호도 확인하지 않아 호출자 timeout 뒤에도 worker가 남고, 반복하면 노드의 machine worker 4개를 점유할 수 있습니다.
linked-worktree의commondir도 같은 reader를 씁니다.
근거: 설치된 cap-std 4.0.3 소스에서 기본 read-only open이 nonblocking/type guard를 제공하지 않는 것을 확인했고, 동일한 no-follow read-only openat의 FIFO 대기를 0.5초 제한 OS 실험으로 확인했습니다.
실험 자식은 종료·회수했습니다. 제품 전체 실행은 아닙니다.
수정: 홈 경계를 유지하면서 특수 파일의 open 자체가 막히지 않게 열고, 열린 핸들이 일반 파일인지 확인한 뒤 읽으십시오.
단순 사전 stat만 추가하면 종류 교체 경합이 남습니다.
FIFO HEAD/commondir 요청이 즉시 끝나고 뒤의 정상 목록도 처리되는 회귀 테스트가 필요합니다.
F1의 외부 linked-worktree metadata 읽기는 browse.rs:81-148의 bounded handle 읽기와 텍스트 경계 검사로 닫혔습니다.
F3는 FolderBrowser.tsx:105-107,123,168의 label 정규화·suffix 보존·request 대응으로 닫혔습니다.
F4는 FolderBrowser.tsx:124-150,295의 typed loading/failed/retry 및 이전 목록 복구로 닫혔습니다.
관련 새 테스트 내용도 검토했습니다.
이번 재검토에서는 cargo/빌드/제품 테스트/CI 재실행을 하지 않았고 소스를 수정하거나 커밋하지 않았습니다.
검증 범위는 수정 diff와 위 두 국소 Git/OS 실험입니다.
yansfil
left a comment
There was a problem hiding this comment.
FAIL at 80fa605d8708325509bf2e8165f046291c016f6b: one serious finding remains in the staging-folder fix.
Serious | correctness, ownership | hide-host/src/clone.rs:195-205, 312-313: the identity check is separate from publication and cleanup.
After still_ours() returns true, another process can rename the staging folder away and move an unrelated directory into its name before rename_no_replace runs. The rename checks only that the destination is absent; it does not check the source identity. The operation then returns success for the unrelated directory, leaving the actual clone unpublished. The same check-then-use sequence in Drop can recursively delete the replacement directory after an error/cancellation. Dropping held before the check also removes the Windows protection.
The exact macOS publication primitive was checked with an isolated fixture: identity check passed, source name was replaced, and renameatx_np(..., RENAME_EXCL) returned 0 with the unrelated folder at the target. This is an OS-level reproduction, not an end-to-end product test. The new regression swaps only at Cleared or Held; neither exercises the interval after the final identity check.
Suggested fix: retain the original staging handle as the cleanup authority and avoid recursive deletion through a mutable name. Use an identity-preserving publication mechanism, or capture the named source into an exclusively owned location and validate the captured identity before declaring success; a source mismatch must never register a replacement or delete its contents. Add deterministic barriers at the publication and cleanup boundaries, covering replacement by an unrelated real directory as well as a symlink.
Previous findings: the original outside-link clone write is closed by exclusively creating staging, holding it, and cloning into . (121-130). FIFO badge reads are closed by browse.rs:143 using list::open_regular_file (list.rs:203-220: nonblocking open plus handle metadata validation), with regression coverage for HEAD and commondir (browse.rs:496). The remaining finding above concerns the promised identity-bound publication/cleanup, not the now-fixed Git destination.
No source changes, commits, Cargo commands, builds, full suites, or installed-app interactions. Local evidence is source review plus the small filesystem primitive probe. CI run 42385857214 at this SHA is queued on recheck; no claim that the full gate passed. The previously scoped-out terminal-links failure was not investigated.
|
Round 3's serious finding is fixed in a572e8f by removing the window rather than adding a check (docs in 2757cd3; main merged in 18ce7a0, with the node protocol moved to 80 since main took 79 for the clipboard line).
Barrier test The held-folder contract tests in Local: hide-host clone and browse tests (18), protocol and schema tests in hide-node-link and hided (18) pass; clippy |
yansfil
left a comment
There was a problem hiding this comment.
FAIL at 18ce7a08c9bc892844a50c268f7b09c80c4826d1: the round-3 finding is partly fixed, but the wrong-project success path remains.
Serious | correctness / result ownership | hide-host/src/clone.rs:149-152.
On Unix, another process can move the held target directory to origin.moved and put an unrelated real directory at origin while Git runs. Git correctly clones into the held origin.moved, but clone_with unconditionally returns Ok(target), where target still names the unrelated directory. hide-core/src/runtime/clone.rs:240-262 then sends that path through CreateWorkspace. A normal unrelated directory under home is a valid project, so the UI registers it as the successful clone. Removing the publication rename prevents a replacement from being moved by the clone, but does not preserve the identity of the success result passed to registration.
The added barrier test already constructs this exact interleaving: clone.rs:600 expects (Step::Held, &good, true), 623-632 moves the original and plants an unrelated folder with mine.txt, and 637,653,658 simultaneously assert success, the unrelated target, and the actual clone in origin.moved. It checks preservation of contents, but explicitly accepts the wrong success path. No additional build is needed to establish this code path.
Suggested fix: a clone must not return/register the original path as successful once that path no longer names its held directory. Preserve the cloned directory's identity in the completion/registration handoff and validate it on the owning device; if the target was replaced, report that the clone moved and leave the replacement untouched. Change the Held+good barrier to assert that no success referring to the replacement is delivered, and cover the core registration outcome. A final name check alone should not be described as an atomic identity handoff.
Closed portion: the old check-then-recursive-delete of the staging name is gone. remove_partial empties the original directory through its handle (260-274) and only calls nonrecursive remove_dir(name) afterwards (277). The Windows hold is declared after Partial, so it drops before cleanup on failure/unwind; the directory handle drops before the final rmdir (275). A nonempty replacement is preserved. The Emptied+Folder barrier would catch reintroducing recursive removal at line 277; this is source inspection, not a locally executed mutation test.
The new partial-target visibility/crash leftovers are documented (docs/UI_BEHAVIOR.md:1807, docs/ARCHITECTURE.md:3383-3384). Protocol is 80 (hide-node-link/src/protocol.rs:340). CI 42394880673 passed at this exact SHA. Review scope is a572e8f/2757cd32c and the relevant completion path. No commits, tracked edits, Cargo/build/test runs, installed-app interaction, or terminal-links investigation.
|
Round 4's finding is fixed in the accepted shape (code cbc34de, docs d9feea2); identity is not carried through registration.
Local: hide-host and hide-core clone tests (21) pass; clippy |
…Add a project (with-hide#2204) Related: with-hide#2196 (stacked on it; this is the second layer of "기기에서 프로젝트 추가") ## Summary Adding a project you already work on meant finding its folder by hand, on this Mac and even more on a device. Now Add a project lists `가져올 수 있는 프로젝트` under the other ways: the folders your agents worked in on the chosen machine, and the projects Paseo and Herdr keep there. Each row carries a chip per source, and `추가` or `모두 추가 (N)` adds them while the dialog stays open; a refused row stays with its reason. Hide only reads those files, so Paseo and Herdr keep working beside it, and a file it cannot read just drops out and goes to the log.  Start view on a Linux device: one repository found by two agents, one kept by Paseo and Herdr, a long path cut with an ellipsis. ## Review - **판단해 주세요**: - `모두 추가` sends one `create_workspace` per row, one after another, not one event. Each add carries a `request_id` and gets its own receipt in the core, beside `hide <path>`'s and under the same bound of 32, published as `status.project_adds` (pending, added, or refused with kind and message) and cleared by no later event; every receipt waiting on a machine and path is settled with that registration's outcome, so another window's add answers no row (B25). - Paseo's `updatedAt` is its record's time, not its last use, so a Paseo-only project untouched for 30 days drops out unless an agent worked there too. - Herdr keeps no time per workspace; every Herdr row is as recent as `session.json`. - Antigravity was not in the session catalog's walk; `worked_folders` reads agy's index for it. The session archive itself is unchanged. - **조심해서 볼 파일**: - `hide-host/src/importable.rs` - access boundary: every folder goes through `register::judge` (unconfirmed), so only roots under home come back; reads are capped (Paseo 4 MiB, Herdr 4 MiB, 400 folders judged, 20 answered), opened only as regular files without waiting (`hide_platform::fs::open_regular`, also now in `herdr_save::fetch`), and the search ends by a 20 s deadline below hided's 30 s bound. - `hide-core/src/runtime/project_open.rs` `await_add`/`settle_project_open` and the `status.project_adds` wire field - snapshot wire and result ownership: add receipts share the `hide <path>` receipt queue (bound 32) but bring nothing forward; every `create_workspace` outcome passes `settle_project_open`. - `hide-session/src/catalog.rs` - `project_sessions` and `worked_folders` share one walk per agent (`agent_files`); `worked_folders` reads each agent under its own budget of `SESSION_DISCOVERY_LIMIT` entries, refuses a store it cannot list, past its budget, or a session file it cannot read for that agent only, and prunes the header cache per store that listed whole. A header that could not be read is told apart from one refused by rule (`HeaderError`), and only the latter is cached. - `hided/src/server.rs` `node_ask` - failure path: runs off `Mutex<Runtime>` on a blocking task, 30 s bound, each dropped source logged as `add_project.import_source_dropped`. - `web/src/ImportableProjects.tsx` - the one-at-a-time queue and how an answer is matched to its row. - `hide-host/src/herdr_save.rs` says Bundle 4 PR B deletes it with Herdr; this PR reads Herdr saves through it, as the existing Herdr import does. - **비용 검토**: no resident work. One node call per dialog opening and per machine chosen: a walk of at most 10,000 session entries (the archive's cap, header cache reused, only files changed in 30 days opened), two capped file reads, at most 400 folder judgements. ## Evidence - **확인한 것**: - `hide-host` importable tests (4) on a real temporary home: a repository worked from a linked worktree and a subfolder is one row with both agents; a folder Paseo and Herdr both keep is one row with both; home, outside home, gone, archived, older than 30 days and registered are left out; every file read is byte-equal afterwards (B26); an unreadable Paseo registry and a newer Herdr format drop out alone (B27); 25 projects answer the newest 20 (B22); a FIFO at Paseo's registry and at Herdr's session drops each at once while the agents' project still answers, three times over on a thread with a 10 s bound, and a passed deadline drops every source as late. - `hide-session` tests: each agent folder once, an old session left out, an unreadable OpenCode database refused alone; a Claude store that cannot be listed and a Codex FIFO refused beside Codex's folder; a Claude store past its 10,000-entry budget beside a small Codex store still finds Codex's folder; a second search after a Codex file is replaced keeps no header of it while Claude's store never lists. - Core: two adds of one folder both get its refusal; a refused and an added receipt stay on the wire after an unrelated event clears `last_error`. hided: a `path_refused` carries the add's request id. - Web dialog tests (4 new, 14 in the file): the ask on opening, nothing until the answer (B29), chips and registered rows left out (B20, B21), nothing for an empty or failed answer, one add then add all one at a time, a refused row keeping its reason and sent once more on a second press, the dialog open throughout (B24, B25); with app pending, another window's registration and another add's refusal answer nothing, app's own refusal stays on app and site is sent next with nothing on it. - B28 is the catalog's existing rule, tested by `workspace::tests::a_space_occupying_a_registered_directory_does_not_duplicate_it`: a later Herdr workspace in a registered folder joins that project. - Web typecheck, lint, the 4 related vitest files (83 tests), `check-design-contract`; Gallery `scene=add-project` captured in ko/dark, en/light, ja/dark, zh-CN/dark. - **확인하지 못한 것**: - Not run against a live device (Linux, Windows, WSL) or a candidate app; Windows and Linux rest on CI's Rust lanes. - Not run against a real Paseo install; its file shape is read from getpaseo/paseo `docs/data-model.md` and `workspace-registry.ts`. <details><summary>추가 증거</summary>  English, light. </details> ## Breaking change The node protocol goes from 80 (with-hide#2196) to 82; 81 is held by an open change (`fix/new-build-reaches-panes`). A device helper before 82 is refused at Hello and reinstalled, as on every protocol step. <details><summary>Verification record</summary> - Base main (after with-hide#2196 merged as f315e4d); head c661d05, verify 42410062492 green; review rounds 1-4 closed. - Contract: `device-add-project` PRD, D-09..D-14; B20-B28, and the import parts of B29, B32, B33. </details>


Summary
On another machine (a device, a browser tab, or the core's machine seen from a node's window), Add a project used to give you only a
~/path field, and Clone from URL and Create new project worked only on the core's machine.Now every machine gets the same first view: Browse folder, Clone from URL and Create new project.
On this Mac, Browse folder still opens the system folder window.
Anywhere else it opens the dialog's own folder list of that machine's home, read by that machine's node.
Clone and Create now run on the chosen device, and the list opens where it last was on each machine.
This is the first layer of "기기에서 프로젝트 추가". The importable-projects list (D-09..D-14, B20-B28) is the next PR, stacked on this one.
Start view on a Linux device: the same three ways as on this Mac, each naming the machine.
Folder list: a repository shows its branch, a folder shows how many repositories it holds, a project already added is dimmed, and home itself cannot be added.
Review
홈 폴더 전체는 추가할 수 없어요, which takes the place of the device chip there.~/folder/should choose that child. It does now, so~/projects/app+ Enter adds app, not projects. B7 alone would add the folder shown.moved, the clone stays where it went, and nothing is registered. That check is not an atomic handoff: a same-user rename between it and the registration remains possible, and it is no different from a rename right after the folder is registered.hide-host/src/browse.rs- the boundary. It opens a folder under home through a cap_std handle and follows an absolute link back into home only through canonical + strip_prefix. A link out of home is no row.hided/src/boundary.rs- this machine'sproject_targetandclone_targetnow call the node'shide_host::browse::new_folder_target, so the two machines never judge one folder differently.hided/src/server.rsspawn_node_ask- the failure path. Node asks run off the runtime mutex with a 15 s bound, and each refusal is logged asadd_project.node_refused.hide-core/src/runtime/device_catalog.rs,clone.rs- device create and clone run on worker threads, so no node call happens under the lock.hide-core/src/node_migration.rs,reown.rs- the new per-machine folder state is registered for a core move.busy. The web keeps at most 32 listings.Evidence
verify42403168456 passed with every check green, including the Windows and Linux Rust lanes and the desktop e2e.hide_platform::fs::heldplus its contract test on every system..git/HEADorcommondiranswers at once, and the next listing still works.movedand registers nothing.-D warningsis clean on hide-host, hide-node-link and hide-core. Webtscand the i18n and coreError tests pass.cargonextest across the workspace with Hide's pane variables unset: hided 750/750, and hide-kit plus hide-host 491/491. The full-suite run passed 7424 tests, apart from the cases listed under Not verified.-D warnings, fmt and hakari passed.hide-platformcontract test checks the macOS hidden flag and the Windowsattrib +h.check-design-contractpassed.scene=add-projectcaptured in ko and en, dark (the screenshots above).HIDE_*set, 103 hide-kit tests and 2 hide-host kit tests read the operator's state folder and failed. They all pass with those variables unset.hide-coreworktree_control::tests::a_p*(2) fail on this Mac with "process 4294967294 could not be read". This branch does not touch that code.hide_kitretirement_stops_the_fixture_daemon_...hung at 0% CPU and was stopped. This branch does not touch hide-kit.Breaking change
The node protocol goes from 79 (the clipboard line, now on main) to 80. A device helper before 80 is refused at Hello and reinstalled, as on every protocol step.
Verification record
origin/maind7a85be (merged in 18ce7a0), head d9feea2.verify42403168456 at d9feea2: success.device-add-projectPRD, scope D-01..D-08, D-16, D-18; B1-B19, B29 (folder list), B30, B31, B32 and B33 (start view and folder list).