Skip to content

Cold launch fetches exactly the requested ref; delete the workspace-clone fetch #150

Description

@blooop

Question

Per the #144 decision, the foreground cold path makes exactly one narrow network call and no broad one. Depends on the updater-sweep build ticket (the sweep must exist before the foreground stops sweeping).

  • ensure_repo (repo_manager.py:204-236) stops fetching: remove the _should_fetch/fetch_repo branch and the auto_fetch parameter (production never passes False; tests that did get the behavior for free). It becomes the pure locked clone-if-missing primitive.
  • ensure_branch (workspace_clone.py:172-206): replace lazy_fetch (:190) with an unconditional targeted fetch of the requested ref into the bare repo (git fetch origin +refs/heads/<branch>:refs/heads/<branch>); on ref-missing-on-remote, one targeted fetch of the default branch before ensure_branch_exists bases on it. Model the outcome as the three-way result from Move the interval git fetch off the foreground launch path and out of the repo lock #144 (updated / ref-missing / network-failed → proceed-fresh / create-from-default / warn-and-use-cache-or-error), not a bool. Do not write last_fetched here.
  • Delete _prepare_workspace step 4 (workspace_clone.py:298-310) — its output is unused (plain git checkout <branch> at :338).
  • Do not restructure lock cycles — Collapse the duplicated ensure_repo passes and repo-lock cycles on the cold path #143 owns that seam.

Failing tests first: (1) the lock-aware fetch pin from #144 — no +refs/heads/* fetch in the foreground, only the targeted refspec ever under the repo lock (flock LOCK_NB probe in the fake subprocess.run); (2) re-registration path runs zero fetch in the workspace clone; (3) staleness contract integration: remote gains a commit after the cache cloned → new workspace HEAD == remote tip; ref only on remote → succeeds; ref nowhere → existing error.

Files: devlaunch/worktree/repo_manager.py, devlaunch/worktree/workspace_clone.py, test/test_worktree_repo_manager.py (existing auto_fetch tests), test/integration/test_repo_manager_real.py.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions