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

Method emit_session_fork_kg

atomic-core/src/pristine/txn/write/session_kg.rs:448–466  ·  view source on GitHub ↗

Emit the fork-derivation triple: child session `prov:wasDerivedFrom` parent session, with the fork boundary in edge metadata. Public because the fork boundary is decided at the repository layer (`Repository::fork_session`); the turn/session emission stays internal to the index paths.

(
        &mut self,
        child_session_id: &str,
        parent_session_id: &str,
        fork_turn: u32,
        parent_manifest: &Hash,
    )

Source from the content-addressed store, hash-verified

446 /// (`Repository::fork_session`); the turn/session emission stays internal
447 /// to the index paths.
448 pub fn emit_session_fork_kg(
449 &mut self,
450 child_session_id: &str,
451 parent_session_id: &str,
452 fork_turn: u32,
453 parent_manifest: &Hash,
454 ) -> PristineResult<()> {
455 self.upsert_kg_edge(
456 &KgEdge::new(
457 session_node_id(child_session_id),
458 session_node_id(parent_session_id),
459 predicate::WAS_DERIVED_FROM,
460 )
461 .with_metadata(serde_json::json!({
462 "fork_turn": fork_turn,
463 "parent_manifest": parent_manifest.to_base32(),
464 })),
465 )
466 }
467}

Callers 2

rebuild_session_indexMethod · 0.80
fork_sessionMethod · 0.80

Calls 3

session_node_idFunction · 0.85
upsert_kg_edgeMethod · 0.80
with_metadataMethod · 0.45

Tested by

no test coverage detected