Skip to main content

Crate brygge_ir

Crate brygge_ir 

Source
Expand description

brygge’s intermediate representation — the light core (RFC 001/002/003, under RFC 009).

This crate is the durable product boundary of brygge (requirement PU-3): decoders write an Ir, inspect/verify read it, encoders consume it, and a foreign encoder for another target depends on this crate and nothing heavier. It links no source-decoder dependency (RFC 009 D-1): the whole honesty and verification path runs here, so a target can check a brygge import on its own surface.

The one idea it turns on (RFC 001): faithfulness-with-provenance, not neutrality. The IR records what each source literally guaranteed, plus a marked place for what a decoder or encoder derived — and it carries evidence for identity (stated and inferred renames), never identity itself, leaving a node-identity encoder to author identity visibly. Honesty is a property of the model, not a convention: an inference has no representation except a [status::Derived] record, and there is no field in which to store target identity.

Modules: version the IR contract version + read gate · [canon] the hand-rolled canonical codec · content the content-addressed blob store · status the epistemic-status type + taxonomy · model the IR types · builder deterministic construction · artifact the single-file, digested, versioned container · honesty the loss boundary + the recoverable fidelity report.

Re-exports§

pub use artifact::Decoded;
pub use artifact::digest_of;
pub use artifact::from_bytes;
pub use artifact::from_file;
pub use artifact::read_from;
pub use artifact::to_bytes;
pub use builder::AtomDraft;
pub use builder::IrBuilder;
pub use content::BlobId;
pub use content::ContentStore;
pub use content::Storage;
pub use honesty::FidelityReport;
pub use honesty::summary;
pub use model::Annotation;
pub use model::AtomId;
pub use model::ChangeAtom;
pub use model::ChangedPart;
pub use model::Content;
pub use model::CopyRecord;
pub use model::DropRecord;
pub use model::Extra;
pub use model::Flag;
pub use model::FlagKind;
pub use model::Identity;
pub use model::ImportProvenance;
pub use model::Ir;
pub use model::LossBoundary;
pub use model::LossClass;
pub use model::MetadataClaims;
pub use model::PathOp;
pub use model::RefKind;
pub use model::RefRecord;
pub use model::Signature;
pub use model::SourceIdentity;
pub use model::SourceKind;
pub use model::Text;
pub use model::Time;
pub use model::TransformRecord;
pub use status::Derivation;
pub use status::DerivationKind;
pub use status::EpistemicStatus;
pub use version::ContractVersion;

Modules§

artifact
The single-file IR artifact: manifest + canonical metadata + content-addressed blob store (RFC 003 D-3/D-6, container re-cut by RFC 011 §2.3, compacted by RFC 018 D-1).
builder
Deterministic IR construction (RFC 003 D-5, RFC 011 §2.5).
content
The content-addressed blob store (RFC 001 D-1, RFC 003 D-2/D-3; the file backing: RFC 015 D-3).
honesty
The honesty machinery: the recoverable fidelity report (RFC 002 D-3/D-6, HO-4/FS-02, report v2 per RFC 011 §3).
model
The IR types (RFC 001 D-1/D-3/D-4, re-cut by RFC 011 §2.4).
restamp
Ir::restamped: relabel an Ir to the versions a different decode of it recorded (review 106 V-1), so --against-source can compare two decodes made by different brygge versions without a version difference alone reading as tampering.
status
The epistemic-status type and the shared derivation taxonomy (RFC 001 D-2/D-3, RFC 002 D-1, RFC 011 §2.4).
transform
brygge transform’s own honesty rule, as a function (RFC 018 D-6): check accepts an output artifact as an honest transform of an input one only if every change is marked and every removal is recorded, and refuses it with a Violation naming the first thing wrong otherwise. Edit is the sanctioned way to build an output that passes it: it computes every mark from the difference with input itself, never from what the caller says, so a transform built with it passes check by construction.
version
The IR contract version and its read gate (RFC 011 D-3, requirement IX-07).

Enums§

Error
Everything brygge-ir can fail with. Reading an artifact never panics on malformed bytes — a bad input is a typed error (brygge parses untrusted history; the core must be unshakeable).

Type Aliases§

Result
The result type for fallible brygge-ir operations.