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:526–539  ·  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

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

Callers 1

rebuild_session_indexMethod · 0.80

Tested by

no test coverage detected