MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / validate

Function validate

atomic-agent/src/record/scope.rs:135–151  ·  view source on GitHub ↗
(
    root: &Path,
    files: &FileManifest,
    options: &TurnRecordOptions<'_>,
)

Source from the content-addressed store, hash-verified

133}
134
135pub(super) fn validate(
136 root: &Path,
137 files: &FileManifest,
138 options: &TurnRecordOptions<'_>,
139) -> AgentResult<()> {
140 for (path, expected) in files {
141 let actual = fingerprint(root, path).map_err(|reason| AgentError::RecordFailed {
142 session_id: options.session.session_id.clone(),
143 turn_number: options.turn_number,
144 reason,
145 })?;
146 if &actual != expected {
147 return Err(AgentError::RecordFailed { session_id: options.session.session_id.clone(), turn_number: options.turn_number, reason: format!("scoped file changed after this session's tool finished: {path}; refusing ambiguous ownership") });
148 }
149 }
150 Ok(())
151}
152
153/// A duplicate Stop can be acknowledged only if its scoped files have no
154/// unrecorded changes. Never use unrelated working-tree edits as evidence of

Callers 2

record_turnFunction · 0.85
has_pending_changesFunction · 0.85

Calls 2

fingerprintFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected