наблюдаемость: завершить базовый контур Community
CI / Rust Checks (push) Failing after 4m28s
CI / UI Checks (push) Has been skipped
CI / Frontend E2E (push) Has been skipped
CI / Community Image Smoke (push) Has been skipped
CI / Deploy (push) Has been skipped

Добавить структурированные журналы, метрики, трассировку и безопасный канал критических ошибок. Усилить границы рантайма, тесты, проверку зависимостей и сценарии развёртывания.
This commit is contained in:
2026-07-31 01:01:14 +03:00
parent 99bd05c145
commit 0e8f1ca03a
160 changed files with 13506 additions and 1499 deletions
+40
View File
@@ -74,6 +74,12 @@ pub struct RateLimitBucketState {
pub last_refill_unix_ms: i64,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RateLimitDecision {
Allowed,
Rejected { retry_after_ms: u64 },
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ReplayGuardStatus {
@@ -86,6 +92,12 @@ pub struct CoordinationStateValue {
pub payload: Value,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CoordinationStateReservation {
Reserved,
Existing(CoordinationStateValue),
}
#[async_trait]
pub trait ResponseCacheStore: Send + Sync {
async fn get(&self, key: &str) -> Result<Option<CachedResponse>, CacheStoreError>;
@@ -108,6 +120,14 @@ pub trait RateLimitStateStore: Send + Sync {
ttl: Duration,
) -> Result<(), CacheStoreError>;
async fn delete_bucket(&self, key: &str) -> Result<(), CacheStoreError>;
async fn consume_token(
&self,
key: &str,
burst_tokens_micros: u64,
refill_per_second_micros: u64,
now_unix_ms: i64,
ttl: Duration,
) -> Result<RateLimitDecision, CacheStoreError>;
}
#[async_trait]
@@ -135,6 +155,26 @@ pub trait CoordinationStateStore: Send + Sync {
ttl: Duration,
) -> Result<(), CacheStoreError>;
async fn delete_value(&self, scope: CacheScope, key: &str) -> Result<(), CacheStoreError>;
async fn take_value(
&self,
scope: CacheScope,
key: &str,
) -> Result<Option<CoordinationStateValue>, CacheStoreError>;
async fn reserve_value(
&self,
scope: CacheScope,
key: &str,
value: CoordinationStateValue,
ttl: Duration,
) -> Result<CoordinationStateReservation, CacheStoreError>;
async fn compare_and_set_value(
&self,
scope: CacheScope,
key: &str,
expected: &CoordinationStateValue,
value: CoordinationStateValue,
ttl: Duration,
) -> Result<bool, CacheStoreError>;
}
#[derive(Debug, Error, PartialEq, Eq)]