mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 12:26:37 +00:00
docs(agents): streamline instruction routing (#6358)
This commit is contained in:
+6
-2
@@ -19,7 +19,9 @@ Applies to all paths under `crates/`.
|
||||
|
||||
- Document lock acquisition order when a module uses multiple locks. Never acquire the same set of locks in different orders across code paths.
|
||||
- Never hold a `tokio::sync::RwLock`/`Mutex` write guard across `.await` points unless the critical section is unavoidably async and the hold time is bounded.
|
||||
- Prefer `compare_exchange` loops over load-then-store for concurrent counters (peak values, adaptive heuristics).
|
||||
- Prefer direct atomic `fetch_*` operations for unconditional updates and
|
||||
`compare_exchange` loops only for conditional updates such as peaks or
|
||||
adaptive state.
|
||||
- When resetting multi-field atomic statistics, use a version/sequence counter or accept that concurrent readers may see partial snapshots; document the tradeoff.
|
||||
- `std::sync::Mutex` is acceptable in async context only when held for a brief, non-`await`-containing critical section. If in doubt, use `tokio::sync::Mutex`.
|
||||
|
||||
@@ -40,7 +42,9 @@ Applies to all paths under `crates/`.
|
||||
- Keep unit tests close to the module they test.
|
||||
- Keep integration tests under each crate's `tests/` directory.
|
||||
- Add regression tests for bug fixes and behavior changes.
|
||||
- Every test function must contain at least one `assert!`/`assert_eq!`/`assert_matches!`. A test that only calls code without asserting is not a test.
|
||||
- Every test needs an observable failure criterion. Direct assertions,
|
||||
delegated assertions, snapshots/properties, `#[should_panic]`, and meaningful
|
||||
`Result` failures are all valid; a call that can silently succeed is not.
|
||||
- In tests, prefer `.expect("context: what was being tested")` over bare `.unwrap()`. A test failure should tell you which operation failed and with what input.
|
||||
|
||||
## Async and Performance
|
||||
|
||||
@@ -50,4 +50,3 @@ crate.
|
||||
- `cargo test -p rustfs-audit`
|
||||
- Focused: `cargo test -p rustfs-audit --test pipeline_layer_test`
|
||||
- Focused: `cargo test -p rustfs-audit pipeline`
|
||||
- Full gate before commit: `make pre-commit`
|
||||
|
||||
@@ -28,4 +28,3 @@ follow.
|
||||
## Suggested Validation
|
||||
|
||||
- `cargo test --package e2e_test`
|
||||
- Full gate before commit: `make pre-commit`
|
||||
|
||||
@@ -49,4 +49,3 @@ Applies to `crates/ecstore/`.
|
||||
## Suggested Validation
|
||||
|
||||
- `cargo test -p rustfs-ecstore`
|
||||
- Full gate before commit: `make pre-commit`
|
||||
|
||||
@@ -24,4 +24,3 @@ Applies to `crates/iam/`.
|
||||
## Suggested Validation
|
||||
|
||||
- `cargo test -p rustfs-iam`
|
||||
- Full gate before commit: `make pre-commit`
|
||||
|
||||
@@ -55,4 +55,3 @@ shared plugin/runtime primitives from `rustfs-targets`.
|
||||
- Focused: `cargo test -p rustfs-notify runtime_facade`
|
||||
- Focused: `cargo test -p rustfs-notify runtime_view`
|
||||
- Focused: `cargo test -p rustfs-notify config_manager`
|
||||
- Full gate before commit: `make pre-commit`
|
||||
|
||||
@@ -23,4 +23,3 @@ Applies to `crates/policy/`.
|
||||
## Suggested Validation
|
||||
|
||||
- `cargo test -p rustfs-policy`
|
||||
- Full gate before commit: `make pre-commit`
|
||||
|
||||
@@ -75,4 +75,3 @@ run commands.
|
||||
- `cargo test -p rustfs-targets plugin`
|
||||
- `cargo test -p rustfs-targets runtime`
|
||||
- `cargo test -p rustfs-targets control_plane`
|
||||
- Full gate before commit: `make pre-commit`
|
||||
|
||||
Reference in New Issue
Block a user