Resume native editor jobs through verified checkpoints

This commit is contained in:
gloamxun committed 2026-11-19 09:35:33 +08:00
1 parent 31364ae33e
commit 0abf700817
19 files changed
+2311 -93

No files matched your search

@@ -1,9 +1,10 @@
//! Revision-gated publication for full native executions.
//! Revision-gated publication for native executions.
use sha2::{Digest, Sha256};
use std::sync::{Arc, Mutex};
use super::{
Cancellation, Error, Execution, ExecutionFailure, Executor, SourceFile, SourceProvider,
Cancellation, EntryCheckpoint, Error, Execution, ExecutionFailure, Executor, SourceFile,
SourceProvider,
};
#[derive(Clone, Default)]
@@ -165,6 +166,45 @@ impl RevisionJob {
let executed = executor
.with_cancellation(self.cancellation.clone())
.run_detailed(source, files);
self.finish_execution(executed, files)
}
/// Capture a possible entry continuation while executing the full revision.
pub fn run_capturing_entry<F: SourceProvider, H>(
self,
executor: Executor,
source: SourceFile,
files: &mut F,
minimum_frontier: usize,
capture_host: impl FnOnce(&mut F) -> H,
) -> (
Result<Arc<RevisionExecution>, RevisionFailure>,
Option<(EntryCheckpoint, H)>,
) {
let (executed, captured) = executor
.with_cancellation(self.cancellation.clone())
.run_capturing_entry(source, files, minimum_frontier, capture_host);
(self.finish_execution(executed, files), captured)
}
/// Resume after the host has validated prefix dependencies and replayed
/// their effects into the new revision's isolated file host.
pub fn resume_entry_after_host_replay(
self,
checkpoint: &EntryCheckpoint,
source: SourceFile,
files: &mut impl SourceProvider,
) -> Option<Result<Arc<RevisionExecution>, RevisionFailure>> {
let executed =
checkpoint.resume_after_host_replay(source, files, self.cancellation.clone())?;
Some(self.finish_execution(executed, files))
}
fn finish_execution(
self,
executed: Result<Execution, ExecutionFailure>,
files: &impl SourceProvider,
) -> Result<Arc<RevisionExecution>, RevisionFailure> {
// Host observations can themselves supersede the revision. Do not
// invoke the host while holding the session publication lock.
let resources = files.execution_resource_trace().cloned();