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

Function verify

libatomic/examples/agent_sandbox_bench.rs:559–599  ·  view source on GitHub ↗
(sandbox: &Path, golden: &[Golden], partial: bool, east: &[String])

Source from the content-addressed store, hash-verified

557/// the east subtree and nothing else from the west or the root.
558#[cfg(unix)]
559fn verify(sandbox: &Path, golden: &[Golden], partial: bool, east: &[String]) -> Result<()> {
560 if partial {
561 for path in east {
562 let content = golden
563 .iter()
564 .find(|f| &f.path == path)
565 .context("east path missing from golden")?;
566 let target = sandbox.join(path);
567 ensure!(target.is_file(), "partial sandbox misses {}", path);
568 ensure!(
569 fs::read(&target)? == content.content,
570 "partial sandbox bytes differ: {path}"
571 );
572 }
573 for file in golden {
574 if !east.contains(&file.path) {
575 ensure!(
576 !sandbox.join(&file.path).exists(),
577 "partial sandbox fetched beyond its prefix: {}",
578 file.path
579 );
580 }
581 }
582 return Ok(());
583 }
584 for file in golden {
585 let target = sandbox.join(&file.path);
586 ensure!(target.is_file(), "sandbox misses {}", file.path);
587 ensure!(
588 fs::read(&target)? == file.content,
589 "sandbox bytes differ: {}",
590 file.path
591 );
592 ensure!(
593 file_mode(&target)? == 0o644 || file.content.is_empty(),
594 "sandbox mode differs: {}",
595 file.path
596 );
597 }
598 Ok(())
599}
600
601// ————————————————————————————— harness —————————————————————————————
602

Callers 4

runFunction · 0.70
verifies_tokenFunction · 0.50
list_vault_entriesMethod · 0.50
record_attestationMethod · 0.50

Calls 3

contextMethod · 0.45
iterMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected