fix(runtime): remove startup panic fallbacks (#3754)

* fix(runtime): remove startup panic fallbacks

* test(runtime): cover buffer profile fallback safety

* test(runtime): reduce panic-style assertions

* fix(runtime): expose fallible env config setup

* test(runtime): simplify permit acquisition assertion

* test(runtime): tighten operation helper assertions

* fix(filemeta): stop panicking on invalid free version ids

* fix(init): satisfy buffer profile clippy lints

* fix(lock): harden fast lock config construction

* chore(checks): refresh layer dependency baseline

---------

Signed-off-by: houseme <housemecn@gmail.com>
This commit is contained in:
houseme
2026-06-23 12:31:26 +08:00
committed by GitHub
parent 583a23bdf2
commit a6878e8fce
11 changed files with 285 additions and 82 deletions
+28 -1
View File
@@ -14,8 +14,9 @@
#[cfg(test)]
mod fast_lock_tests {
use crate::fast_lock::FastObjectLockManager;
use crate::LockError;
use crate::fast_lock::types::{LockConfig, LockMode, LockPriority, LockResult, ObjectKey, ObjectLockRequest};
use crate::fast_lock::{DEFAULT_SHARD_COUNT, FastObjectLockManager};
use std::sync::Arc;
use std::time::Duration;
use tokio::time::sleep;
@@ -31,6 +32,32 @@ mod fast_lock_tests {
FastObjectLockManager::with_config(config)
}
#[test]
fn try_with_config_returns_error_for_invalid_shard_count() {
let config = LockConfig {
shard_count: 3,
..LockConfig::default()
};
let err = FastObjectLockManager::try_with_config(config)
.expect_err("non-power-of-two shard counts should return an explicit configuration error");
assert!(matches!(err, LockError::Configuration { .. }));
assert!(err.to_string().contains("shard count must be a non-zero power of 2"));
}
#[tokio::test]
async fn with_config_falls_back_to_default_for_invalid_shard_count() {
let config = LockConfig {
shard_count: 3,
..LockConfig::default()
};
let manager = FastObjectLockManager::with_config(config);
assert_eq!(manager.shards.len(), DEFAULT_SHARD_COUNT);
}
#[tokio::test]
async fn test_basic_write_lock_acquire_release() {
let manager = create_test_manager();