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

Function validate

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

Source from the content-addressed store, hash-verified

161}
162
163pub(super) fn validate(
164 root: &Path,
165 files: &FileManifest,
166 options: &TurnRecordOptions<'_>,
167) -> AgentResult<()> {
168 for (path, expected) in files {
169 let actual = fingerprint(root, path).map_err(|reason| AgentError::RecordFailed {
170 session_id: options.session.session_id.clone(),
171 turn_number: options.turn_number,
172 reason,
173 })?;
174 if &actual != expected {
175 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") });
176 }
177 }
178 Ok(())
179}
180
181/// A duplicate Stop can be acknowledged only if its scoped files have no
182/// unrecorded changes. Never use unrelated working-tree edits as evidence of

Callers 2

record_turnFunction · 0.70
has_pending_changesFunction · 0.70

Calls 2

fingerprintFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected