Skip to content

feat(service): put and fetch records in batches - #119

Open
PiquelChips wants to merge 1 commit into
feat/serverfrom
feat/server-records
Open

PiquelChips wants to merge 1 commit into
feat/serverfrom
feat/server-records

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

Clients of a server send it their snapshots, revisions and statements, and fetch the records they lack, many at a time. A repository must never hold a record it cannot use, nor one that claims to be something it isn't.

Objects travel as a Pack: each object's id, length and encoding. Decoding verifies every object against its id, so a pack can come from an untrusted peer. OriginService::records fetches objects as a pack, and put_records writes one.

Putting records:

  • Acceptances are refused: only a target's authority writes them, by landing.
  • So is anything that needs objects the repository lacks, or names an object as the wrong kind (a blob as a snapshot, say).
  • Objects the repository already has are made durable with the batch, since their writer may not have synced them yet.
  • Statements are written before the revisions they're about, so a crash never publishes a revision without its core.conflict; promotions come last, each checked against its original.
  • Divergence caused by pushed revisions is flagged.

A batch now reads the pack manifest before it first looks an object up in the packs, so a process that never loaded them, like a server that just started, doesn't store every packed object again.

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: e5ae2709-088c-458e-939a-c02110946d69
Commits

Reviewing files that changed from the base of the PR and between d615933 and b1a174b.

Files selected for processing: 6

  • apps/origin-src/src/service.rs
  • apps/origin-src/src/store/mod.rs
  • apps/origin-src/src/store/packs.rs
  • crates/origin-shared/src/lib.rs
  • crates/origin-shared/src/object/tree.rs
  • crates/origin-shared/src/pack.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/server-records branch 2 times, most recently from 01bfd34 to 7c7a3f8 Compare November 22, 2026 18:54
Clients of a server send it their snapshots, revisions and statements,
and fetch the records they lack, many at a time. A repository must
never hold a record it cannot use, nor one that claims to be something
it isn't.

Objects travel as a `Pack`: each object's id, its length, then its
encoding. Decoding verifies every object against its id, so a pack can
come from an untrusted peer.

`OriginService::records` fetches objects by id as a pack, and
`put_records` writes one. Each object must decode, and the repository
must have, or the pack hold, everything it needs, of the kind it
names: a tree's entries, a revision's snapshot, description, base and
dependencies, a statement's subject and the statements it supersedes
or promotes. Acceptances are refused: only a target's authority writes
them, by landing. The objects the repository has already are made
durable with the batch (`Batch::depend`), since their writer may not
have synced them yet. Blobs and trees are durable before the records
that refer to them, statements before the revisions they're about, so
a crash never publishes a revision without its `core.conflict`, and
promotions come last, each checked against its original. The service
flags the changes pushed revisions made diverge.

A batch now reads the pack manifest before it first looks an object up
in the packs, so a process that never loaded the packs, like a server
that just started, doesn't store every packed object again.
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