Skip to content

feat(id): hosted import ingest — apply a verified export under normal admission rules (#13158) - #13201

Merged
dezren39 merged 1 commit into
mainfrom
lane-qj-13158
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-qj-13158

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Closes #13158 (slice 4b ingest half of #2852, remainder of #3810 — §6.2 step 4).

What

New pkgs/id/src/hosted_ingest.rs: ingest_import applies a verified hosted export at the importing (self-hosted) node.

  • Downstream of verification only. The VerifiedImport token minted by verify_import must be handed in and must name this export's binding, key, and entry counts; a mismatched token is refused (ImportError::VerificationMismatch) before anything is written.
  • Normal rules, no privileged path. Each object goes through EventStore::ingest — the same verification, fork, and waiting rules any peer's event faces (id: investigate: trust/visibility model — servers accept all signed objects; views count only allowed writers #2030: validity at ingest, counting at view). Objects held as waiting are settled after the whole export has been offered; one still waiting is reported refused under the waiting rule (the store keeps its held row, so a later import carrying the dependency releases it).
  • Blobs by hash. Each blob is placed in the node's iroh-blobs store under the BLAKE3 hash of its bytes — the hash a document.put header cites — so citations resolve locally.
  • Per-entry report. ImportReport names every object and blob as applied, already-present, or refused with the rule that refused it. A refusal never blocks the remaining entries; nothing is silently dropped.

hosted_export's module doc now points at the new module for step 4.

Verification (laptop, nix develop in pkgs/id)

  • cargo test -p id --lib hosted_ → 57 passed, 0 failed (5 new ingest tests + the existing binding/export suites).
  • cargo test -p id --lib (full) → 531 passed, 0 failed — no regressions.
  • cargo clippy -p id --lib → clean; rustfmt --check on the new file → clean.

New tests map to the issue's acceptance: round-trip store → export → verify → ingest lands every object byte-identical with the blob retrievable by its cited hash; re-ingest reports everything already-present; a wrapper-valid object that is not an event is refused as malformed, named, and does not block the rest; an object missing its predecessor is refused as waiting; a token for another export writes nothing.


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

… admission rules (#13158)

Slice 4b (ingest half) of #2852, remainder of #3810: §6.2 step 4.

New `pkgs/id/src/hosted_ingest.rs`: `ingest_import` applies a
`HostedExport` at the importing node, downstream of `verify_import`
only — the `VerifiedImport` token must name the export's binding,
key, and counts or nothing is written.

- Objects go through the event store's normal ingest
  (`EventStore::ingest`): the same verification, fork, and waiting
  rules any peer's event faces, so a hosted-origin object is
  indistinguishable from a self-hosted one once stored. Objects held
  as waiting are settled after the whole export has been offered; one
  still waiting is reported refused under the waiting rule.
- Blobs are placed in the node's iroh-blobs store under the BLAKE3
  hash of their bytes — the hash a `document.put` header cites — so
  citations resolve locally.
- The returned `ImportReport` names every object and blob as
  applied, already-present, or refused with the rule that refused
  it; a refusal never blocks the remaining entries.

Tests (the issue's acceptance): round-trip store → export →
verify → ingest lands every object byte-identical and the blob
retrievable by its cited hash; re-ingest reports everything
already-present; a wrapper-valid object that is not an event is
refused as malformed, named, and does not block the rest; an object
missing its predecessor is refused as waiting; a token minted for
another export is refused before any write.

`cargo test -p id --lib`: 531 passed, 0 failed (5 new). Clippy
clean; rustfmt clean on the new file. hosted_export's module doc
now points at the new module for step 4.
@coderabbitai

coderabbitai Bot commented Nov 23, 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: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 538c3480-2ac5-4027-8c4c-467772d9d95b
Commits

Reviewing files that changed from the base of the PR and between c22ec19 and 0785bdb.

Files selected for processing: 3

  • pkgs/id/src/hosted_export.rs
  • pkgs/id/src/hosted_ingest.rs
  • pkgs/id/src/lib.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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T10:43:33.053669Z 0785bdb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

id: import ingest — apply a verified export under normal admission rules with a per-entry report (§6.2 step 4; slice 4b of #2852, from #3810)

1 participant