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
@@ -47,6 +47,8 @@ pub struct TaskAcceptDraft {
|
||||
/// Retention after the execution deadline.
|
||||
pub retention_ms: i64,
|
||||
pub approval_reference: Option<String>,
|
||||
/// Bounded retry snapshot pinned from the exact published operation at acceptance.
|
||||
pub retry: crank_core::TaskRetryPolicy,
|
||||
}
|
||||
|
||||
/// Projection of the durable status/result read. `result`/`error` are only present once a terminal
|
||||
@@ -161,6 +163,7 @@ impl TaskService {
|
||||
execution_deadline_unix_ms,
|
||||
retain_until_unix_ms: execution_deadline_unix_ms.saturating_add(retention_ms),
|
||||
approval_reference: draft.approval_reference,
|
||||
retry: draft.retry,
|
||||
},
|
||||
scoped_key,
|
||||
input_fingerprint,
|
||||
@@ -196,6 +199,35 @@ impl TaskService {
|
||||
))
|
||||
}
|
||||
|
||||
/// Owner-scoped cancellation of one accepted Task. The store decides under a row lock whether the
|
||||
/// Task can still be cancelled or whether an already checkpointed attempt makes the outcome
|
||||
/// uncertain; the service only carries the request and a bounded reason.
|
||||
pub async fn cancel(
|
||||
&self,
|
||||
access: &TaskAccess,
|
||||
task_id: TaskId,
|
||||
expected_version: Option<u32>,
|
||||
reason: &str,
|
||||
) -> Result<crank_core::TaskCancelOutcome, TaskError> {
|
||||
let request = crank_core::TaskCancelRequest {
|
||||
access: access.clone(),
|
||||
task_id,
|
||||
expected_version,
|
||||
reason: reason.to_owned(),
|
||||
};
|
||||
request.validate()?;
|
||||
self.store.cancel(request).await
|
||||
}
|
||||
|
||||
/// Bounded owner-scoped attempt history of one Task.
|
||||
pub async fn attempts(
|
||||
&self,
|
||||
access: &TaskAccess,
|
||||
task_id: TaskId,
|
||||
) -> Result<Vec<crank_core::TaskAttempt>, TaskError> {
|
||||
self.store.attempts(access, task_id).await
|
||||
}
|
||||
|
||||
/// Decrypts and validates the executable input bound to a valid current lease.
|
||||
pub async fn executable_input(
|
||||
&self,
|
||||
@@ -383,6 +415,7 @@ mod tests {
|
||||
deadline: Instant::now() + std::time::Duration::from_secs(30),
|
||||
retention_ms: TASK_DEFAULT_RETENTION_MS,
|
||||
approval_reference: None,
|
||||
retry: crank_core::TaskRetryPolicy::single_attempt(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user