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

Method finalize

atomic-core/src/record/workflow/assembly/mod.rs:324–362  ·  view source on GitHub ↗
(
        self,
        content: Vec<u8>,
        provenance: Vec<Provenance>,
        metadata_bytes: Vec<u8>,
    )

Source from the content-addressed store, hash-verified

322 /// ```
323 #[must_use]
324 pub fn finalize(
325 self,
326 content: Vec<u8>,
327 provenance: Vec<Provenance>,
328 metadata_bytes: Vec<u8>,
329 ) -> Change {
330 let mut dependencies: Vec<Hash> = self.dependencies.into_iter().collect();
331 dependencies.sort();
332
333 let mut extra_known: Vec<Hash> = self.extra_known.into_iter().collect();
334 extra_known.sort();
335
336 let mut change = Change::with_file_ops(
337 self.header,
338 self.hunks,
339 self.file_ops,
340 content,
341 dependencies,
342 );
343 change.hashed.extra_known = extra_known;
344 if !self.span_ops.is_empty() {
345 change.hashed.span = Some(crate::change::span_patch::SpanPatch::new(
346 Vec::new(),
347 self.span_ops,
348 ));
349 }
350
351 // Set opaque metadata bytes (e.g., SessionEnvelope from atomic-agent)
352 if !metadata_bytes.is_empty() {
353 change.hashed.metadata = metadata_bytes;
354 }
355
356 // Add AI provenance information
357 for entry in provenance {
358 change.add_provenance(entry);
359 }
360
361 change
362 }
363
364 /// Get the number of file operations collected.
365 #[must_use]

Callers 2

assemble_changeFunction · 0.45
test_context_finalizeFunction · 0.45

Calls 5

sortMethod · 0.80
collectMethod · 0.45
into_iterMethod · 0.45
is_emptyMethod · 0.45
add_provenanceMethod · 0.45

Tested by 1

test_context_finalizeFunction · 0.36