feat(epic4): безопасные повторы и отмена durable Task (Story 4.4)
CI / UI Checks (pull_request) Successful in 8s
CI / Rust Checks (pull_request) Successful in 20m46s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
CI / UI Checks (pull_request) Successful in 8s
CI / Rust Checks (pull_request) Successful in 20m46s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
Durable per-outbound attempt до отправки запроса, bounded retry/read, server-owned verified writes, честный cancel/unknown, deadline/fencing, additive schema v29. Staged renames task.rs/tasks.rs разложены на модули. Includes disclosed cosmetic parity exception: единственная правка вне принятой дельты — удалена лишняя пустая строка в конце scripts/ci-story-checks.sh (EOF blank line); story-код не менялся.
This commit is contained in:
1 parent
8c02380762
commit
a3057de51e
44 files changed
+4547
-815
No files matched your search
@@ -605,6 +605,53 @@ async fn a_missing_task_store_fails_closed_and_readiness_reports_not_ready() {
|
||||
server.abort();
|
||||
}
|
||||
|
||||
/// Commits and resolves exactly one durable attempt of the current lease through the real store.
|
||||
///
|
||||
/// Story 4.4 moved the dispatch checkpoint and the attempt resolution into the runtime seam, so a
|
||||
/// worker-level test double persists exactly one attempt instead of inventing a second retry loop.
|
||||
pub(crate) async fn commit_attempt(
|
||||
context: &crank_runtime::TaskAttemptContext,
|
||||
outcome: crank_core::AttemptOutcome,
|
||||
) -> crank_runtime::TaskAttemptOutcome {
|
||||
use crank_core::{AttemptResolution, BeginAttempt, TaskState};
|
||||
|
||||
let lease = context.lease();
|
||||
let begin = BeginAttempt {
|
||||
task_id: lease.record.task_id,
|
||||
owner: lease.owner.clone(),
|
||||
fence: lease.fence,
|
||||
expected_version: lease.record.version,
|
||||
attempt_id: format!("attempt-{}", uuid::Uuid::now_v7()),
|
||||
input_fingerprint: lease.record.input_fingerprint.clone(),
|
||||
upstream_key_digest: None,
|
||||
retry_allowed: lease.record.pins.retry.max_attempts > 1,
|
||||
};
|
||||
match context.store().checkpoint_dispatch(begin).await {
|
||||
Ok(attempt) => match context.store().resolve_attempt(&attempt, outcome).await {
|
||||
Ok(AttemptResolution::Finished(task)) if task.state == TaskState::Completed => {
|
||||
crank_runtime::TaskAttemptOutcome::Completed
|
||||
}
|
||||
Ok(AttemptResolution::Finished(_)) => crank_runtime::TaskAttemptOutcome::Failed {
|
||||
code: "test_failure".to_owned(),
|
||||
},
|
||||
Ok(AttemptResolution::Unknown(_)) => crank_runtime::TaskAttemptOutcome::OutcomeUnknown,
|
||||
Ok(AttemptResolution::RetryAt { .. }) | Err(_) => {
|
||||
crank_runtime::TaskAttemptOutcome::Stopped
|
||||
}
|
||||
},
|
||||
Err(_) => crank_runtime::TaskAttemptOutcome::Stopped,
|
||||
}
|
||||
}
|
||||
|
||||
/// Bounded success outcome used by the worker-level test doubles.
|
||||
pub(crate) fn completed_outcome(value: serde_json::Value) -> crank_core::AttemptOutcome {
|
||||
crank_core::AttemptOutcome::Completed(
|
||||
crank_core::TaskEnvelope::try_redacted(&value).expect("test result is bounded"),
|
||||
)
|
||||
}
|
||||
|
||||
mod attempt_guards;
|
||||
mod attempt_trace;
|
||||
mod cancel_chain;
|
||||
mod shutdown_window;
|
||||
mod task_worker;
|
||||
Reference in new issue
Block a user