Repository navigation
feat(repo): presence-based partial-clone engine (P37b-i) - #178
Merged
Merged
Conversation
A partial clone's fetch filter records what it asked for, not what is present: an ordinary `sc fetch` subtracts the closure of every have, so a new in-filter object equal to one reachable at an out-of-filter path is left out of the reply. gc and fast-forward then failed with `object ... not found` while `sc verify` reported only the expected gap. - reachable: `reachable_objects_partial` walks what the store holds and records absent children as gaps with their referrer (an absent root tree is a gap too). `reachable_objects_filtered` keeps its meaning; the origin uses it to cut transfers. - gc, push and verify use the presence walk. gc's hand-written walk-in of present gap ids is gone. - push checks every gap id against the destination before any put_pack and refuses with `PushGap`; a partial clone fetches from its promisor origin only; `sc push` to a git remote is refused up front. - materialize runs a no-network view preflight before its first write, so switch, fast-forward and the rest fail with `GapInView` (naming the `sc backfill` prefix) instead of a raw NotFound after a partial write. undo and `sparse set` also preflight ahead of their ref and spec mutations. - commit graft refuses a new top-level name only when it is outside both the filter and the sparse view. - explicit refusals for an empty `sparse set`, rewrap, grant, revoke and switching away from a private branch. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…i review) The old-root removal walk is bounded by the promisor filter, which is only a superset of the sparse view. A fetch can leave a tree inside the filter but outside the view absent, so a later switch failed with a raw NotFound and undo failed after moving the ref. The old root was laid out under a preflighted view, so an absent subtree has nothing on disk and is skipped. Also: PushGap hint for a lost local object, PartialReach doc, ADR/CLAUDE.md wording. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tonibergholm-codento
approved these changes
Oct 17, 2026
tonibergholm-codento
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed; review findings addressed, checks green on 0452597.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Phase 37b-i of ADR-0048 (merged as #177): the client-side walks on a partial clone ask the store what is present instead of asking the fetch filter.
The bug on
mainthis fixesA partial clone's filter records what it asked for, not what is present. An ordinary
sc fetchsubtracts the full closure of every have, so a new in-filter file whose bytes equal an object already reachable at an out-of-filter path is left out of the reply. Repro: the origin hasdocs/readme.txt; clone with--filter src/; the origin adds an identicalsrc/readme.txt; the clone fetches. Thensc gcand a fast-forwardsc mergefail withobject … not found, andsc verifyexits 0 reporting only the expecteddocs/gap.Changes
reachable_objects_partialwalks what the store holds and records absent children as gaps with their referrer. An absent root tree is a gap. Snapshots, parents, secrets and manifests stay strict.reachable_objects_filteredis unchanged (the origin uses it to cut transfers), and a test pins that.put_packand refuses withPushGap, naming the id. A push to a remote that is not a mirror of the origin now fails safe.GapInViewpreflight runs at the top ofworktree::materialize, so every call site fails before its first file write, with thesc backfill <prefix>repair named.sc undo(againstwill_be_tip) andsparse set(against the proposed spec) also check ahead of their ref and spec mutations. No network.sc fetchfrom a non-origin remote,sc pushto a git remote, an emptysc sparse set,sc rewrap,sc grant/revoke, and switching away from a private branch now say so instead of failing with a rawNotFound.Deviation from the ADR text, recorded in it: the preflight is centralized in
materializerather than called at each site, and "materialize takes the old spec" moves to 37b-ii (until a widen exists the sparse view is inside the filter, so the filter bound is a safe superset). Thepartial: N object(s) outside filterline ofsc verifyis unchanged because the demos match on it.Verification
cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --all-targets: green locally. 599scl-repolib tests, 8partial_clone_safetyCLI tests.demo/run_partial_clone_demo.shanddemo/run_lazy_fetch_demo.shpass unchanged.materializepreflight fails the switch and fast-forward tests.sparse setleaving the old spec, push refusal for a lost local object and for a non-mirror remote, origin-only fetch, whole-tree command refusals, the graft union, gc keeping filled objects, and the presence-walk unit tests.Not in this PR
37b-ii (
fill_closure,ensure_viewfill, sparse widen, reply-cap alignment) and the merge/replay design records.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
gcandverifynow handle partial clones more reliably, including after ordinary fetches.Partial Clone Limitations