pub struct ChangeSet {
pub changeset_id: Uuid,
pub target_uri: String,
pub kind: ChangeKind,
pub diff_content: DiffContent,
pub preview_ref: Option<String>,
pub risk_flags: Vec<String>,
pub commit_intent: CommitIntent,
pub created_at: DateTime<Utc>,
pub content_hash: String,
}Expand description
A single staged mutation — the fundamental unit of the review system.
Every change an agent makes flows through this type, whether it’s a file edit, email draft, or database write.
Fields§
§changeset_id: UuidUnique identifier for this changeset.
target_uri: StringThe resource being changed (e.g., “fs://workspace/src/main.rs”).
kind: ChangeKindWhat kind of mutation this is.
diff_content: DiffContentThe actual change content (diff, new file, etc.).
preview_ref: Option<String>Optional pointer to a rendered preview (e.g., a diff viewer URL).
risk_flags: Vec<String>Risk flags identified by the system (e.g., “contains_secrets”, “large_change”).
commit_intent: CommitIntentWhat the agent intends to do with this change once approved.
created_at: DateTime<Utc>When this changeset was created.
content_hash: StringSHA-256 hash of the diff content for integrity verification.
Implementations§
Source§impl ChangeSet
impl ChangeSet
Sourcepub fn new(
target_uri: String,
kind: ChangeKind,
diff_content: DiffContent,
) -> Self
pub fn new( target_uri: String, kind: ChangeKind, diff_content: DiffContent, ) -> Self
Create a new changeset with automatically computed content hash.
The content hash is computed from the serialized diff_content, ensuring integrity can be verified later.
Sourcepub fn with_commit_intent(self, intent: CommitIntent) -> Self
pub fn with_commit_intent(self, intent: CommitIntent) -> Self
Set the commit intent and return self (builder pattern).
Sourcepub fn with_risk_flag(self, flag: impl Into<String>) -> Self
pub fn with_risk_flag(self, flag: impl Into<String>) -> Self
Add a risk flag and return self.
Sourcepub fn verify_hash(&self) -> bool
pub fn verify_hash(&self) -> bool
Verify the content hash matches the actual diff content.