test: guard storage contract cleanup (#3501)

This commit is contained in:
安正超
2026-06-16 21:18:52 +08:00
committed by GitHub
parent c405470f73
commit 966756d788
4 changed files with 42 additions and 24 deletions
+4
View File
@@ -96,3 +96,7 @@ Required `rustfs-storage-api` public re-exports:
ECStore must keep compile-time coverage for both `StorageAdminApi` and the ECStore must keep compile-time coverage for both `StorageAdminApi` and the
separate `NamespaceLocking` operation group. separate `NamespaceLocking` operation group.
The old `StorageAPI` aggregate facade must not reappear in production
`crates/ecstore/src` or `rustfs/src` code after the storage operation groups
have been made explicit.
+26 -22
View File
@@ -5,17 +5,15 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
## Current Context ## Current Context
- Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660) - Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660)
- Branch: `overtrue/arch-remove-storage-api-facade` - Branch: `overtrue/arch-storage-contract-guard-cleanup`
- Baseline: `origin/main` at `c26593fa7a4b55849e98832cde657c6d4b167262` - Baseline: `origin/main` at `0f37c5675e2be5e42d1ef85a57ff9e744d412e91`
- PR type for this branch: `consumer-migration` - PR type for this branch: `consumer-migration`
- Runtime behavior changes: no external behavior change expected. - Runtime behavior changes: no external behavior change expected.
- Rust code changes: remove the old unused `StorageAPI` facade, its ECStore - Rust code changes: rename the remaining ECStore compatibility test away from
implementation blocks, its public re-export, and the stale compile-time the stale storage-api facade name.
compatibility test coverage. - CI/script changes: add a migration guard that rejects the old `StorageAPI`
- CI/script changes: adjust architecture migration guardrails to keep the aggregate facade identifier in production ECStore and RustFS source.
remaining storage-admin and namespace-lock contracts covered. - Docs changes: record the post-facade loss-prevention cleanup slice.
- Docs changes: record the final old-facade cleanup slice and its verification
state.
## Phase 0 Tasks ## Phase 0 Tasks
@@ -36,8 +34,9 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
- Completed slices: add a mechanical admin route matrix guard from - Completed slices: add a mechanical admin route matrix guard from
[`admin-route-action-snapshot.md`](admin-route-action-snapshot.md) and [`admin-route-action-snapshot.md`](admin-route-action-snapshot.md) and
`rustfs/src/admin/route_registration_test.rs`; add migration rules for `rustfs/src/admin/route_registration_test.rs`; add migration rules for
public storage-api re-export coverage and ECStore compatibility-test public storage-api re-export coverage, ECStore compatibility-test coverage,
coverage. and a production-source guard against reintroducing the removed
`StorageAPI` aggregate facade identifier.
- Acceptance: architecture migration rules fail if the public storage-api - Acceptance: architecture migration rules fail if the public storage-api
contract re-export surface drifts or if ECStore compile-time compatibility contract re-export surface drifts or if ECStore compile-time compatibility
tests for the remaining storage-admin and namespace-lock contracts are tests for the remaining storage-admin and namespace-lock contracts are
@@ -412,6 +411,10 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
implementations after API-007 migrated their consumers. implementations after API-007 migrated their consumers.
- Final cleanup slice: remove the old `StorageAPI` facade after all real - Final cleanup slice: remove the old `StorageAPI` facade after all real
consumers moved to concrete operation groups. consumers moved to concrete operation groups.
- Loss-prevention cleanup slice: rename the remaining ECStore contract
compatibility test away from the old storage-api facade name and guard
production ECStore/RustFS source against reintroducing the removed
aggregate facade identifier.
- Acceptance: storage operation traits remain available directly while admin - Acceptance: storage operation traits remain available directly while admin
inventory surfaces live only on `StorageAdminApi`. inventory surfaces live only on `StorageAdminApi`.
@@ -768,16 +771,16 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
| Expert | Status | Notes | | Expert | Status | Notes |
|---|---|---| |---|---|---|
| Quality/architecture | passed | Old `StorageAPI` facade removal leaves concrete operation traits and remaining storage-admin/namespace-lock contracts explicit. | | Quality/architecture | passed | Guard cleanup keeps ECStore contract coverage named after the remaining contracts and rejects old facade reintroduction in production source. |
| Migration preservation | passed | ECStore/Sets/SetDisks operation implementations remain in place; only the unused aggregate facade and stale guard coverage are removed. | | Migration preservation | passed | No runtime code path changes; this slice only renames the compatibility test and strengthens migration guardrails. |
| Testing/verification | passed | Focused compatibility test, compile checks, migration/layer guards, formatting, diff hygiene, Rust risk scan, and full `make pre-commit` passed. | | Testing/verification | passed | Focused contract test, compile checks, migration/layer guards, formatting, diff hygiene, Rust risk scan, and full `make pre-commit` passed. |
## Verification Notes ## Verification Notes
Passed on `c26593fa7a4b55849e98832cde657c6d4b167262`: Passed on `0f37c5675e2be5e42d1ef85a57ff9e744d412e91`:
- `cargo check -p rustfs-ecstore`: passed. - `cargo check -p rustfs-ecstore`: passed.
- `cargo test -p rustfs-ecstore --test storage_api_compat_test --no-fail-fast`: - `cargo test -p rustfs-ecstore --test ecstore_contract_compat_test --no-fail-fast`:
passed. passed.
- `cargo check -p rustfs -p rustfs-ecstore`: passed. - `cargo check -p rustfs -p rustfs-ecstore`: passed.
- `./scripts/check_architecture_migration_rules.sh`: passed. - `./scripts/check_architecture_migration_rules.sh`: passed.
@@ -790,15 +793,16 @@ Passed on `c26593fa7a4b55849e98832cde657c6d4b167262`:
Notes: Notes:
- This slice removes the old full storage facade after no real code consumers - This slice is a post-facade cleanup after `rustfs/rustfs#3490` and
remain. `rustfs/rustfs#3487` are both on `main`.
- The concrete storage operation traits, `StorageAdminApi`, and - The concrete storage operation traits, `StorageAdminApi`, and
`NamespaceLocking` remain available and covered. `NamespaceLocking` remain available and covered.
- The slice does not move traits across crate boundaries. - The slice does not move traits across crate boundaries or alter runtime
storage behavior.
## Handoff Notes ## Handoff Notes
- Old storage facade removal is locally verified on a branch current with - Storage contract guard cleanup is in progress on a branch current with
`origin/main`. `origin/main`.
- After this lands, remaining storage work can focus on concrete operation - After this lands, remaining storage work can continue from concrete operation
contracts instead of the aggregate facade. contracts with a guard against restoring the old aggregate facade identifier.
+12 -2
View File
@@ -49,6 +49,7 @@ PR_TYPE_HITS_FILE="${TMP_DIR}/pr_type_hits.txt"
SOURCE_MARKERS_FILE="${TMP_DIR}/source_markers.txt" SOURCE_MARKERS_FILE="${TMP_DIR}/source_markers.txt"
SOURCE_IDS_FILE="${TMP_DIR}/source_ids.txt" SOURCE_IDS_FILE="${TMP_DIR}/source_ids.txt"
REGISTER_IDS_FILE="${TMP_DIR}/register_ids.txt" REGISTER_IDS_FILE="${TMP_DIR}/register_ids.txt"
LEGACY_STORAGE_API_HITS_FILE="${TMP_DIR}/legacy_storage_api_hits.txt"
awk ' awk '
/^## PR Types$/ { /^## PR Types$/ {
@@ -186,16 +187,25 @@ require_source_line \
"pub use error::{StorageErrorCode, StorageResult};" \ "pub use error::{StorageErrorCode, StorageResult};" \
"storage-api public error contract re-export" "storage-api public error contract re-export"
(
cd "$ROOT_DIR"
rg -n --no-heading '\bStorageAPI\b' crates/ecstore/src rustfs/src || true
) >"$LEGACY_STORAGE_API_HITS_FILE"
if [[ -s "$LEGACY_STORAGE_API_HITS_FILE" ]]; then
report_failure "old StorageAPI facade identifier reintroduced in production source: $(paste -sd '; ' "$LEGACY_STORAGE_API_HITS_FILE")"
fi
require_source_contains \ require_source_contains \
"crates/ecstore/src/store_api/traits.rs" \ "crates/ecstore/src/store_api/traits.rs" \
"pub trait NamespaceLocking: Send + Sync + Debug + 'static" \ "pub trait NamespaceLocking: Send + Sync + Debug + 'static" \
"separate namespace-locking operation-group trait" "separate namespace-locking operation-group trait"
require_source_contains \ require_source_contains \
"crates/ecstore/tests/storage_api_compat_test.rs" \ "crates/ecstore/tests/ecstore_contract_compat_test.rs" \
"fn ecstore_implements_storage_admin_api_contract()" \ "fn ecstore_implements_storage_admin_api_contract()" \
"ECStore StorageAdminApi compile-time coverage test" "ECStore StorageAdminApi compile-time coverage test"
require_source_contains \ require_source_contains \
"crates/ecstore/tests/storage_api_compat_test.rs" \ "crates/ecstore/tests/ecstore_contract_compat_test.rs" \
"fn ecstore_implements_namespace_locking_contract()" \ "fn ecstore_implements_namespace_locking_contract()" \
"ECStore NamespaceLocking compile-time coverage test" "ECStore NamespaceLocking compile-time coverage test"