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
@@ -9,10 +9,11 @@ use super::common;
|
||||
|
||||
use crank_core::{
|
||||
AdmissionMode, AdmissionOutcome, AdmissionRequest, AdmissionScope, AgentId, ApprovalEvidence,
|
||||
ExecutionAdmission, NoTasksFallback, PlatformApiKey, PlatformApiKeyId, PlatformApiKeyKind,
|
||||
PlatformApiKeyScope, PlatformApiKeyStatus, RequestId, TaskAcceptRequest, TaskAccess,
|
||||
TaskEnvelope, TaskError, TaskFinishRequest, TaskId, TaskOwnerKind, TaskPins, TaskState,
|
||||
TaskStore, TaskSupportIds, ToolExecutionMode, TraceContext, WorkspaceId, current_unix_ms,
|
||||
BeginAttempt, ExecutionAdmission, NoTasksFallback, PlatformApiKey, PlatformApiKeyId,
|
||||
PlatformApiKeyKind, PlatformApiKeyScope, PlatformApiKeyStatus, RequestId, TaskAcceptRequest,
|
||||
TaskAccess, TaskEnvelope, TaskError, TaskFinishRequest, TaskId, TaskOwnerKind, TaskPins,
|
||||
TaskState, TaskStore, TaskSupportIds, ToolExecutionMode, TraceContext, WorkspaceId,
|
||||
current_unix_ms,
|
||||
};
|
||||
use crank_registry::{
|
||||
AdmissionLimits, CreatePlatformApiKeyRequest, PostgresExecutionAdmission, PostgresTaskStore,
|
||||
@@ -60,6 +61,7 @@ fn request(key: &str, fingerprint: &str, agent: &str, deadline_in_ms: i64) -> Ta
|
||||
execution_deadline_unix_ms: deadline,
|
||||
retain_until_unix_ms: deadline + 3_600_000,
|
||||
approval_reference: Some("appr_1".to_owned()),
|
||||
retry: crank_core::TaskRetryPolicy::single_attempt(),
|
||||
},
|
||||
scoped_key: key.to_owned(),
|
||||
input_fingerprint: fingerprint.to_owned(),
|
||||
@@ -708,28 +710,38 @@ async fn task_worker_lease_and_fencing_contract() {
|
||||
|
||||
// checkpoint dispatch once
|
||||
let checkpointed = store
|
||||
.checkpoint_dispatch(
|
||||
"worker_1",
|
||||
lease.record.task_id,
|
||||
lease.fence,
|
||||
"attempt-1".to_owned(),
|
||||
)
|
||||
.checkpoint_dispatch(BeginAttempt {
|
||||
task_id: lease.record.task_id,
|
||||
owner: "worker_1".to_owned(),
|
||||
fence: lease.fence,
|
||||
expected_version: lease.record.version,
|
||||
attempt_id: "attempt-1".to_owned(),
|
||||
input_fingerprint: lease.record.input_fingerprint.clone(),
|
||||
upstream_key_digest: None,
|
||||
retry_allowed: true,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(checkpointed.attempt.attempt_id, "attempt-1");
|
||||
assert_eq!(checkpointed.attempt.ordinal, 1);
|
||||
assert!(checkpointed.task.dispatch_started_at_unix_ms.is_some());
|
||||
assert_eq!(
|
||||
checkpointed.current_attempt_id.as_deref(),
|
||||
checkpointed.task.current_attempt_id.as_deref(),
|
||||
Some("attempt-1")
|
||||
);
|
||||
assert!(checkpointed.dispatch_started_at_unix_ms.is_some());
|
||||
|
||||
// second checkpoint rejected
|
||||
let second = store
|
||||
.checkpoint_dispatch(
|
||||
"worker_1",
|
||||
lease.record.task_id,
|
||||
lease.fence,
|
||||
"attempt-2".to_owned(),
|
||||
)
|
||||
.checkpoint_dispatch(BeginAttempt {
|
||||
task_id: lease.record.task_id,
|
||||
owner: "worker_1".to_owned(),
|
||||
fence: lease.fence,
|
||||
expected_version: checkpointed.task.version,
|
||||
attempt_id: "attempt-2".to_owned(),
|
||||
input_fingerprint: lease.record.input_fingerprint.clone(),
|
||||
upstream_key_digest: None,
|
||||
retry_allowed: true,
|
||||
})
|
||||
.await;
|
||||
assert!(second.is_err());
|
||||
|
||||
@@ -902,4 +914,5 @@ fn authority_key(
|
||||
}
|
||||
}
|
||||
|
||||
mod task_attempts;
|
||||
mod task_worker;
|
||||
Reference in new issue
Block a user