pub fn execute_durable_ledger_transaction_with_planner<T, F>(
repo_root: &Path,
kind: &str,
batch_id_prefix: &str,
required_manifest_path: Option<&Path>,
dry_run: bool,
fault: Option<FaultInjectionPoint>,
planner_fn: F,
) -> Result<DurableTransactionOutcome<T>>where
F: FnOnce(&LedgerWriteGuard, &[LedgerNode], &[(JournalRecord, JournalRecord)]) -> Result<(Vec<PlannedLedgerItem>, BTreeMap<String, String>, T)>,Expand description
Shared durable transactional writer used by both process_inbox_nodes and update_system_graph_ledger.
Follows the strict recovery-first, manifest-enforced protocol under LedgerWriteGuard (LOCK_EX):
- Repairs any torn journal suffix and resumes any open
BATCH_PENDINGrecord before calling committed-only provenance validation (planner_fn). - If
--require-manifestis supplied and the newly recovered (or already committed)BATCH_COMMITTEDrecord matchesmanifest_sha256, verifies the final ledger and.ctbnbdlstate and returns idempotently. - Otherwise (Fresh-Start path), verifies baseline ledger SHA-256 and pinned input SHA-256s, runs
planner_fnon the committed baseline nodes andcommitted_pairs, verifies byte-for-byte agreement with--require-manifest(if supplied), writesBATCH_PENDING(when!dry_runand either!planned_items.is_empty()orrequired_manifest.is_some()), and executes Phase 1 + Phase 2 +BATCH_COMMITTEDviarecover_pending_ledger_journal_with_guard.