Refine Rust architecture boundaries
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
- `cargo clippy --workspace --all-targets --all-features -- -D warnings` — локальные ошибки, smell-и и часть API-антипаттернов.
|
||||
- `cargo test --workspace --all-targets` — unit и integration-style тесты.
|
||||
- `scripts/check-rust-code-health.sh` — локальный repo-level gate для размера Rust-файлов.
|
||||
- `scripts/check-rust-boundaries.sh` — crate-level dependency direction и module-level import rules.
|
||||
- `scripts/check-rust-module-boundaries.sh` — запрет на опасные imports внутри слоев.
|
||||
|
||||
Что можно добавить позже:
|
||||
|
||||
@@ -39,16 +41,21 @@
|
||||
- выделять route/service/runtime helper в отдельный модуль;
|
||||
- оставлять рядом с production-кодом только короткие unit-тесты приватной логики.
|
||||
|
||||
Текущие крупные файлы:
|
||||
Текущие крупные production-файлы считаются debt baseline. Они не должны расти, а при изменении их нужно постепенно разбирать:
|
||||
|
||||
- `apps/admin-api/src/service.rs`
|
||||
- `apps/admin-api/src/app.rs`
|
||||
- `apps/mcp-server/src/main.rs`
|
||||
- `crates/crank-runtime/src/executor.rs`
|
||||
- `crates/crank-registry/src/postgres/mod.rs`
|
||||
- `crates/crank-community-mcp/src/app.rs`
|
||||
- `crates/crank-registry/src/postgres/operation.rs`
|
||||
|
||||
Уже выделенные направления:
|
||||
|
||||
- `apps/admin-api/src/dto.rs` содержит HTTP payloads и view models.
|
||||
- `crates/crank-registry/src/postgres/pool_config.rs` содержит env parsing и validation pool settings.
|
||||
- `crates/crank-registry/src/postgres/connection.rs` содержит connection/migration wiring.
|
||||
- `crates/crank-community-mcp/src/transport.rs` содержит Streamable HTTP transport helpers.
|
||||
- `crates/crank-runtime::RuntimeExecutionRequest` является основным способом передавать execution параметры.
|
||||
|
||||
## Правила тестов
|
||||
|
||||
Рядом с кодом допустимы:
|
||||
@@ -88,3 +95,11 @@ crank-core -> no app crates
|
||||
```
|
||||
|
||||
Если потребуется строгая автоматическая проверка границ, добавим отдельный script на основе `cargo metadata` или `cargo-guppy`.
|
||||
|
||||
Module-level правила уже проверяются:
|
||||
|
||||
- `apps/admin-api/src/service*` не импортирует `axum`;
|
||||
- `apps/admin-api/src/routes*` не импортирует `crank_runtime`;
|
||||
- `crank-core/src` не импортирует framework/storage/network runtime crates;
|
||||
- `crank-registry/src` не импортирует HTTP framework/client crates;
|
||||
- `crank-runtime/src` не импортирует HTTP framework или SQL storage crates.
|
||||
|
||||
Reference in New Issue
Block a user