Skip to content

fix(topic): a scoped placement reads lazy stores without fetching them - #12

Merged
antonzherdev merged 1 commit into
mainfrom
antonzherdev/gitscale-scoped-no-fetch
Oct 29, 2026
Merged

antonzherdev merged 1 commit into
mainfrom
antonzherdev/gitscale-scoped-no-fetch

Conversation

@antonzherdev

Copy link
Copy Markdown
Collaborator

Fixes a regression in v0.8.2 from #11: on a workspace whose lazy repositories have stores on disk, topic start, join and leave fetch every one of those stores, one after another.

Cause

#11's second commit made Network::Scoped answer a lazy repository's topic branch from its store's refs rather than "no". It read them through GitStores::refs, which in an online placement fetches the store first (load_refs → Stores::update). So the scoped placement, meant to ask no lazy remote, ran git fetch --prune on each lazy store it found. That costs more than the ref advertisement per remote it replaced. perf_028 and perf_030 didn't catch it because their lazy repository has no store yet.

What changes

  • remote_topic in a scoped placement reads what this command already fetched for the store, or else what the store last fetched (stored_refs, split out of load_refs), and asks no remote. perf(topic): join and leave ask no other lazy remote; finish fetches a store once #11's fix still holds: a branch the shared store already has is found.
  • A store not on disk is not read at all. Before, stored && self.refs(url) short-circuited. Keeping that matters for a placement that fetches on a miss: reading an absent store marks it missed, and the next round fetches it.
  • docs/topics.md says the store is read without being fetched again.

Measurements

On a workspace of about 50 lazy entries with stores on disk, all behind one SSH remote:

v0.8.2 this PR
topic join of one repository 196 s 5.3 s
topic leave of it 192 s 5.3 s

Tests

  • perf_033_scoped_placement_fetches_no_lazy_store: a lazy repository joined once (so its store exists), then start, join and leave of another checkout must make no round trip to it. It fails on main (topic start fetched the lazy store: 1).

cargo test and cargo clippy --all-targets -- -D warnings pass, apart from five tests that fail on main too when the checkout sits inside another git repository (cli::error_010, config::error_001, lazy::normal_004, require::edge_006, workspace::error_004). They expect no enclosing repository.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q7zEtVsJRpPdHYgsL1ycA4

A placement that asks no lazy remote for the topic's branch (`start`,
`join`, `leave`) answered from the lazy store's refs, but read them as an
online placement does, which fetches the store first. So every lazy
repository whose store was on disk was fetched, one after another, on each
start and join: more round trips than asking each remote would have cost.

It now reads what the command already fetched, or else what the store last
fetched, and asks no remote. A store not on disk is not read at all, so a
placement fetching on a miss no longer fetches one only to answer this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7zEtVsJRpPdHYgsL1ycA4
@antonzherdev
antonzherdev merged commit aa0128b into main Oct 29, 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