Skip to content

feat: bring the operator's checkout up to a closed mission's destination - #2457

Merged
yansfil merged 10 commits into
mainfrom
feat/mission-pull-at-close
Nov 11, 2026
Merged

yansfil merged 10 commits into
mainfrom
feat/mission-pull-at-close

Conversation

@yansfil

@yansfil yansfil commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Related: PRD mission-destination (pull request 4 of 4, D-41), after #2451 (merged). Paired with with-hide/hide-private#869.

Summary

When a mission ends, the operator's own folder now gets its results without a manual pull, but only when that is safe.
On a close as done or merge_wait (and when a waiting mission turns done), Hide fetches the project once, even with background fetch off, and fast-forwards the checkout the mission was made in to the destination.
Anything else (another branch, detached, own commits, changes in the way, a fetch that fails, a device project) leaves the folder exactly as it is.
The report gets one line, such as 내 폴더도 최신으로 당겨왔어요 (2커밋) or 내 폴더 2커밋 뒤 · git pull; nothing else is shown.
A direct change's worktree is now cleaned up like a merged pull request's once its branch is in the destination, and the guide has the Conductor brief the mission's five options with the plan.

Settings › Mission's 머지되면 워크트리 정리 hint now reads 작업이 도착 브랜치에 머지되면 그 워크트리와 빌드 캐시를 지워요. 브랜치는 남기고, 고치던 파일이 남아 있거나 쓰는 중이면 그대로 둬요., with the same meaning in English, Japanese and Chinese; the title stays.

No screenshot: only the one-line Settings hint text changes.

Review

  • Decide: the fast-forward is the only automatic write Hide makes to the operator's checkout. It happens only when all hold: the read right after the fetch finds the destination itself out (never the catalog's branch, which may be older than a switch), tracking origin/<destination>, behind it and with no commit of its own, and the host's own 받기 (BranchCatchUp), told that branch, finds the same HEAD on the same branch and nothing it would overwrite. Any other branch, including one cut from the destination's upstream (git switch -c topic origin/main), gets the 결과는 <dest>에 들어갔어요 · 내 폴더는 <branch> line and is not moved.
  • Decide: skipped with no report line, only mission.folder_pull in the log: failed fetch (or a ref lock held), no origin, a branch with no upstream or another upstream, HEAD moved between read and fast-forward, a device project, cancel, nothing of the mission landed in the destination (D-47).
    A destination pushed without -u is skipped rather than compared with origin/<destination> directly: the catch-up follows the configured upstream only, and setting one would write the operator's Git config.
  • Risky files:
    • hide-core/src/runtime/mission_pull.rs - the write to the operator's checkout and every skip; chooses under the lock from memory, runs off it on one issue worker.
    • hide-core/src/runtime/missions.rs - the three close paths (close_mission_with, close_if_landed, the GitHub read's close) call owe_folder_pull; cancel does not.
    • hide-core/src/runtime/mission_cleanup.rs - a done direct change's branch joins the retire targets once node_landing is Landed { InMain }, no GitHub answer needed; same retire, same caps.
    • hide-core/src/missions.rs - new optional record field folder_line ({text, current}, schema 4 unchanged); a later close that finds the checkout current keeps a line whose current is set, so a Conductor's own close after Hide's keeps 당겨왔어요 (N커밋).
    • hide-host/src/branch_merge.rs, hide-node-link/src/{protocol,branch}.rs - catch_up takes an optional expected branch and answers OtherBranch when HEAD has another out; it reuses the symbolic-ref HEAD read it already made, so the read count and CATCH_UP_WAIT are unchanged. The header's 받기 and the merge flow pass none and behave as before.
    • hide-host/src/worktrees.rs - the checkout read now fills branch from the # branch.head line of the git status it already runs.
  • Cost: under Mutex<Runtime> each close adds a book/catalog lookup and a queue push; no git, fetch or file read. Off the lock: one fetch (bounded by FETCH_TIMEOUT), one CheckoutGit (4 s), at most one catch-up (CATCH_UP_WAIT), one pull at a time; the queue holds each mission at most once and is memory only. The cleanup pass is unchanged in shape (16 per pass, one worker).
  • Record and wire: no contracts/ change. Node link: CheckoutGit.branch and BranchCatchUp.branch are optional and skipped when empty, and CatchUpOutcome::OtherBranch is answered only to a caller that named a branch, which only the closing pull does, on this machine's own node. The checkout header's facts in the snapshot carry the optional branch, which the web does not read. folder_line is optional with skip_serializing_if; an older build ignores and drops it on its next save, keeping the line inside report, so a later close then adds a second line instead of replacing it (stated in ARCHITECTURE.md and the private doc).
  • Baseline cells: B-17 changes on purpose (closing now fetches and may fast-forward). B-16 holds for pull-request nodes unchanged (a_done_nodes_merged_worktree_is_retired_only_on_githubs_answer_and_with_the_switch_on still passes); direct nodes are added beside it. B-59 is untouched: direct worktrees go through the same retire_worktree.

Tests

  • Layer: unit (real repositories through the host's own handler), runtime, and one e2e.
    • runtime::mission_pull::tests (11): real git with a local bare origin inside a temp folder, through hide_host::serve::handle_in.
    • runtime::tests::missions (5): close hands the pull to a worker off the lock, cancel / nothing landed / device ask nothing, direct cleanup targets and kept outcomes.
    • web/e2e/mission-pull.spec.ts: the one test that crosses the CLI close, the core's worker, the node and git, with auto_fetch off.
  • Catches: a pull that waits under the lock or blocks the close (the runtime test takes the lock while the node is held); a pull on cancel; a fast-forward of another branch that tracks the destination's upstream, read fresh (a_branch_cut_from_the_destinations_upstream_is_left_and_named) or switched to between the read and the fast-forward (a_switch_to_another_branch_after_the_read_is_not_fast_forwarded); a second close that replaces 당겨왔어요 (N커밋) with 이미 최신이에요 (a_second_close_that_finds_the_checkout_current_keeps_the_pulled_line); HEAD moved mid-way; reporting a checkout ahead of origin as diverged (a_checkout_at_or_ahead_of_its_destination_on_origin_reads_current); a pull that relies on the background fetch (the e2e's (2커밋) needs the close's own fetch).
  • Repeat: mission-pull.spec.ts x 8 in a row (--repeat-each=8) on the final spec, all green, locally on macOS; the CI repeat lane runs it again in verify.
  • Waits: the runtime test waits on wait_for for the worker to reach the held node and for the report line (10 s hang guard each); the e2e waits on the snapshot (control.until) and the core's log records (untilLogged on mission.folder_pull and mission.worktree_retired), no fixed sleeps.

Evidence

  • Verified:
    • runtime::mission_pull::tests 10/10 against real repositories with a local bare origin; the filtered mission and upgrade runtime suites (396 tests) pass; cargo clippy -D warnings and rustfmt clean.
    • web/e2e/mission-pull.spec.ts on an isolated daemon (own state folder, own repository, nothing of the operator's): the close fetched with background fetch off, moved feat/login forward 2 commits to the remote's newest, wrote 내 폴더도 최신으로 당겨왔어요 (2커밋) as the report's last line, and removed the direct change's worktree with its branch kept.
      With the close's fetch taken out of the source, the same spec failed (the checkout one commit short of the remote); the source was restored and rebuilt before the green runs.
    • ConductorTab.test.tsx reads the new hint, and it and the i18n tests pass (59 tests).
    • Review fixes (heads 70890ddd4a, cb368af9b8): 54 targeted pull, catch-up, checkout-read and protocol tests across hide-core, hide-host and hide-node-link, then the 234 mission tests of hide-core, all pass; clippy -D warnings on the three crates, rustfmt and cargo check -p hided clean.
      Planted together, naming no branch to the catch-up and dropping the keep rule made a_switch_to_another_branch_after_the_read_is_not_fast_forwarded and a_second_close_that_finds_the_checkout_current_keeps_the_pulled_line fail; the source was restored before the commits.
    • hide mission help still names only commands the parser reads (each_mission_flag_the_parser_reads_is_one_the_contract_names).
    • Local gates: check-timed-waits.py, check-no-attribution.py, check-no-workstation-identity.sh, eslint and check-e2e-test-size.mjs on the spec.
  • Not verified:
    • The e2e was not run again on the review fixes' head: the Mac had under 500 MiB free and a daemon relink could not be risked. It passed 8/8 on a51da82855; the fixes change which read decides the branch, which the real-repository tests above cover through the host's own git status, and the CI repeat lane runs the e2e on this head.
    • Windows and Linux natively: the pull goes through the host's existing fetch, git read and 받기, which their CI lanes cover; this PR's own runs were macOS only until CI.
    • A mission on a device project: skipped by design and listed in docs/INSTALL.md; not run against a real device.
    • A pull-request node's close through GitHub's merged answer (closed_by_merge path) end to end: covered by the runtime test only, not by the e2e.
    • Two early e2e failures were spec races, not product faults: the spec set the direct node done itself, which Hide also does on a passed line (B7), and then waited on one close path when the close can go straight to done. Both are removed; the logs of those two runs were not kept.
Verification record

@yansfil

yansfil commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Merging while main's push run 43091533179 (e53b664) reads failure: every one of its 46 lanes passed or was skipped, and only the aggregate verify job was never created. The merge queue's run 43091020421 on the same commit e53b664 passed in full, aggregate included, so main's tree is verified; this is not a code failure. I will watch the push run that contains this merge.

@yansfil
yansfil added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 8492a4f Nov 11, 2026
89 of 91 checks passed
@yansfil
yansfil deleted the feat/mission-pull-at-close branch November 11, 2026 22:29
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