Skip to main content

Crate differential_engine

Crate differential_engine 

Source
Expand description

Core engine: git io, diff parsing, byte-exact apply, shape classes, invariants, and plan-document assembly.

The canonical enumeration (git diff -U0 --no-renames) processes every file with no exclusions (ADR 0005); the rename-detected view (-M) only annotates it (ADR 0003). Repo config tunes classification hints and can never remove anything from enumeration (ADR 0012).

Re-exports§

pub use grouping::GroupingOptions;
pub use pipeline::PipelineOutput;
pub use pipeline::resolve_range;
pub use pipeline::run_grouped_pipeline;
pub use pipeline::run_pipeline;
pub use pipeline::verify;
pub use review_session::ReviewSession;

Modules§

apply
Byte-exact hunk applier.
artefact
What the model is given (ADR 0022).
config
Configuration, split by ownership (ADR 0012, amended by ADR 0018-era split):
document
Assemble the frozen-schema plan document from the engine’s outputs.
forge
The forge consumer’s domain (ADR 0029, spec/forge.md).
forgeio
The forge adapters: gh for GitHub, glab for GitLab (ADR 0029, spec/forge.md).
gitio
Git subprocess runner. Bytes in, bytes out — UTF-8 decoding happens only at display boundaries (ADR 0002). Plumbing commands only (ADR 0011).
grouping
The grouping stage: an LLM merges and labels shape-class ids — never hunks (ADR 0001) — behind the LlmBackend abstraction (ADR 0016), with a coverage audit that back-fills anything the model drops (invariant 5) and a content-hash cache that pins groupings (ADR 0009).
invariants
Invariants 1–4 (spec/invariants.md); every one caught a real bug during prototype validation.
lang
Language abstraction (ADR 0015).
llm
LLM backend abstraction (ADR 0016; an engine module since ADR 0018).
model
Data model for the canonical diff view.
ordering
The ordering stage: foundation-first arrangement of the focus section.
parse
Parser for git diff-tree -r -U0 --no-renames patch output.
paths
Path extraction from diff --git a/X b/Y headers.
pipeline
The core pipeline: enumerate → annotate → classify → emit. Read-only.
plan
Domain policy over a plan document: the decisions, without the I/O.
ports
Ports: the traits the engine’s business logic owns and adapters implement.
rename_view
The rename-detected classification view (ADR 0003).
review_identity
Which review a range opens: the id, and whose progress it inherits.
review_session
An open review: the engine-owned session over one plan document.
review_state
The review-state sidecar store (ADR 0013, spec/persistence.md).
schema
The frozen JSON contract for differential reading plans.
shape
Shape classes and hunk digests.
store
Filesystem adapters: the mirror of gitio for everything that is not git.
subprocess
One child process, run to completion under a deadline and a cancel flag.
tree
Build the final tree from applied hunks, via plumbing against a temporary index (ADR 0011). No checkout, no touching the user’s index or worktree.
worktree
Tree snapshots of uncommitted state (ADR 0017): the index and the worktree as plain tree oids, so the rest of the pipeline — diff-tree enumeration, the invariants, blob reads — runs on them unchanged.

Enums§

EngineError

Type Aliases§

FsReviewSession
The production session: a review over the on-disk sidecar. Renderers name this one concrete type rather than carrying a generic parameter for a choice they never make.