Skip to content

perf(topic): join and leave ask no other lazy remote; finish fetches a store once - #11

Merged
antonzherdev merged 2 commits into
mainfrom
topic-scoped-network
Oct 28, 2026
Merged

antonzherdev merged 2 commits into
mainfrom
topic-scoped-network

Conversation

@antonzherdev

@antonzherdev antonzherdev commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Follows #9, which stopped topic start asking lazy remotes. This does the same for the other topic commands a short-lived task runs.

What changes

  • join and leave now resolve with Network::Scoped (feat(topic): start asks no lazy remote for the new topic's branch #9's NewTopic, renamed because it no longer serves only start). The stores they read are fetched as before, but no other lazy repository's remote is asked for the topic's branch. Both commands place only the checkouts they name. A named lazy entry is woken before resolution, so the joined repository still finds a branch its remote already has (feat(topic): start asks no lazy remote for the new topic's branch #9's edge_029 covers this).
  • finish fetched each store on the topic twice: once in children_on_topic, and again before deciding which remote branches to delete. It now fetches each store once per finish (fetch_once), and a failure warns the same way at either step.
  • Scoped reads the store. For a lazy repository's topic branch it reads what the store last fetched, as an offline placement does, instead of answering "no". Without this, join failed ("not a checkout of this workspace") for a lazy repository whose shared store had already fetched the topic's branch for another worktree of the root. It also fixes feat(topic): start asks no lazy remote for the new topic's branch #9's start leaving such a repository out until the next placement put it back. edge_032 covers it.

switch and git scale sync still ask every lazy remote.

Measurements

On a workspace of 45 lazy entries, 0.3 s round trip from its git server, a warm start, join and finish of one small repository:

before (v0.8.1 + #9) after
topic start 22 s 9 s
topic join 25 s (43 ref advertisements) 8 s
topic finish --force 38 s (3 fetches) 12–17 s (2 fetches)

Tests

  • perf_030_join_and_leave_ask_no_other_lazy_remote
  • perf_031_finish_fetches_each_store_once

Both fail without the change. #9's perf_028 now shares their round_trips helper, which counts git-upload-pack starts in git's trace2 events.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q7zEtTAXBrRjmCYoNBKDLk

@antonzherdev
antonzherdev changed the base branch from antonzherdev/plat-1034-gitscale-skip-the-remote-topic-probe-on-a-fresh-topic-start to main October 28, 2026 04:26
Anton Zherdev and others added 2 commits October 28, 2026 05:01
…a store once

`git topic join` and `leave` resolved the workspace online, which asks every
lazy repository's remote for the topic's branch, though they place only the
checkouts they name. Each question is a round trip, and on a workspace with
many lazy entries those were most of every join.

They now resolve with Network::Scoped, which `start` already used under the
name NewTopic: the stores read are fetched as online, but no lazy remote is
asked. A named lazy entry is woken before resolution, so the one joined still
finds the branch its remote has.

`finish` fetched each store on the topic twice: once to decide whether its
child had settled, once before deleting its remote branch. A store is now
fetched once per finish, and the second check reads what the first fetched.

On a workspace of 45 lazy entries, 0.3 s from its server, a warm start, join
and finish of one repository went from about 85 s to about 30 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7zEtTAXBrRjmCYoNBKDLk
Network::Scoped answered "no" for every lazy repository's topic branch,
knowing less than an offline placement, which reads what the store last
fetched. With worktrees of one root sharing stores, that broke `topic
join` of a lazy repository whose store had already fetched the topic's
branch for another worktree: the first, on-miss resolution counted it
awake and so did not name it, and the scoped one then left it out, so the
join failed with "not a checkout of this workspace". It also kept such a
repository out after `start`, and the next on-miss placement put it back.

Scoped now reads the store's refs, as offline does, and still asks no
remote. The docs say which stores join and leave fetch, and that finish
does not retry a store fetch that failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7zEtTAXBrRjmCYoNBKDLk
@antonzherdev
antonzherdev marked this pull request as ready for review October 28, 2026 05:08
@antonzherdev
antonzherdev merged commit fde4b05 into main Oct 28, 2026
1 check passed
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