Skip to content

feat: browse, clone and create a project on any machine from Add a project - #2196

Merged
yansfil merged 26 commits into
mainfrom
device-add-project-browse
Nov 7, 2026
Merged

yansfil merged 26 commits into
mainfrom
device-add-project-browse

Conversation

@yansfil

@yansfil yansfil commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

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.

add project start (ko, dark)
Start view on a Linux device: the same three ways as on this Mac, each naming the machine.

add project list (ko, dark)
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

  • Please judge:
    • The footer wording when nothing is selected, 홈 폴더 전체는 추가할 수 없어요, which takes the place of the device chip there.
    • Whether a whole child name typed after ~/folder/ should choose that child. It does now, so ~/projects/app + Enter adds app, not projects. B7 alone would add the folder shown.
  • Known limitation: a finished clone is answered only while its full target path, folders above it included, still names the folder Git cloned into; otherwise it is answered 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.
  • Files to watch:
    • 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's project_target and clone_target now call the node's hide_host::browse::new_folder_target, so the two machines never judge one folder differently.
    • hided/src/server.rs spawn_node_ask - the failure path. Node asks run off the runtime mutex with a 15 s bound, and each refusal is logged as add_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.
  • Cost: there is no new resident work. Each folder list ask and each typed target check is one node round trip, debounced 150 ms. The node link already caps work at 4 running and 32 waiting, then answers busy. The web keeps at most 32 listings.

Evidence

  • Verified at head d9feea2:
    • CI verify 42403168456 passed with every check green, including the Windows and Linux Rust lanes and the desktop e2e.
    • Review fixes, tested locally with filtered runs:
      • The folder badge, new project and clone stay inside home through handles. hide_platform::fs::held plus its contract test on every system.
      • A linked worktree whose Git folder or repository is outside home gets no badge, and nothing there is read (it used to be a follow-up).
      • A FIFO at .git/HEAD or commondir answers at once, and the next listing still works.
      • The clone makes and holds its own target folder. A failed, cancelled or stalled clone empties it through its handle and never deletes by name.
      • A clone whose folder or parent was moved while Git ran is answered moved and registers nothing.
      • Barrier tests cover a link and a real folder planted at each step.
    • The hide-host browse, index and clone tests and the hide-core repository_clone tests pass. Clippy -D warnings is clean on hide-host, hide-node-link and hide-core. Web tsc and the i18n and coreError tests pass.
  • Earlier runs (past records, at b399636):
    • cargo nextest 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.
    • Clippy -D warnings, fmt and hakari passed.
    • The hide-platform contract test checks the macOS hidden flag and the Windows attrib +h.
    • The core tests covered device create, device clone and the remembered folder (add_project 3, repository_clone 6), plus node_migration 51 and persistence 33.
    • Web: typecheck, lint and 2675 vitest tests passed, including the dialog tests through a device. check-design-contract passed.
    • Gallery scene=add-project captured in ko and en, dark (the screenshots above).
  • Not verified:
    • Not run against a live device, whether Linux, Windows or WSL. Windows and Linux rest on CI's Rust lanes.
    • Locally, with this pane's 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-core worktree_control::tests::a_p* (2) fail on this Mac with "process 4294967294 could not be read". This branch does not touch that code.
    • hide_kit retirement_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
  • Base origin/main d7a85be (merged in 18ce7a0), head d9feea2.
  • CI verify 42403168456 at d9feea2: success.
  • Earlier: base f14c48a, head b399636 (local full suite, past record).
  • Contract: device-add-project PRD, scope D-01..D-08, D-16, D-18; B1-B19, B29 (folder list), B30, B31, B32 and B33 (start view and folder list).

@yansfil

yansfil commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

CI run 42372559603: every job passes except desktop e2e macos 2/2, where only e2e/terminal-links.spec.ts:148 fails. The same test fails on main's last two finished push runs (42369516392 at 32eedd3, 42370631622 at 8f621af), and this branch does not touch terminal links.
The first run's other failures were this branch's and are fixed in 88b4d2a: the gallery example path, and the desktop add-project spec now checks the offline device row.

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FAIL: 88b4d2a85743b4df7948c012b5fcf6d81e4b578c에서 병합 차단 결함 4건입니다.
docs/CODE_REVIEW.md의 serious 기준(버그 또는 경계 위반)을 적용했습니다.
아래는 소스 흐름으로 확인한 결함이며, 이번 리뷰에서 빌드나 실행 재현은 하지 않았습니다.

  1. 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를 추가하십시오.

  2. 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 기반 회귀 테스트가 필요합니다.

  3. 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 양쪽에 홈 안 링크 회귀 테스트를 넣으십시오.

  4. 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처럼 한정하십시오.
    권한 실패 후 복구·재시도와 지연 응답을 검증하십시오.

@yansfil

yansfil commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

리뷰 4건 반영했습니다. head 4c1724ff3, CI run 42381356693.

F1 폴더 배지가 홈 밖 Git 메타데이터를 읽음 (671f407bf)

  • 목록 배지는 hide-host/src/browse.rs의 badge가 홈 핸들로만 읽습니다.
  • .git 포인터(gitdir:), commondir, HEAD를 모두 홈 핸들로 읽습니다.
  • 포인터가 가리키는 Git 폴더나 저장소가 홈 밖이면, 그 위치를 경로 문자열만으로 판단하고 아무것도 읽지 않은 채 배지를 생략합니다.
  • 이번 PR에서 추가했던 hide_project::git::repository_at은 지웠습니다.
  • 회귀 테스트 a_linked_worktree_of_a_repository_outside_home_gets_no_badge: 홈 밖 원본 저장소의 linked worktree에는 배지가 없고, 홈 안 저장소의 worktree에는 브랜치가 붙습니다.

F2 검사와 생성·복제 사이에 홈 경계가 사라짐 (671f407bf)

  • 노드의 변경 연산이 홈 정책을 직접 집행합니다.
  • ProjectCreate(새 폴더)와 RepositoryClone은 부모를 홈 아래 cap-std 핸들로 열고, 다음 단계를 모두 그 핸들로 합니다.
    • mkdir, 이름 판단, 스테이징 폴더 이름, rename_no_replace, 정리.
  • Git은 hide_platform::fs::held::HeldFolder로 잡아 둔 폴더 안에서 실행합니다.
    • Unix: 자식 프로세스가 시작하자마자 잡아 둔 핸들로 fchdir합니다.
    • Windows: 홈부터 대상까지 모든 폴더를 FILE_SHARE_DELETE 없이 열어 이름 바꾸기와 교체를 막고, 그 상태에서 경로가 같은 폴더인지 확인합니다.
  • 이 기계와 기기가 모두 노드를 거치므로 둘 다 같은 규칙을 따릅니다.
  • 회귀 테스트:
    • project::tests::a_parent_swapped_for_a_link_out_of_home_after_the_check_makes_nothing_outside
    • clone::a_parent_swapped_for_a_link_out_of_home_after_the_check_clones_nothing_outside
    • 둘 다 new_folder_target 검사 뒤 부모를 홈 밖 링크로 바꾸고, 생성·복제가 거절되며 홈 밖이 비어 있음을 확인합니다.
  • hide-platform 계약 테스트 a_program_started_in_a_held_folder_runs_in_the_folder_that_was_held는 macOS, Linux, Windows CI에서 통과했습니다.
  • 코어의 clone 테스트는 노드의 홈을 임시 폴더로 바꿨습니다.

F3 홈 안 링크 경로 입력 시 추가가 꺼짐 (bb1cafd45)

  • 목록이 입력칸을 따르는지는 이번 요청의 identity(shown.request)나 응답 라벨로 판단합니다.
  • 응답이 오면 입력칸이 실제 라벨을 보여 주고, 뒤에 입력한 부분은 그대로 둡니다. 예: ~/inward/we → ~/work/we.
  • 입력과 Tab 두 경우를 테스트했습니다.

F4 입력한 폴더의 읽기 실패와 재시도가 숨겨짐 (bb1cafd45)

  • 입력으로 연 폴더도 불러오는 중, 실패와 다시 시도를 보여 줍니다.
  • 목록을 그대로 두는 경우는 명세가 정한 없는 폴더(not_found, not_a_directory, invalid_path)뿐입니다.
  • 실패한 경로를 다시 입력하면 다시 요청하고, 입력칸이 떠난 요청의 늦은 응답은 무시합니다.
  • 테스트는 실패, 재시도로 회복, 늦은 응답을 다룹니다.

N1 ko/en 갤러리 캡처(dark):
add project start (en, dark)
add project list (en, dark)

CI

  • 실패는 desktop e2e macos 2/2의 e2e/terminal-links.spec.ts:148 하나입니다.
  • 같은 테스트가 main의 최근 push run 두 번(42379582914, 42377545266)에서도 실패합니다.
  • 나머지 작업은 모두 통과했습니다(Windows/Linux Rust lane 포함).

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FAIL: 재검토 범위 88b4d2a85..4c1724ff31e93ae24bc4a88f88482236e7d43eec.
기존 F1/F3/F4는 닫혔고 F2의 원래 부모 교체 시나리오도 막혔습니다.
그러나 F2의 홈 경계에는 아래 잔여 경로가 있고, F1 수정에서 새 blocking-read 문제가 생겼습니다.
docs/CODE_REVIEW.md 기준 모두 serious입니다.

  1. 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 링크를 삽입하는 회귀 테스트가 필요합니다.
    새 부모 교체 테스트는 변경 연산에 진입하기 전까지만 바꿔 이 경로를 덮지 못합니다.

  2. serious / Correctness, ownership / F1 수정의 새 문제: HEAD FIFO가 목록 worker를 영구 점유합니다.
    hide-host/src/browse.rs:140-146
    홈 안 repo/.git가 디렉터리이고 repo/.git/HEAD가 writer 없는 FIFO이면, 새 read_git_file은 파일 종류 검사 없이 blocking home.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 yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yansfil

yansfil commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

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).

hide-host/src/clone.rs: no staging name, no publish rename, no delete by name

  • The run makes the target folder itself through the held parent's handle (create_dir, which fails on anything at the name, a link included, as TargetExists), opens it, and accepts it only when the opened handle is the entry the name holds as itself and it is empty; otherwise it fails and touches nothing there.
  • That folder is held (HeldFolder) and Git runs with its cwd in it, cloning into .. A finished clone is done: nothing is renamed afterwards, so there is no publication step to race.
  • A failed, cancelled or stalled clone (and an unwinding one, through a guard declared before the hold so the hold is released first on Windows) empties the folder through its own handle, releases it, and then removes the name with remove_dir, which refuses a non-empty folder and a link. A folder anyone else put at the name is never deleted; never a recursive delete by name.
  • While Git runs the folder holds a partial repository under the target's name, and a daemon killed mid-clone can leave it; docs/UI_BEHAVIOR.md and docs/ARCHITECTURE.md say so.

Barrier test something_put_at_the_target_name_mid_clone_is_never_written_through_or_deleted puts both a link out of home and an unrelated real folder with a file at the target name at each point the run passes: right after the folder is made (before it is opened), after it is held (the run's folder moved aside, both a good and a failing source), and after a failed clone's folder is emptied, right before the name is removed. In every case nothing is written outside home and what was put there is unchanged; a good clone lands in the held folder, and a failed one's own folder is emptied. Changing the final remove_dir to remove_dir_all makes the test fail, so it covers the cleanup boundary.

The held-folder contract tests in hide-platform/tests/it/fs.rs are unchanged.

Local: hide-host clone and browse tests (18), protocol and schema tests in hide-node-link and hided (18) pass; clippy -D warnings clean on hide-host. Full lanes on CI.

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yansfil

yansfil commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Round 4's finding is fixed in the accepted shape (code cbc34de, docs d9feea2); identity is not carried through registration.

  • Check after Git, while still held (hide-host/src/clone.rs): once Git succeeds the run compares the held folder's file id with identity::file_id(target), which resolves the full path from the root, so a moved or replaced parent counts as well as the target itself. Different, gone or unreadable answers the new CloneFailure::Moved(target) (code moved).
  • Nothing is removed on moved: the clone's failure cleanup is disarmed once Git has finished, so the clone (wherever it was moved) and whatever took its name are left untouched. A real Git failure, cancel or stall keeps the cleanup from round 3.
  • No registration: the core treats moved like any failure, so CreateWorkspace is never sent. The web words it in four languages ("moved or replaced while it was cloning, so it was not added; add it with Browse folder").
  • Tests:
    • In the barrier test, Held + good with a real folder and with a link now expect Moved(target). mine.txt and the link are kept, and the moved clone keeps .git/HEAD and its checked-out readme.txt.
    • New a_parent_moved_and_replaced_mid_clone_is_answered_as_moved moves projects away and puts a new projects/origin/mine.txt in its place during the clone. The answer is moved, the clone is complete under projects.moved/origin, and the replacement is unchanged.
    • New core test a_clone_answered_as_moved_registers_nothing settles a clone as moved. The phase is failed, the failure is moved, and there is no workspace.create.requested.
  • Docs: ARCHITECTURE and the clone_repository doc now say a non-empty folder put in its place keeps its contents and an empty one can be removed. They also describe the moved check and state that it is not an atomic handoff. The PR body's Review lists the window between that check and registration as a known limitation, the same as a same-user rename right after registration.

Local: hide-host and hide-core clone tests (21) pass; clippy -D warnings clean on hide-host, hide-node-link and hide-core; web tsc and i18n/coreError tests pass.

@yansfil
yansfil enabled auto-merge November 7, 2026 19:29
@yansfil
yansfil added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit f315e4d Nov 7, 2026
96 checks passed
@yansfil
yansfil deleted the device-add-project-browse branch November 7, 2026 19:36
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 9, 2026
…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.

![import list (ko,
dark)](https://github.com/yansfil/pr-assets/blob/main/hide/device-add-project-import/243abc9/import-ko-dark.png?raw=true)
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>

![import list (en,
light)](https://github.com/yansfil/pr-assets/blob/main/hide/device-add-project-import/243abc9/import-en-light.png?raw=true)
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>
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