Quarantine one candidate change record and recover its identity. Two distinct, deliberate key namespaces meet here — this is the resolved CB-6A/CB-6B ambiguity (RFC §8.6): - **Pack addressing** (the record `key`): lowercase-hex `blake3(record bytes)` — the audited [`binding_pack_records`] contract. The change *file* is the addressed object; its trailer is excluded from this digest by the V3 form
(record: &ObjectRecord)
| 300 | /// |
| 301 | /// [`binding_pack_records`]: super::privacy::binding_pack_records |
| 302 | pub fn quarantine_change_record(record: &ObjectRecord) -> Result<(Hash, Change), BindingPackError> { |
| 303 | if !matches!(record.family, ObjectFamily::Change) { |
| 304 | return Err(BindingPackError::Refused { |
| 305 | detail: format!( |
| 306 | "binding pack refused {:?} object {}: only V3 change files may enter Git", |
| 307 | record.family, record.key |
| 308 | ), |
| 309 | }); |
| 310 | } |
| 311 | if !is_blake3_key(&record.key) { |
| 312 | return Err(BindingPackError::InvalidKey { |
| 313 | key: record.key.clone(), |
| 314 | }); |
| 315 | } |
| 316 | if Hash::of(&record.bytes).to_hex() != record.key { |
| 317 | return Err(BindingPackError::HashMismatch { |
| 318 | key: record.key.clone(), |
| 319 | }); |
| 320 | } |
| 321 | let (change, identity) = Change::deserialize(&mut std::io::Cursor::new(&record.bytes)) |
| 322 | .map_err(|error| BindingPackError::ChangeDecode { |
| 323 | key: record.key.clone(), |
| 324 | reason: error.to_string(), |
| 325 | })?; |
| 326 | if let Some(detail) = private_material_in_change(&change) { |
| 327 | return Err(BindingPackError::PrivateMaterial { |
| 328 | key: record.key.clone(), |
| 329 | detail, |
| 330 | }); |
| 331 | } |
| 332 | Ok((identity, change)) |
| 333 | } |
| 334 | |
| 335 | /// The private material a change carries for Git transport, if any (§12.13). |
| 336 | /// |