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

Function binding_pack_records

atomic-repository/src/git_binding/privacy.rs:72–94  ·  view source on GitHub ↗

Select the change objects allowed into the optional `changes.pack`. This is the audited sync-pack boundary (RFC §8.6): only [`ObjectFamily::Change`] records may enter a binding pack, and each must hash-verify (`blake3(bytes) == key`) so the pack stays content-addressed. Provenance/attestation/view sidecars — the families that can contain unhashed private payloads — are refused, never silently cop

(
    candidates: &[ObjectRecord],
)

Source from the content-addressed store, hash-verified

70/// Provenance/attestation/view sidecars — the families that can contain
71/// unhashed private payloads — are refused, never silently copied into Git.
72pub fn binding_pack_records(
73 candidates: &[ObjectRecord],
74) -> Result<Vec<ObjectRecord>, BindingTreeError> {
75 let mut allowed = Vec::with_capacity(candidates.len());
76 for record in candidates {
77 match record.family {
78 ObjectFamily::Change => {}
79 family => {
80 return Err(BindingTreeError::Encode(format!(
81 "binding pack refused {family:?} object {key}: only V3 change files may enter Git",
82 key = record.key
83 )))
84 }
85 }
86 if Hash::of(&record.bytes).to_hex() != record.key {
87 return Err(BindingTreeError::HashMismatch {
88 key: record.key.clone(),
89 });
90 }
91 allowed.push(record.clone());
92 }
93 Ok(allowed)
94}
95
96/// Structurally validate conflict-pack bytes without a claimed identity.
97///

Calls 4

lenMethod · 0.45
to_hexMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45