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

Method normalize_session_turn_order

atomic-core/src/pristine/txn/write/mod.rs:525–538  ·  view source on GitHub ↗

Re-derive a stored session's canonical order and KG without adding a turn. Used by rebuild to repair indexes created by older versions.

(&mut self, session_id: &str)

Source from the content-addressed store, hash-verified

523 /// Re-derive a stored session's canonical order and KG without adding a
524 /// turn. Used by rebuild to repair indexes created by older versions.
525 pub fn normalize_session_turn_order(&mut self, session_id: &str) -> PristineResult<()> {
526 let Some(record) = self.load_session_record_for_write(session_id)? else {
527 return Ok(());
528 };
529 let turns = self.load_session_turns_for_write(session_id)?;
530 let canonical = crate::change::session::canonicalize_session_turns(turns.clone());
531 if self.has_current_session_ledger_schema(session_id)?
532 && canonical == turns
533 && self.session_turn_kg_is_current(session_id, &turns)?
534 {
535 return Ok(());
536 }
537 self.rewrite_session_turns(record, canonical)
538 }
539
540 /// Index an immutable provenance graph as the next turn of its session.
541 ///

Callers 1

rebuild_session_indexMethod · 0.80

Tested by

no test coverage detected