наблюдаемость: ввести безопасный контракт метрик
CI / Rust Checks (push) Successful in 6m9s
CI / UI Checks (push) Successful in 5s
CI / Community Image Smoke (push) Successful in 1m3s
CI / Frontend E2E (push) Successful in 3m47s
CI / Deploy (push) Failing after 3s
CI / Rust Checks (pull_request) Successful in 6m15s
CI / UI Checks (pull_request) Successful in 5s
CI / Frontend E2E (pull_request) Successful in 5m17s
CI / Community Image Smoke (pull_request) Successful in 4m25s
CI / Deploy (pull_request) Skipped

This commit is contained in:
bsodfather committed 2026-07-31 05:04:08 +03:00
1 parent ec2453c00f
commit 9b1a739e39
50 files changed
+3066 -433

No files matched your search

+22 -8
View File
@@ -38,7 +38,14 @@ pub async fn confirm_operation(
.or_else(|| confirmation_token_from_input(input));
let Some(provided_token) = provided_token else {
let token = issue_confirmation_token(store, &scope, &input_hash, &safety).await?;
let token = issue_confirmation_token(
store,
operation.operation_id.as_str(),
&scope,
&input_hash,
&safety,
)
.await?;
return Err(RuntimeError::ConfirmationRequired {
operation_id: operation.operation_id.as_str().to_owned(),
safety_class: safety.class,
@@ -47,7 +54,14 @@ pub async fn confirm_operation(
});
};
consume_confirmation_token(store, &scope, provided_token, &input_hash).await
consume_confirmation_token(
store,
operation.operation_id.as_str(),
&scope,
provided_token,
&input_hash,
)
.await
}
pub(crate) fn is_applicable(operation: &RuntimeOperation) -> bool {
@@ -108,6 +122,7 @@ fn confirmation_scope(
async fn issue_confirmation_token(
store: &dyn CoordinationStateStore,
operation_id: &str,
scope: &str,
input_hash: &str,
safety: &OperationSafetyPolicy,
@@ -128,15 +143,15 @@ async fn issue_confirmation_token(
Duration::from_millis(ttl_ms),
)
.await
.map_err(|error| RuntimeError::InvalidPreparedRequest {
field: "confirmation_token".to_owned(),
reason: error.to_string(),
.map_err(|_| RuntimeError::ConfirmationStoreUnavailable {
operation_id: operation_id.to_owned(),
})?;
Ok(token)
}
async fn consume_confirmation_token(
store: &dyn CoordinationStateStore,
operation_id: &str,
operation_scope: &str,
token: &str,
input_hash: &str,
@@ -145,9 +160,8 @@ async fn consume_confirmation_token(
let stored = store
.take_value(CacheScope::Coordination, &key)
.await
.map_err(|error| RuntimeError::InvalidPreparedRequest {
field: "confirmation_token".to_owned(),
reason: error.to_string(),
.map_err(|_| RuntimeError::ConfirmationStoreUnavailable {
operation_id: operation_id.to_owned(),
})?;
let Some(stored) = stored else {