Skip to content

id-core: typed-byte graph terms and signed graph records - #11975

Merged
dezren39 merged 1 commit into
mainfrom
claude/graph-term-codec
Nov 19, 2026
Merged

dezren39 merged 1 commit into
mainfrom
claude/graph-term-codec

Conversation

@dezren39

@dezren39 dezren39 commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Refs #10196

Before: id-core had no graph term or triple type. Nothing defined how a subject, predicate or object is encoded, how a term points at another object, or how a signed graph record is built and opened.

After: graph/term.rs defines typed-byte terms and object references (content or signed envelope) with one deterministic CBOR encoding each, and graph/record.rs signs and opens a graph record ({v, graph, triples, source_record?}) inside a signed envelope and yields its assertions with their provenance.

Terms are a general foundation, not RDF: equality is exact (type_tag, bytes), bytes are never normalized, and a reference is its own kind of term, never a string. Unknown kinds, unknown hash profiles, wrong digest sizes, unknown record fields, an unknown schema version, a wrong envelope domain, a graph mismatch and self-references are all rejected.

How:

  • Wire form: [0, type_tag, bytes], [1, profile, digest32], [2, profile, digest32]; a triple is [s, p, o].
  • open() checks the domain, verifies the signature, decodes the payload, checks that the envelope's graph matches the record's, and rejects any reference to the record's own envelope ID or payload content ID.
  • tests/graph_term_codec.rs (12 tests) pins known-answer bytes, IDs and the signature against an independent Python encoder (blake3 + Ed25519 + a hand-written CBOR encoder), checks an independent signature verify, that no ID appears in its own preimage, open round-trips with provenance, and a proptest against a reference encoder.
  • Mutation pass: every mutant in term.rs and record.rs is killed except removing the self-reference check inside open(), which no honestly hashed envelope can reach (it would need a payload that contains its own hash); the check itself is covered by direct tests.
  • Not wired into graph/mod.rs or the crate root yet; slice 9110-09 owns that, so the test includes these files by path.

Generated by Claude Code


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

Adds graph/term.rs (typed-byte terms, content and envelope references,
triples, one canonical CBOR encoding each) and graph/record.rs (graph
records signed in a signed envelope, opened with domain, signature,
graph and self-reference checks, yielding assertions with provenance).
Known-answer vectors are pinned against an independent Python encoder.
Module wiring into graph/mod.rs is left to slice 9110-09.

Refs #10196

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 requested a review from a team as a code owner November 19, 2026 00:24
@coderabbitai

coderabbitai Bot commented Nov 19, 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 46 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: 827e1310-dc3d-4b5e-8bd5-8676b586a3d7
Commits

Reviewing files that changed from the base of the PR and between eaacc9f and 8372361.

Files selected for processing: 3

  • pkgs/id/crates/id-core/src/graph/record.rs
  • pkgs/id/crates/id-core/src/graph/term.rs
  • pkgs/id/crates/id-core/tests/graph_term_codec.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 19, 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-19T00:25:48.648254Z 8372361 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.

@dezren39
dezren39 merged commit 94d353f into main Nov 19, 2026
1 check passed
@dezren39
dezren39 deleted the claude/graph-term-codec branch November 19, 2026 00:24
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.

2 participants