Skip to content

feat(sync): fetch the records of changes, and snapshots as they're read - #128

Open
PiquelChips wants to merge 1 commit into
feat/sync-remotefrom
feat/sync-fetch-changes
Open

PiquelChips wants to merge 1 commit into
feat/sync-remotefrom
feat/sync-fetch-changes

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

The first half of fetching: bringing the records of changes, and the snapshots a command reads.

Records of changes:

  • Sync::fetch_changes asks the remote what it holds of some changes, by id, and fetches the records this node lacks, with those they refer to, recursively.
  • Then it fetches the records of the changes the revisions fetched belong to, so every change this node learns of comes whole. Changes that diverged are flagged.
  • Answers that stop short at 64 MiB are asked for again from where they stopped.

Snapshot transfers:

  • Snapshots don't come with records. Sync::need fetches one when something reads it, skipping what the snapshots this node holds whole hold at the same path.
  • Interrupted snapshot fetches are marked, and repaired before they're used: a fetch publishes trees before what they hold, so a snapshot being fetched is marked durably in fetching/, synced with the batch, and Store::holds never takes a marked one for whole. Sync::repair fetches a snapshot whole again.

Benchmarks (20k files over local HTTP, measured by the sync benchmark later in this stack): fetching the snapshot a clone needs takes about 490 ms, and a snapshot with 100 edits 22 ms.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1c65e19-43b8-472f-a7be-96def9bd909b
Commits

Reviewing files that changed from the base of the PR and between 3040234 and 722b874.

Files selected for processing: 7

  • AGENTS.md
  • apps/origin-src/src/lib.rs
  • apps/origin-src/src/remote.rs
  • apps/origin-src/src/service.rs
  • apps/origin-src/src/store/mod.rs
  • apps/origin-src/src/sync.rs
  • apps/origin-src/src/tree.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PiquelChips
PiquelChips added this pull request to stack #165 November 22, 2026 14:59
@PiquelChips
PiquelChips force-pushed the feat/sync-fetch-changes branch from 015feb0 to 5260d94 Compare November 22, 2026 15:04
@PiquelChips
PiquelChips force-pushed the feat/sync-fetch-changes branch 2 times, most recently from 8b5a14f to 90fe00d Compare November 22, 2026 18:54
`Sync` shares records with a remote. This is its fetching side for
changes: `fetch_changes` asks the remote what it holds of some changes,
by id, and fetches the records this node lacks, with those they refer
to, recursively (a revision's base and dependencies, a statement's
subject and the statements it supersedes or promotes), then the records
of the changes the revisions fetched belong to, so every change this
node learns of comes whole. It flags the changes that diverged. Answers
that stop short are asked for again from where they stopped.

Snapshots don't come with records: `Sync::need` fetches one when
something reads it, skipping what snapshots this node holds whole hold
at the same path. A fetch publishes trees before what they hold, so a
snapshot being fetched is marked durably in `fetching/`, synced with the
batch, and `Store::holds` doesn't take a marked one for whole: fetching it
again completes it. `Sync::repair` fetches a snapshot whole again, for
one that lacks trees its root names.

`Dependencies` now tells the records an object refers to from its
content, since only records come with a fetch.
@PiquelChips
PiquelChips force-pushed the feat/sync-fetch-changes branch from 90fe00d to 722b874 Compare November 22, 2026 19:20
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