Skip to content

Preflight worktree deletion before closing panes - #367

Merged
yansfil merged 16 commits into
mainfrom
fix/worktree-delete-preflight
Oct 4, 2026
Merged

yansfil merged 16 commits into
mainfrom
fix/worktree-delete-preflight

Conversation

@yansfil

@yansfil yansfil commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Related: #233, #361, #362, #359.

Summary

  • Check deletion before pane closure; name the locked worktree, literal Git reason and manual unlock action.
  • Discard names every measured ignored repository; an unavailable scan blocks deletion with a recovery action.
  • Changed lock, scan or repository facts retire Discard consent, including an A-to-B-to-A return.
  • Notify existing renderer connections after accepting refreshed facts and releasing the runtime lock.

Locked worktree names its Git reason and unlock action

Isolated capture at 790c7fdd; later cb546e43 dialog captures were inspected locally.

Review

  • 판단해 주세요: Review the lock/scan recovery copy and repository-name legibility in the existing dialog.
  • 조심해서 볼 파일: hide-host/src/worktrees.rs - bounded enumeration and final guarded removal.
  • 조심해서 볼 파일: herdr-core/src/runtime/projects.rs - preflight precedes pane closure, outside Runtime.
  • 조심해서 볼 파일: herdr-core/src/session_sync/coordinator.rs - notifications after accepted facts or loading completion.
  • 조심해서 볼 파일: web/src/WorkspaceDialogs.tsx - changed facts permanently retire earlier Discard consent.
  • 비용 검토: Each linked worktree has its own 2M-step/30-second/1,024-name cap; project cost scales with their count.

Evidence

  • 확인한 것: Prior cb546e43 local checks, CI, independent review and four isolated browser deletion flows passed.
  • 확인한 것: Current-main cd0cde23 preservation review is clear; original fixes and prior closed findings are retained.
  • 확인하지 못한 것: Current cd0cde23 verify is pending; design contract and exact-candidate CLI build passed.
  • 확인하지 못한 것: Aside/u0 reconnected, but its first current QA failed at screenshot routing; full acceptance is pending.
  • 확인하지 못한 것: Next: correct capture routing and finish unchanged UI assertions and CI; packaged native QA is unrun.
  • 확인하지 못한 것: Original 790c7fdd caller test passed unexpectedly; automatic GitHub publication can mask omission.
  • 확인하지 못한 것: An earlier full Rust run had two unrelated install-kit watcher failures; original records are retained.
  • 확인하지 못한 것: A change after preflight can still fail the final removal guard; Git and pane closure are not atomic.
추가 증거

At cb546e43, Rust fmt/clippy, CLI build, web/desktop typecheck, lint, tests and builds passed.
Web 868 tests, desktop 94 tests with 3 platform skips, coordination 48 unit and 35 E2E tests passed.
Four isolated browser deletion flows passed, including same-renderer lock refresh and A-to-B-to-A consent reset.
This caller coverage is separate from required Aside acceptance.
Workerless observer tests passed 3/3; omitting only the notifier failed both positive cases while the negative case passed.
Restoring the original notification passed 3/3; the formatting-only final source also passed 3/3.
At 790c7fdd, host worktree integration 9/9 and core worktree behavior 95/95 passed.
The same-socket E2E provides caller coverage; the observer mutation proves the notification boundary.

Prior verify and design contract passed at cb546e43, including Linux/macOS web E2E, desktop E2E and Windows checks.
Current-main cd0cde23 merges cab8625f; its only incoming delta from b8b2c1f8 is the already-merged daemon test fixture.
All 27 issue-file blobs and strict protocol 16 are unchanged, independently reviewed.
A fresh canonical CLI build passed in 92.12595 seconds; its exact candidate hided and all 44 runtime/web artifact hashes are pinned for UI QA.
Current verify is pending; design contract passed.
The superseded b8b2c1f8 verify run was cancelled after the ordinary source-preserving main merge; its partial results are retained.
Independent exact-head guide review and actual remote PR cost-wording review close the P3 finding; prior runtime/integration review remains clear.
No broad local Rust rerun or web rebuild was performed; the sole web delta is test-only diagnostics and production build inputs are unchanged.

The implementation reuses the existing off-lock worktree reader and single removal slot.
Each linked worktree in an accepted project read receives its own ignored-repository scan, capped at 2,000,000 steps, 30 seconds and 1,024 names.
Total scan cost scales with the linked-worktree count, with no shared project-wide step, time or name cap.
An unavailable or capped scan refuses deletion.
Accepted changed facts or loading completion publish one coalesced notification after releasing Runtime; unchanged and stale answers stay silent.
No new permanent timer or input-path I/O is added.
Existing project counts, aggregate answer bytes and coordinator mailbox have no new fixed cap; a generic in-flight read may finish after its driver ends.

Earlier unavailable Aside observations remain historical NOT_RUN records.
Local Aside/u0 is now reachable; the first current attempt stopped when the screenshot path escaped its sandbox, despite a zero CLI exit.
The owned tab and all seven observed private process identities were released; the original failure log is retained.
Corrected capture transport requires explicit UI PASS, tab RELEASE and five actual PNG captures; no assertions or deadlines change.
Matching helper/core protocol 16 is preserved; later shared protocol changes require their owning integration review.
Original failures and causal mutation evidence remain retained locally.

Breaking change

Host helper protocol 16 requires matching client/helper updates.
An older helper refuses deletion before pane closure.

@yansfil
yansfil marked this pull request as ready for review October 4, 2026 03:44
@yansfil

yansfil commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

구현 범위 완료 및 ready 전환, head cd0cde23 전체 푸시·독립 소스 리뷰·로컬 CLI 빌드 통과; 필수 verify는 Linux E2E 6/6만 진행 중이고 현재 실패 없음; 남은 Aside QA는 캡처 전달 문제 및 최종 삭제 완료 대기 실패로 미완료(원본 보존), 추가 QA·push 없이 새 리드가 verify 녹색 확인 후 머지합니다.

@yansfil
yansfil merged commit ed0992e into main Oct 4, 2026
21 checks passed
@yansfil
yansfil deleted the fix/worktree-delete-preflight branch October 4, 2026 04:41
yansfil added a commit that referenced this pull request Oct 4, 2026
## Summary

Every PR ran Rust, the unit suites on three OSes and the full E2E, even
a docs-only PR.
The median time for the required checks to finish was 32.45 min (Orca
16.22, Paseo 20.65).
Now a `plan` job reads the changed paths (`HEAD^1..HEAD` of the PR merge
commit) and plans only the lanes the change needs.
The same plan sets each job's `if:` and is what `verify` checks the
results against.

- `verify` passes only when every **planned** lane is `success` and
every **unplanned** lane is `skipped`. A planned lane that was skipped,
failed or cancelled fails `verify`, and so does a `needs` entry the plan
doesn't know or a failed plan.
- The Windows browser `@platform` smoke moves out of `windows check`
into its own `windows e2e` lane, which calls `web-e2e.yml` the same way
nightly does. Compile, unit tests and the OS contract stay in `windows
check`.
- `checks` is split into `policy` (on every plan), `web checks`,
`desktop checks` and `hcoord`.
- A main push, a comparison that fails (base missing, not a merge
commit, diff parse failure, `cargo metadata` failure) and any
unclassified path all run **every** lane.
- Main pushes no longer cancel each other (`cancel-in-progress` is now
PR-only). `design-contract.yml` also cancels only the same PR's previous
run.
- The rules live in one place, `scripts/ci-plan.py`; the table in
`docs/TESTING.md`, "Which lanes a pull request runs", explains them.

## Review

- **판단해 주세요**: whether it is acceptable that **main's full run is the
safety net** for a lane wrongly left out. A wrongly skipped lane
surfaces as a failure on main after the merge, not on the PR.
- **판단해 주세요**: whether to keep the Windows smoke now skipping `@flaky`
tests, as macOS already did. No `@platform` test is tagged `@flaky`
today, so the behavior is the same for now.
- **판단해 주세요**: web code shared with the desktop host (`SHARED_WEB`) also
runs the desktop lanes and the macOS/Windows `@platform` lanes. That is
broader than the brief's "desktop 연결까지"; I chose it because terminal,
input and shortcut changes are Windows-impacting.
- **조심해서 볼 파일**: `scripts/ci-plan.py` `READERS` and `SHARED_WEB`. These
two hand-kept lists are where a lane can be dropped wrongly (the failure
path). Review found five omissions from tests reading files across
folders and they are fixed (below).
- **조심해서 볼 파일**: the `verify` job in `.github/workflows/pr.yml` and
`aggregate()`. This is the merge gate itself.
- **질문**: `site/`, `tools/`, `spikes/`, `.github/*.md` and `agents/prd`
currently fall under "unknown path → everything". Should a follow-up
narrow them?

## Evidence

**Plan replay over the last 20 merged PRs.** Each row runs the
classifier on the merge commit's `^1..` diff:

| PR | 경로 수 | 계획 | 생략되는 lane | Rust crate |
| --- | ---: | --- | --- | --- |
| #389 | 7 | 전체 (`scripts/web-shell-measure/run.sh`) | - | 전체 |
| #388 | 6 | 부분 | desktop-checks, hcoord, os-contract, windows-check,
windows-e2e, macOS-e2e, desktop-e2e | herdr-core |
| #385 | 125 | 전체 (`.github/pull_request_template.md`) | - | 전체 |
| #387 | 70 | 전체 (`contracts/hided-ws.schema.json`) | - | 전체 |
| #386 | 61 | 전체 (`contracts/hided-ws.schema.json`) | - | 전체 |
| #368 | 2 | 전체 (`.github/workflows/pr.yml`) | - | 전체 |
| #372 | 23 | 전체 (`.github/workflows/nightly.yml`) | - | 전체 |
| #382 | 3 | 부분 | web-checks, desktop-checks, hcoord | herdr-core,
hide-host, hided |
| #383 | 1 | 부분 | rust, desktop-checks, hcoord, os-contract,
windows-check, desktop-e2e | - |
| #384 | 8 | 부분 | web-checks, desktop-checks, hcoord, os-contract,
windows-check, windows-e2e, web-e2e, macOS-e2e, desktop-e2e | herdr-core
|
| #380 | 2 | 부분 | web-checks, desktop-checks, hcoord | herdr-core, hided
|
| #381 | 1 | 부분 | rust, desktop-checks, hcoord, os-contract,
windows-check, desktop-e2e | - |
| #378 | 58 | 전체 (`.github/workflows/nightly.yml`) | - | 전체 |
| #377 | 11 | 부분 | hcoord | herdr-core, hided |
| #361 | 91 | 전체 (`agents/prd/three-column-panel/prd.md`) | - | 전체 |
| #376 | 7 | 부분 | web-checks, desktop-checks, hcoord | herdr-core,
hide-agent-hooks, hide-ai, hide-herdr-client, hide-host, hide-kit,
hide-memory, hide-platform, hide-session, hided |
| #367 | 27 | 부분 | hcoord | herdr-core, hide-host, hided |
| #375 | 2 | 부분 | web-checks, desktop-checks, hcoord | herdr-core,
hide-agent-hooks, hide-host, hide-kit, hide-memory, hided |
| #366 | 8 | 전체 (`.github/workflows/release.yml`) | - | 전체 |
| #362 | 153 | 전체 (`agents/prd/overview-request-view/prd.md`) | - | 전체 |

- **줄어드는 lane**:
- 11 of 20 PRs would run a partial plan; 9 run everything because they
touch `.github/`, `contracts/`, `scripts/` or `agents/`.
- A docs-only PR (#384) runs no E2E, Windows or macOS lane. It still
runs `rust -p herdr-core`, because a herdr-core test reads the root
`AGENTS.md`.
- A web display change (#388) runs no Windows, macOS, desktop or
OS-contract lane.
- A Rust crate change tests only that crate and its reverse
dependencies, from `cargo metadata`. For example #380 tests `herdr-core`
and `hided` only.
- **확인한 것**:
  - `scripts/tests/test_ci_plan.py` passes 19 cases. They cover:
    - Docs-only, which excludes Rust and E2E.
    - A pure web display change, which excludes the Windows smoke.
    - `hide-platform`, which includes Windows and the OS contract.
- Shared web, a `@platform` spec, `desktop/src/main` and leaf-crate
reverse dependencies.
    - Every `READERS` entry.
- Unknown paths, lockfiles and workflows, a type change, an empty diff,
a missing base, a non-merge HEAD and a missing crate graph, which all
run everything.
- The aggregate rejecting a skipped, failed or cancelled planned lane,
an unplanned lane that ran, a missing or extra `needs` entry, a failed
plan and an empty plan.
- The full `python3 -m unittest discover -s scripts/tests` suite passes
(108). That includes the check that every gate a workflow runs is a
tracked script.
- actionlint passes on every workflow. `check-herdr-pin-single-source`,
`check-hide-design-enforcement`, `check-no-workstation-identity`,
`check-harness-ignore-anchor` and `verify-cargo.sh fmt-check` all pass.
- Running `plan` on #388 produced the expected `GITHUB_OUTPUT` (`lanes`,
`full`, `rust-packages`) and the job-summary table.
- Running `aggregate` with a fake `needs` passed when the results
matched the plan and failed when a planned lane was skipped.
- **리뷰 반영**: a code review and a fidelity review against the brief found
these, now fixed:
- Tests read files across folders, so these changes now plan the lanes
that read them: the root `AGENTS.md` (herdr-core test), `web/src` and
`hided/src` (herdr-core structure tests), `wirePath.ts` (imported by web
e2e) and `design/tokens.json` (read by web tests).
  - Every crate change now runs `windows check`.
  - Main pushes no longer cancel each other.
  - `docs/PERFORMANCE_TESTING.md` no longer describes the old lanes.
- **CI ([run
37214808511](https://github.com/modakbul-gongbang/hide/actions/runs/37214808511))**:
- The plan was full (the change touches `.github/` and `scripts/`), and
every lane ran, including the separate `windows e2e`. All passed.
- The first attempt failed in Linux web e2e shard 2/6 on
`home.spec.ts:82` (the location bar read `Home/hde-…` instead of
`Home/~/hide`). This PR touches no web or test code. `verify` reported
exactly `web-e2e: planned, expected success, got failure`.
  - One rerun of the failed jobs passed, and `verify` is green.
- The `home.spec` failure is a flaky-test candidate; it belongs to the
main-green work, not this PR.
- **확인하지 못한 것**:
- Partial plans have never run on Actions. A docs-only or web-only PR
has not been tried; the first one after the merge will show it.
- The cold-cache time of the `windows e2e` lane is unmeasured. It uses
the same path as the nightly Windows lane.
- Main runs now queue instead of cancelling, but GitHub keeps only one
pending run per group. If three merges land in a row, the middle merge's
full run can be dropped.
- **안전망과 위험**: a lane that should have run but was skipped is the risk.
Main's full run catches it after the merge; the fix is then a rule in
`scripts/ci-plan.py` plus a test case.

Does not include: a failure ledger or history, a quarantine registry,
cache changes, a `max-parallel` experiment, or the `package.yml` `paths`
trigger (all out of scope).
If this and the main-green PR overlap in `pr.yml`, whichever merges
later rebases.
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